etcd

package
v0.0.0-...-5b448de Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2017 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) (*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

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

EtcdMasterElectionListener describes the multi ETCD election mechanism

type EtcdMasterElector

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

EtcdMasterElector describes an ETCD master elector

func NewEtcdMasterElector

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

NewEtcdMasterElector creates a new ETCD master elector

func NewEtcdMasterElectorFromConfig

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

NewEtcdMasterElectorFromConfig creates a new ETCD master elector from configuration

func (*EtcdMasterElector) AddEventListener

func (le *EtcdMasterElector) AddEventListener(listener EtcdMasterElectionListener)

AddEventListener registers a new listener

func (*EtcdMasterElector) IsMaster

func (le *EtcdMasterElector) IsMaster() bool

IsMaster returns true if the current instance is master

func (*EtcdMasterElector) Start

func (le *EtcdMasterElector) Start()

Start the master election mechanism

func (*EtcdMasterElector) StartAndWait

func (le *EtcdMasterElector) StartAndWait()

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

func (*EtcdMasterElector) Stop

func (le *EtcdMasterElector) Stop()

Stop the election mechanism

func (*EtcdMasterElector) TTL

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

TTL time to live

Jump to

Keyboard shortcuts

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