Documentation ¶
Index ¶
- func NewEtcdClient(ctx context.Context, config *EtcdConfig) (*clientv3.Client, error)
- type AddrStore
- type EtcdAdapter
- func (a *EtcdAdapter) Close() error
- func (a *EtcdAdapter) GetLocker(onLocked func(ctx context.Context) error) (lockproxy.Locker, error)
- func (a *EtcdAdapter) GetRemoteAddrStore(localAddrStore lockproxy.LocalAddrStore) (lockproxy.RemoteAddrStore, error)
- func (a *EtcdAdapter) Init(ctx context.Context) error
- type EtcdConfig
- type Locker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewEtcdClient ¶
Types ¶
type AddrStore ¶
type AddrStore struct {
// contains filtered or unexported fields
}
AddrStore stores the current proxy address locally. It sets the address in etcd and watches the changes.
func NewAddrStore ¶
type EtcdAdapter ¶
type EtcdAdapter struct {
// contains filtered or unexported fields
}
func NewEtcdAdapter ¶
func NewEtcdAdapter(config *EtcdConfig, logger *logrus.Entry) *EtcdAdapter
func (*EtcdAdapter) Close ¶
func (a *EtcdAdapter) Close() error
func (*EtcdAdapter) GetRemoteAddrStore ¶ added in v0.3.0
func (a *EtcdAdapter) GetRemoteAddrStore(localAddrStore lockproxy.LocalAddrStore) (lockproxy.RemoteAddrStore, error)
type EtcdConfig ¶
type EtcdConfig struct { // EtcdEndpoints is a comma separated list etcd server endpoints. // (LOCKPROXY_ETCDENDPOINTS) EtcdEndpoints []string `default:"localhost:2379"` // EtcdDialTimeout is the timeout for failing to establish an etcd connection. // (LOCKPROXY_ETCDDIALTIMEOUT) EtcdDialTimeout time.Duration `default:"10s"` // EtcdDialKeepAliveTime is the time after which client pings the server to // see if the transport is alive. // (LOCKPROXY_ETCDDIALKEEPALIVETIME) EtcdDialKeepAliveTime time.Duration `default:"10s"` // DialKeepAliveTimeout is the time that the client waits for a response for // the keep-alive probe. If the response is not received in this time, the // connection is closed. // (LOCKPROXY_ETCDDIALKEEPALIVETIMEOUT) EtcdDialKeepAliveTimeout time.Duration `default:"10s"` // EtcdUsername is an etcd user name for authentication. // (LOCKPROXY_ETCDUSERNAME) EtcdUsername string // EtcdPassword is an etcd password for authentication. // (LOCKPROXY_ETCDPASSWORD) EtcdPassword string // EtcdLockTTL is the duration of the etcd lock (in seconds). The lock will // be refreshed every EtcdLockTTL seconds. // (LOCKPROXY_ETCDLOCKTTL) EtcdLockTTL int `default:"10"` // EtcdUnlockTimeout is the max duration for waiting etcd to unlock after the // Cmd is stopped. // (LOCKPROXY_ETCDUNLOCKTIMEOUT) EtcdUnlockTimeout time.Duration `default:"10s"` // EtcdLockKey is the etcd key used for etcd lock. // (LOCKPROXY_ETCDLOCKKEY) EtcdLockKey string `required:"true"` // EtcdAddrKey is the etcd key used to store the address of the current // leader. // (LOCKPROXY_ETCDADDRKEY) EtcdAddrKey string `required:"true"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.