Documentation ¶
Index ¶
- Constants
- func IsCallbackPending(w *Watcher, shouldClear bool) bool
- func NewPublishWatcher(ctx context.Context, addr string, setters ...WatcherOption) (persist.Watcher, error)
- func NewWatcher(ctx context.Context, addr string, setters ...WatcherOption) (persist.Watcher, error)
- type Watcher
- type WatcherMetrics
- type WatcherOption
- func Channel(subject string) WatcherOption
- func IgnoreSelf(ignore bool) WatcherOption
- func LocalID(id string) WatcherOption
- func Password(password string) WatcherOption
- func Protocol(protocol string) WatcherOption
- func RecordMetrics(callback func(*WatcherMetrics)) WatcherOption
- func SquashMessages(squash bool) WatcherOption
- func SquashTimeoutLong(d time.Duration) WatcherOption
- func SquashTimeoutShort(d time.Duration) WatcherOption
- func Username(username string) WatcherOption
- func WithRedisPubConnection(connection *redis.Client) WatcherOption
- func WithRedisSubConnection(connection *redis.Client) WatcherOption
- type WatcherOptions
Constants ¶
View Source
const ( RedisCloseMetric = "RedisClose" RedisDialMetric = "RedisDial" PubSubPublishMetric = "PubSubPublish" PubSubReceiveMetric = "PubSubReceive" PubSubSubscribeMetric = "PubSubSubscribe" PubSubUnsubscribeMetric = "PubSubUnsubscribe" )
Variables ¶
This section is empty.
Functions ¶
func IsCallbackPending ¶
IsCallbackPending
func NewPublishWatcher ¶
func NewPublishWatcher(ctx context.Context, addr string, setters ...WatcherOption) (persist.Watcher, error)
NewPublishWatcher return a Watcher only publish but not subscribe
func NewWatcher ¶
func NewWatcher(ctx context.Context, addr string, setters ...WatcherOption) (persist.Watcher, error)
NewWatcher creates a new Watcher to be used with a Casbin enforcer addr is a redis target string in the format "host:port" setters allows for inline WatcherOptions
Types ¶
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
func (*Watcher) GetWatcherOptions ¶
func (w *Watcher) GetWatcherOptions() WatcherOptions
GetWatcherOptions return option settings
func (*Watcher) SetUpdateCallback ¶
SetUpdateCallback sets the update callback function invoked by the watcher when the policy is updated. Defaults to Enforcer.LoadPolicy()
type WatcherMetrics ¶
type WatcherOption ¶
type WatcherOption func(*WatcherOptions)
func Channel ¶
func Channel(subject string) WatcherOption
func IgnoreSelf ¶
func IgnoreSelf(ignore bool) WatcherOption
func LocalID ¶
func LocalID(id string) WatcherOption
func Password ¶
func Password(password string) WatcherOption
func Protocol ¶
func Protocol(protocol string) WatcherOption
func RecordMetrics ¶
func RecordMetrics(callback func(*WatcherMetrics)) WatcherOption
func SquashMessages ¶
func SquashMessages(squash bool) WatcherOption
func SquashTimeoutLong ¶
func SquashTimeoutLong(d time.Duration) WatcherOption
func SquashTimeoutShort ¶
func SquashTimeoutShort(d time.Duration) WatcherOption
func Username ¶
func Username(username string) WatcherOption
func WithRedisPubConnection ¶
func WithRedisPubConnection(connection *redis.Client) WatcherOption
func WithRedisSubConnection ¶
func WithRedisSubConnection(connection *redis.Client) WatcherOption
type WatcherOptions ¶
type WatcherOptions struct { Channel string PubConn *redis.Client SubConn *redis.Client Username string Password string Protocol string IgnoreSelf bool LocalID string RecordMetrics func(*WatcherMetrics) SquashMessages bool SquashTimeoutShort time.Duration SquashTimeoutLong time.Duration // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.