etcd

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2022 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMaxSnapshots = 5
	DefaultMaxWALs      = 5

	DefaultWarningApplyDuration = 100 * time.Millisecond

	DefaultDowngradeCheckTime = 5 * time.Second

	DefaultStrictReconfigCheck = true
	// DefaultEnableV2 is the default value for "--enable-v2" flag.
	// v2 API is disabled by default.
	DefaultEnableV2 = false
)

Variables

View Source
var (
	ErrorAlreadyInCluster = errors.New("already in cluster")
	ErrorNotInCluster     = errors.New("not in cluster")
	ErrorMemberNotExist   = errors.New("member not exist")
)

Functions

func NewServer

func NewServer(ctx context.Context, mux *http.ServeMux, config Config) (*_Server, error)

func WriteError

func WriteError(w http.ResponseWriter, r *http.Request, err error)

Types

type Build

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

func (*Build) Check

func (*Build) Enabled

func (b *Build) Enabled(level zapcore.Level) bool

func (*Build) Sync

func (b *Build) Sync() error

func (*Build) With

func (b *Build) With(fields []zapcore.Field) zapcore.Core

func (*Build) Write

func (b *Build) Write(ent zapcore.Entry, fields []zapcore.Field) error

type ClusterInfo added in v0.8.1

type ClusterInfo struct {
	Cluster string  `json:"cluster"`
	Nodes   []*Node `json:"nodes,omitempty"`
}

type Clusters added in v0.8.1

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

func NewClusters added in v0.8.1

func NewClusters(ctx context.Context, client *clientv3.Client, s *_Server) *Clusters

type Config added in v0.8.1

type Config struct {
	PeerAdvertiseUrls    []string
	ClientAdvertiseUrls  []string
	GatewayAdvertiseUrls []string
	DataDir              string
}

func (*Config) CreatePeerUrl added in v0.8.1

func (c *Config) CreatePeerUrl() (types.URLs, types.URLs, error)

type Etcd

type Etcd interface {
	IsLeader() (bool, []string)
	KV
	Watch(prefix string, handler ServiceHandler)
	HandlerLeader(h ...ILeaderStateHandler)
	Join(target string) error
	Leave() error
	Close() error
	Info() Info
	Nodes() []*Node
	Status() ClusterInfo
	Version() Versions
	Remove(name string) error
}

type EventType added in v0.8.1

type EventType = mvccpb.Event_EventType

type ILeaderStateHandler

type ILeaderStateHandler interface {
	LeaderChange(isLeader bool)
}

type Info

type Info = *membership.Member

type KV

type KV interface {
	Put(key string, value []byte) error
	Delete(key string) error
}

type KValue

type KValue struct {
	Key   []byte
	Value []byte
}

type Logger

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

func NewLogger

func NewLogger() *Logger

func (*Logger) Check

func (*Logger) Enabled

func (l *Logger) Enabled(level zapcore.Level) bool

func (*Logger) Sync

func (l *Logger) Sync() error

func (*Logger) With

func (l *Logger) With(fields []zapcore.Field) zapcore.Core

func (*Logger) Write

func (l *Logger) Write(ent zapcore.Entry, fields []zapcore.Field) error

type Node added in v0.7.0

type Node struct {
	Id       string   `json:"id,omitempty"`
	Name     string   `json:"name,omitempty"`
	Peer     []string `json:"peer,omitempty"`
	Admin    []string `json:"admin,omitempty"`
	Server   []string `json:"server,omitempty"`
	IsLeader bool     `json:"leader,omitempty"`
}

type NodeGatewayConfig added in v0.8.1

type NodeGatewayConfig struct {
	Urls []string `json:"urls"`
}

type Response

type Response struct {
	Code string      `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data,omitempty"`
}

type ServiceHandler

type ServiceHandler interface {
	KV
	Reset([]*KValue)
}

type Versions added in v0.7.0

type Versions version.Versions

Jump to

Keyboard shortcuts

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