etcd

package
v0.0.0-...-f584327 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GetPartitionMagic is the Magic Number for get partition through range request
	GetPartitionMagic int64 = 1888
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BackendShim

type BackendShim interface {
	// Create inserts new key into storage
	Create(ctx context.Context, put *etcdserverpb.PutRequest) (*etcdserverpb.TxnResponse, error)

	// Delete removes key from storage
	Delete(ctx context.Context, key []byte, revision int64) (*etcdserverpb.TxnResponse, error)

	// Update set key into storage
	Update(ctx context.Context, rev int64, key []byte, value []byte, lease int64) (*etcdserverpb.TxnResponse, error)

	// Compact clears the kvs that are too old
	Compact(ctx context.Context, revision uint64) (*etcdserverpb.TxnResponse, error)

	// Get read a kv from storage
	Get(ctx context.Context, r *etcdserverpb.RangeRequest) (*etcdserverpb.RangeResponse, error)

	// List read kvs in range
	List(ctx context.Context, r *etcdserverpb.RangeRequest) (*etcdserverpb.RangeResponse, error)

	// Count counts the number of kvs in range
	Count(ctx context.Context, r *etcdserverpb.RangeRequest) (*etcdserverpb.RangeResponse, error)

	// GetPartitions query the partition state of storage for ListByStream
	GetPartitions(ctx context.Context, r *etcdserverpb.RangeRequest) (*etcdserverpb.RangeResponse, error)

	// ListByStream reads kvs in range by stream
	ListByStream(ctx context.Context, startKey, endKey []byte, revision uint64) (<-chan *etcdserverpb.WatchResponse, error)

	// Watch subscribe the changes from revision on kvs with given prefix
	Watch(ctx context.Context, key string, revision uint64) (<-chan []*mvccpb.Event, error)

	// GetResourceLock returns the resource lock for leader election
	GetResourceLock() resourcelock.Interface

	// GetCurrentRevision returns the read revision
	GetCurrentRevision() uint64

	// SetCurrentRevision is used for init tso for leader
	SetCurrentRevision(uint64)
}

BackendShim wrapper Backend interface to adapt with Etcd grpc protobuf

func NewBackendShim

func NewBackendShim(backend backend.Backend, metricCli metrics.Metrics) BackendShim

type RPCServer

type RPCServer struct {

	// watcher map mutes
	sync.Mutex
	// contains filtered or unexported fields
}

RPCServer only support limited method of etcd grpc server

func New

func New(backend b.Backend, metricCli metrics.Metrics, peers service.PeerService) *RPCServer

New returns the etcd rpc server

func (*RPCServer) LeaseKeepAlive

func (*RPCServer) MemberAdd

MemberAdd adds a member into the cluster.

func (*RPCServer) MemberList

MemberList lists the current cluster membership.

func (*RPCServer) MemberPromote

MemberPromote promotes a member from raft learner (non-voting) to raft voting member.

func (*RPCServer) MemberRemove

MemberRemove removes an existing member from the cluster.

func (*RPCServer) MemberUpdate

MemberUpdate updates the peer addresses of the member.

func (*RPCServer) Put

func (*RPCServer) Range

func (*RPCServer) Register

func (s *RPCServer) Register(server *grpc.Server)

Register register etcd grpc service

func (*RPCServer) Txn

func (*RPCServer) Watch

Jump to

Keyboard shortcuts

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