[Feature] redis-watcher's partial implementation of the WatcherEx interface
JalinWang opened this issue Β· comments
Though claimed in the code, the Redis Watcher doesn't implement the WatcherEx indeed.
This is a part of fixing for Casbin Issue 999.
Related issue: #1
The definition of the WatherEx interface:
type WatcherEx interface {
Watcher
UpdateForAddPolicy(sec, ptype string, params ...string) error
UpdateForRemovePolicy(sec, ptype string, params ...string) error
UpdateForRemoveFilteredPolicy(sec, ptype string, fieldIndex int, fieldValues ...string) error
UpdateForSavePolicy(model model.Model) error
// *****NOT implemented*****
UpdateForAddPolicies(sec string, ptype string, rules ...[]string) error
UpdateForRemovePolicies(sec string, ptype string, rules ...[]string) error
}
@tangyang9464 @closetool @sagilio
For the next, I will find somewhere to put the default update handler on receiving the update message from Redis.
Though this handler should involve changing the behavior in the casbin core repo, I prefer to put it here(redis-watcher repo). It seems not to be a generic one and depends on the emitted update message format.
Any suggestion?
For the next, I will find somewhere to put the default update handler on receiving the update message from Redis.
Though this handler should involve changing the behavior in the casbin core repo, I prefer to put it here(redis-watcher repo). It seems not to be a general one and depends on the emitted update message format.
Any suggestion?
- For
watcherEx
, if the user does not pass in the callback function parameter, we should provide a default implementation of the callback function when creating the watcher. - For
Casbin SetWatcher
compatibility, determine whether the incoming watcher implements watcheEx interface. If not, keep it as it is. If so, the callback should not be set, because we cannot provide a generic implementation, which should be determined by the watcher itself
@hsluoyz @JalinWang I think this should be enhancement
label instead of Bug
π
@hsluoyz @JalinWang I think this should be
enhancement
label instead ofBug
π
Agree. It's assigned by the bot and I have no permission to change it.
@tangyang9464 @JalinWang changed
π This issue has been resolved in version 0.4.0 π
The release is available on GitHub release
Your semantic-release bot π¦π