Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct { *clientv3.Client KVWrapper KVWrapper // wraps the same KV as Client // contains filtered or unexported fields }
Client is a wrapper around etcd client v3. It provides interfaces rooted by a namespace in etcd.
Client.Client is nil before OnStart.
func ProvideClient ¶
ProvideClient creates a new Etcd Client and provides it via Fx.
type ClientIn ¶
type ClientIn struct { fx.In Unmarshaller config.Unmarshaller Lifecycle fx.Lifecycle Logger *log.Logger ConfigOverride *ConfigOverride `optional:"true"` }
ClientIn holds parameters for ProvideClient.
type ConfigOverride ¶ added in v2.8.0
type ConfigOverride struct { Namespace string // required Endpoints []string // required PerRPCCredentials credentials.PerRPCCredentials // optional OverriderName string // who is providing the override, for logs }
ConfigOverride can be provided by an extension to provide parts of etcd client config directly.
type KVWrapper ¶ added in v2.9.0
KVWrapper wraps clientv3.KV, can be used when wanting to depend on clientv3.KV already before OnStart.
KVWrapper.KV is nil before OnStart.
Note: This is not named just KV not to break .KV field access.
type Session ¶ added in v2.9.0
type Session struct {
// contains filtered or unexported fields
}
Session wraps concurrencyv3.Session.
Session may be available at OnStart, but that's not guaranteed. Session will shutdown the app when it expires.
func ProvideSession ¶ added in v2.9.0
ProvideSession provides Session.
func (*Session) WaitSession ¶ added in v2.10.0
WaitSession waits (up to context deadline) for etcd session to be established or errors.
type SessionScopedKV ¶ added in v2.9.0
type SessionScopedKV struct {
KVWrapper
}
SessionScopedKV implements clientv3.KV by attaching the session's lease to all Put requests, effectively scoping all created keys to the session.
func ProvideSessionScopedKV ¶ added in v2.9.0
func ProvideSessionScopedKV(client *Client, session *Session, lc fx.Lifecycle) *SessionScopedKV
ProvideSessionScopedKV provides SessionScopedKV.
Note: This requires Session, so any usage of SessionScopedKV will cause app to shut down.