manager

package
v0.4.14 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2020 License: Apache-2.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultGossipPort = 7980
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*client.Client
	// contains filtered or unexported fields
}

type Cluster added in v0.4.12

type Cluster struct {
	ID                  int `e2db:"id"`
	Created             time.Time
	RequiredClusterSize int
}

type Config

type Config struct {
	// name used for etcd.Embed instance, should generally be left alone so
	// that a random name is generated
	Name string

	// directory used for etcd data-dir, wal and snapshot dirs derived from
	// this by etcd
	Dir string

	// the required number of nodes that must be present to start a cluster
	RequiredClusterSize int

	// allows for explicit setting of the host ip
	Host string

	// client endpoint for accessing etcd
	ClientAddr string

	// client url created based upon the client address and use of TLS
	ClientURL url.URL

	// address used for traffic within the cluster
	PeerAddr string

	// peer url created based upon the peer address and use of TLS
	PeerURL url.URL

	// address used for gossip network
	GossipAddr string

	// host used for gossip network, derived from GossipAddr
	GossipHost string

	// port used for gossip network, derived from GossipAddr
	GossipPort int

	// addresses used to bootstrap the gossip network
	BootstrapAddrs []string

	// amount of time to attempt bootstrapping before failing
	BootstrapTimeout time.Duration

	// interval for creating etcd snapshots
	SnapshotInterval time.Duration

	// use gzip compression for snapshot backup
	SnapshotCompression bool

	// use aes-256 encryption for snapshot backup
	SnapshotEncryption bool

	// how often to perform a health check
	HealthCheckInterval time.Duration

	// time until an unreachable member is considered unhealthy
	HealthCheckTimeout time.Duration

	// configures authentication/transport security for clients
	ClientSecurity client.SecurityConfig

	// configures authentication/transport security within the etcd cluster
	PeerSecurity client.SecurityConfig

	CACertFile string
	CAKeyFile  string

	// configures the level of the logger used by etcd
	EtcdLogLevel zapcore.Level

	discovery.PeerGetter
	snapshot.Snapshotter

	Debug bool
	// contains filtered or unexported fields
}

type Manager

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

Manager manages an embedded etcd instance.

func New

func New(cfg *Config) (*Manager, error)

New creates a new instance of Manager.

func (*Manager) GracefulStop

func (m *Manager) GracefulStop()

GracefulStop stops all services and cleans up the Manager state. It attempts to gracefully shutdown etcd by waiting for gRPC calls in-flight to finish.

func (*Manager) HardStop

func (m *Manager) HardStop()

HardStop stops all services and cleans up the Manager state. Unlike GracefulStop, it does not attempt to gracefully shutdown etcd.

func (*Manager) Restart added in v0.4.12

func (m *Manager) Restart() error

func (*Manager) Run

func (m *Manager) Run() error

Run starts and manages an etcd node based upon the provided configuration. In the case of a fault, or if the manager is otherwise stopped, this method exits.

type ManagerService added in v0.4.12

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

func (*ManagerService) Health added in v0.4.12

func (*ManagerService) Restart added in v0.4.12

type Member

type Member struct {
	ID             uint64
	Name           string
	ClientAddr     string
	ClientURL      string
	PeerAddr       string
	PeerURL        string
	GossipAddr     string
	BootstrapAddrs []string
	Status         NodeStatus
}

func (*Member) Marshal

func (m *Member) Marshal() ([]byte, error)

func (*Member) Unmarshal

func (m *Member) Unmarshal(data []byte) error

type NodeStatus

type NodeStatus int
const (
	Unknown NodeStatus = iota
	Pending
	Running
)

func (NodeStatus) String

func (s NodeStatus) String() string

type Peer

type Peer struct {
	Name string
	URL  string
}

func (*Peer) String

func (p *Peer) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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