etcd

package
v0.16.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2018 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EmbeddedEtcd

type EmbeddedEtcd struct {
	Port int
	// contains filtered or unexported fields
}

EmbeddedEtcd provides a single node etcd server.

func NewEmbeddedEtcd

func NewEmbeddedEtcd(sa common.ServiceAddress, dataDir string, maxWalFiles, maxSnapFiles uint) (*EmbeddedEtcd, error)

NewEmbeddedEtcd creates a new embedded ETCD server

func NewEmbeddedEtcdFromConfig

func NewEmbeddedEtcdFromConfig() (*EmbeddedEtcd, error)

NewEmbeddedEtcdFromConfig creates a new embedded ETCD server from configuration

func (*EmbeddedEtcd) Stop

func (se *EmbeddedEtcd) Stop() error

Stop the embedded server

type EtcdClient

type EtcdClient struct {
	Client  *etcd.Client
	KeysAPI etcd.KeysAPI
}

EtcdClient describes a ETCD configuration client

func NewEtcdClient

func NewEtcdClient(etcdServers []string, clientTimeout time.Duration) (*EtcdClient, error)

NewEtcdClient creates a new ETCD client connection to ETCD servers

func NewEtcdClientFromConfig

func NewEtcdClientFromConfig() (*EtcdClient, error)

NewEtcdClientFromConfig creates a new ETCD client from configuration

func (*EtcdClient) GetInt64

func (client *EtcdClient) GetInt64(key string) (int64, error)

GetInt64 returns an int64 value from the configuration key

func (*EtcdClient) SetInt64

func (client *EtcdClient) SetInt64(key string, value int64) error

SetInt64 set an int64 value to the configuration key

func (*EtcdClient) Stop

func (client *EtcdClient) Stop()

Stop the client

type EtcdMasterElectionListener added in v0.16.0

type EtcdMasterElectionListener interface {
	OnStartAsMaster()
	OnStartAsSlave()
	OnSwitchToMaster()
	OnSwitchToSlave()
}

EtcdMasterElectionListener describes the multi ETCD election mechanism

type EtcdMasterElector added in v0.16.0

type EtcdMasterElector struct {
	sync.RWMutex
	EtcdKeyAPI etcd.KeysAPI
	Host       string
	// contains filtered or unexported fields
}

EtcdMasterElector describes an ETCD master elector

func NewEtcdMasterElector added in v0.16.0

func NewEtcdMasterElector(host string, serviceType common.ServiceType, key string, etcdClient *EtcdClient) *EtcdMasterElector

NewEtcdMasterElector creates a new ETCD master elector

func NewEtcdMasterElectorFromConfig added in v0.16.0

func NewEtcdMasterElectorFromConfig(serviceType common.ServiceType, key string, etcdClient *EtcdClient) *EtcdMasterElector

NewEtcdMasterElectorFromConfig creates a new ETCD master elector from configuration

func (*EtcdMasterElector) AddEventListener added in v0.16.0

func (le *EtcdMasterElector) AddEventListener(listener EtcdMasterElectionListener)

AddEventListener registers a new listener

func (*EtcdMasterElector) IsMaster added in v0.16.0

func (le *EtcdMasterElector) IsMaster() bool

IsMaster returns true if the current instance is master

func (*EtcdMasterElector) Start added in v0.16.0

func (le *EtcdMasterElector) Start()

Start the master election mechanism

func (*EtcdMasterElector) StartAndWait added in v0.16.0

func (le *EtcdMasterElector) StartAndWait()

StartAndWait starts the election mechanism and wait for the first election before returning

func (*EtcdMasterElector) Stop added in v0.16.0

func (le *EtcdMasterElector) Stop()

Stop the election mechanism

func (*EtcdMasterElector) TTL added in v0.16.0

func (le *EtcdMasterElector) TTL() time.Duration

TTL time to live

Source Files

  • client.go
  • election.go
  • server.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL