Is using SyncedEnforcer necessary if you are accessing the same enforcer using multiple threads but only to call enforce as opposed to any of the methods which modify policies?
Say again, for a synced policy file, you mean you want to use enforce as well as the other policy methods?
No I mean I have a single shared enforcer (let's assume that the policies have been loaded in a synchronised manner). Currently I use SyncedEnforcer however the only method I call on this enforcer is enforce. Can I switch to using Enforcer without introducing race conditions into my code?
I mean, if you are working on a distributed environment you should always ask to a synced source
right but from my understanding enforce is a read only operation so if I can get rid of the overhead of calling synchronised code I would prefer to do that to improve performance
I see. If you don't care about higher consistency, I'd say go for it
can you please elaborate on what you mean by higher consistency?
I can try, it syncs right? if the policies you are trying to enforce come from a synced repository of policies, the enforcement request will be consistent with the latest rules, meaning that it will load an updated (synced) list of policies, rather than not synced repo and probably loading it from an outdated one.
yes that was my thinking too, which is why I thought that in this case it is fine to access the enforcer in a multithreaded context if you are only using it to enforce policies which are not changing
True
Join the conversation
Sign up to reply, like and follow topics.
Suggested Topics
Want to read more? Browse other topics in Casbin or view latest topics.
