etcd

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 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")
)

Functions

func CreatePeerUrl

func CreatePeerUrl() (types.URLs, types.URLs, error)

func NewServer

func NewServer(ctx context.Context, mux *http.ServeMux) (*_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 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() *Node
	Version() Versions
}

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"`
	Admin    []string `json:"admin,omitempty"`
	Server   []string `json:"server,omitempty"`
	IsLeader bool     `json:"leader,omitempty"`
}

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