MCPcopy
hub / github.com/apache/casbin / SetUpdateCallback

Method SetUpdateCallback

persist/watcher.go:22–22  ·  view source on GitHub ↗

SetUpdateCallback sets the callback function that the watcher will call when the policy in DB has been changed by other instances. A classic callback is Enforcer.LoadPolicy().

(func(string))

Source from the content-addressed store, hash-verified

20 // when the policy in DB has been changed by other instances.
21 // A classic callback is Enforcer.LoadPolicy().
22 SetUpdateCallback(func(string)) error
23 // Update calls the update callback of other instances to synchronize their policy.
24 // It is usually called after changing the policy in DB, like Enforcer.SavePolicy(),
25 // Enforcer.AddPolicy(), Enforcer.RemovePolicy(), etc.

Callers 2

TestSelfModifyFunction · 0.65
SetWatcherMethod · 0.65

Implementers 1

SampleWatcherwatcher_test.go

Calls

no outgoing calls

Tested by 1

TestSelfModifyFunction · 0.52