Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewWatcher ¶
func NewWatcher(endpoint string, policyUpdatedSubject string, options ...nats.Option) (persist.Watcher, error)
NewWatcher creates new Nats watcher. Parameters:
- endpoint Endpoint of Nats server
- policyUpdatedSubject Nats subject that sends message when policy was updated externally. It leads to call of callback
- options Options to connect Nats like user, password, etc.
Types ¶
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher implements persist.Watcher interface
func (*Watcher) Close ¶
func (w *Watcher) Close()
Close stops and releases the watcher, the callback function will not be called any more.
func (*Watcher) SetUpdateCallback ¶
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().
Click to show internal directories.
Click to hide internal directories.