Documentation ¶
Index ¶
- func NewProducer(kv *KV, key string) (p bus.Producer)
- func NormalizeKey(v ...string) (res string)
- func TrimKeyPrefix(prefix string, key string) (res string)
- type Backend
- type BackendConfig
- type BackendFactory
- type Config
- type ConsulBackend
- func (b *ConsulBackend) Close() error
- func (b ConsulBackend) CommitChan() chan []StoreCommit
- func (b ConsulBackend) Ctx() context.Context
- func (b ConsulBackend) FailCtx() context.Context
- func (b ConsulBackend) Leave()
- func (b ConsulBackend) ReadyCtx() context.Context
- func (b *ConsulBackend) Submit(op []StoreOp)
- func (b *ConsulBackend) Subscribe(req []WatchRequest)
- func (b ConsulBackend) WatchResultsChan() chan WatchResult
- type KV
- func (k *KV) Configure(config Config)
- func (k *KV) Open() (err error)
- func (k *KV) PermanentStore(prefix string) (consumer bus.Consumer)
- func (k *KV) Producer(key string) (producer bus.Producer)
- func (k *KV) Submit(ops []StoreOp)
- func (k *KV) SubscribeKey(key string, ctx context.Context, consumer bus.Consumer)
- func (k *KV) VolatileStore(prefix string) (consumer bus.Consumer)
- type StoreCommit
- type StoreOp
- type TestingBackend
- func (b TestingBackend) Close() error
- func (b TestingBackend) CommitChan() chan []StoreCommit
- func (b TestingBackend) Ctx() context.Context
- func (b TestingBackend) FailCtx() context.Context
- func (b TestingBackend) Leave()
- func (b TestingBackend) ReadyCtx() context.Context
- func (b *TestingBackend) Submit(ops []StoreOp)
- func (b *TestingBackend) Subscribe(requests []WatchRequest)
- func (b TestingBackend) WatchResultsChan() chan WatchResult
- type TestingBackendConfig
- type WatchRequest
- type WatchResult
- type ZeroBackend
- func (b ZeroBackend) Close() error
- func (b ZeroBackend) CommitChan() chan []StoreCommit
- func (b ZeroBackend) Ctx() context.Context
- func (b ZeroBackend) FailCtx() context.Context
- func (b ZeroBackend) Leave()
- func (b ZeroBackend) ReadyCtx() context.Context
- func (w *ZeroBackend) Submit(ops []StoreOp)
- func (w *ZeroBackend) Subscribe(req []WatchRequest)
- func (b ZeroBackend) WatchResultsChan() chan WatchResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NormalizeKey ¶
func TrimKeyPrefix ¶
Types ¶
type Backend ¶
type Backend interface { io.Closer Ctx() context.Context // Backend context closes on backend is not available to accept operations FailCtx() context.Context // Fail context closes then backend is failed ReadyCtx() context.Context // Ready context closes then backend is ready to accept operations Submit(ops []StoreOp) // Submit ops to backend Subscribe(req []WatchRequest) CommitChan() chan []StoreCommit WatchResultsChan() chan WatchResult Leave() // Leave cluster }
type BackendConfig ¶
type BackendFactory ¶
func NewTestingBackendFactory ¶
func NewTestingBackendFactory(backendConfig TestingBackendConfig) (f BackendFactory)
type Config ¶
type Config struct { NodeID string `mapstructure:"node_id"` BackendURL string `mapstructure:"backend"` // kind://address/chroot Advertise string `mapstructure:"advertise"` TTL time.Duration `mapstructure:"ttl"` RetryInterval time.Duration `mapstructure:"retry"` }
Cluster config
func DefaultConfig ¶
func DefaultConfig() (c Config)
type ConsulBackend ¶
type ConsulBackend struct {
// contains filtered or unexported fields
}
Consul Backend
func NewConsulBackend ¶
func NewConsulBackend(ctx context.Context, log *logx.Log, config BackendConfig) (w *ConsulBackend)
func (*ConsulBackend) Close ¶
func (b *ConsulBackend) Close() error
func (ConsulBackend) CommitChan ¶
func (b ConsulBackend) CommitChan() chan []StoreCommit
func (*ConsulBackend) Submit ¶
func (b *ConsulBackend) Submit(op []StoreOp)
func (*ConsulBackend) Subscribe ¶
func (b *ConsulBackend) Subscribe(req []WatchRequest)
func (ConsulBackend) WatchResultsChan ¶
func (b ConsulBackend) WatchResultsChan() chan WatchResult
type KV ¶
type KV struct { *supervisor.Control // contains filtered or unexported fields }
func (*KV) SubscribeKey ¶
Subscribe for changes
type StoreCommit ¶
type TestingBackend ¶
type TestingBackend struct {
// contains filtered or unexported fields
}
Backend for testing purposes
func NewTestingBackend ¶
func NewTestingBackend(ctx context.Context, log *logx.Log, config TestingBackendConfig) (b *TestingBackend)
func (TestingBackend) CommitChan ¶
func (b TestingBackend) CommitChan() chan []StoreCommit
func (*TestingBackend) Submit ¶
func (b *TestingBackend) Submit(ops []StoreOp)
func (*TestingBackend) Subscribe ¶
func (b *TestingBackend) Subscribe(requests []WatchRequest)
func (TestingBackend) WatchResultsChan ¶
func (b TestingBackend) WatchResultsChan() chan WatchResult
type TestingBackendConfig ¶
type WatchRequest ¶
type WatchResult ¶
type ZeroBackend ¶
type ZeroBackend struct {
// contains filtered or unexported fields
}
Zero backend used for local purposes. Zero backend is never ready.
func NewZeroBackend ¶
func NewZeroBackend(ctx context.Context, log *logx.Log) (w *ZeroBackend)
func (ZeroBackend) CommitChan ¶
func (b ZeroBackend) CommitChan() chan []StoreCommit
func (*ZeroBackend) Submit ¶
func (w *ZeroBackend) Submit(ops []StoreOp)
func (*ZeroBackend) Subscribe ¶
func (w *ZeroBackend) Subscribe(req []WatchRequest)
func (ZeroBackend) WatchResultsChan ¶
func (b ZeroBackend) WatchResultsChan() chan WatchResult
Click to show internal directories.
Click to hide internal directories.