etcd

package
v1.4.8 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*config)

Option to etcd config

func WithAddPeers

func WithAddPeers(name, addr string) Option

WithAddPeers returns add peers option

func WithDataDir

func WithDataDir(dir string) Option

WithDataDir returns data dir option

func WithName

func WithName(name string) Option

WithName returns name option

func WithPeerAddr

func WithPeerAddr(peerAddr string) Option

WithPeerAddr returns peer address option

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server etcd server

func NewServer

func NewServer(ops ...Option) (*Server, error)

NewServer new etcd server with options

func (*Server) AddOptions

func (s *Server) AddOptions(ops ...Option) error

AddOptions add some options when server not running

func (*Server) IsLeader

func (s *Server) IsLeader() bool

IsLeader Check leader

func (*Server) Ready

func (s *Server) Ready() <-chan struct{}

Ready Returns a channel that will be closed when etcd is ready

func (*Server) Start

func (s *Server) Start(ctx context.Context)

Start etcd server

func (*Server) Stop

func (s *Server) Stop()

Stop etcd server

func (*Server) Stopped

func (s *Server) Stopped() <-chan struct{}

Stopped Returns a channel that will be closed when etcd is stopped

func (*Server) Storage

func (s *Server) Storage() *clientv3.Client

Storage returns etcd storage

Jump to

Keyboard shortcuts

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