Documentation
¶
Overview ¶
Package etcdserver defines how etcd servers interact and store their states.
Index ¶
- Constants
- func GetClusterFromRemotePeers(lg *zap.Logger, urls []string, rt http.RoundTripper) (*membership.RaftCluster, error)
- func GetMembershipInfoInV2Format(lg *zap.Logger, cl *membership.RaftCluster) []byte
- func HashByRev(ctx context.Context, cid types.ID, cc *http.Client, url string, rev int64) (*pb.HashKVResponse, error)
- func NewRaftLogger(lcfg *zap.Config) (raft.Logger, error)
- func NewRaftLoggerFromZapCore(cr zapcore.Core, syncer zapcore.WriteSyncer) raft.Logger
- func NewRaftLoggerZap(lg *zap.Logger) raft.Logger
- func NewServerVersionAdapter(s *EtcdServer) *serverVersionAdapter
- type AccessController
- type Authenticator
- type CorruptionChecker
- type EtcdServer
- func (s *EtcdServer) AddMember(ctx context.Context, memb membership.Member) ([]*membership.Member, error)
- func (s *EtcdServer) Alarm(ctx context.Context, r *pb.AlarmRequest) (*pb.AlarmResponse, error)
- func (s *EtcdServer) Alarms() []*pb.AlarmMember
- func (s *EtcdServer) AppliedIndex() uint64
- func (s *EtcdServer) ApplyWait() <-chan struct{}
- func (s *EtcdServer) AuthDisable(ctx context.Context, r *pb.AuthDisableRequest) (*pb.AuthDisableResponse, error)
- func (s *EtcdServer) AuthEnable(ctx context.Context, r *pb.AuthEnableRequest) (*pb.AuthEnableResponse, error)
- func (s *EtcdServer) AuthInfoFromCtx(ctx context.Context) (*auth.AuthInfo, error)
- func (s *EtcdServer) AuthStatus(ctx context.Context, r *pb.AuthStatusRequest) (*pb.AuthStatusResponse, error)
- func (s *EtcdServer) AuthStore() auth.AuthStore
- func (s *EtcdServer) Authenticate(ctx context.Context, r *pb.AuthenticateRequest) (*pb.AuthenticateResponse, error)
- func (s *EtcdServer) Backend() backend.Backend
- func (s *EtcdServer) Cleanup()
- func (s *EtcdServer) ClientCertAuthEnabled() bool
- func (s *EtcdServer) Cluster() api.Cluster
- func (s *EtcdServer) ClusterVersion() *semver.Version
- func (s *EtcdServer) CommittedIndex() uint64
- func (s *EtcdServer) Compact(ctx context.Context, r *pb.CompactionRequest) (*pb.CompactionResponse, error)
- func (s *EtcdServer) Config() config.ServerConfig
- func (s *EtcdServer) CorruptionChecker() CorruptionChecker
- func (s *EtcdServer) CutPeer(id types.ID)
- func (s *EtcdServer) DeleteRange(ctx context.Context, r *pb.DeleteRangeRequest) (*pb.DeleteRangeResponse, error)
- func (s *EtcdServer) Downgrade(ctx context.Context, r *pb.DowngradeRequest) (*pb.DowngradeResponse, error)
- func (s *EtcdServer) DowngradeEnabledHandler() http.Handler
- func (s *EtcdServer) DowngradeInfo() *serverversion.DowngradeInfo
- func (s *EtcdServer) FeatureEnabled(f featuregate.Feature) bool
- func (s *EtcdServer) FirstCommitInTermNotify() <-chan struct{}
- func (s *EtcdServer) ForceSnapshot()
- func (s *EtcdServer) GoAttach(f func())
- func (s *EtcdServer) HardStop()
- func (s *EtcdServer) HashKVHandler() http.Handler
- func (s *EtcdServer) IsIDRemoved(id uint64) bool
- func (s *EtcdServer) IsLearner() bool
- func (s *EtcdServer) IsMemberExist(id types.ID) bool
- func (s *EtcdServer) KV() mvcc.WatchableKV
- func (s *EtcdServer) Lead() uint64
- func (s *EtcdServer) Leader() types.ID
- func (s *EtcdServer) LeaderChangedNotify() <-chan struct{}
- func (s *EtcdServer) LeaseGrant(ctx context.Context, r *pb.LeaseGrantRequest) (*pb.LeaseGrantResponse, error)
- func (s *EtcdServer) LeaseHandler() http.Handler
- func (s *EtcdServer) LeaseLeases(_ context.Context, _ *pb.LeaseLeasesRequest) (*pb.LeaseLeasesResponse, error)
- func (s *EtcdServer) LeaseRenew(ctx context.Context, id lease.LeaseID) (int64, error)
- func (s *EtcdServer) LeaseRevoke(ctx context.Context, r *pb.LeaseRevokeRequest) (*pb.LeaseRevokeResponse, error)
- func (s *EtcdServer) LeaseTimeToLive(ctx context.Context, r *pb.LeaseTimeToLiveRequest) (*pb.LeaseTimeToLiveResponse, error)
- func (s *EtcdServer) LinearizableReadNotify(ctx context.Context) error
- func (s *EtcdServer) Logger() *zap.Logger
- func (s *EtcdServer) MemberID() types.ID
- func (s *EtcdServer) MemberId() types.ID
- func (s *EtcdServer) MendPeer(id types.ID)
- func (s *EtcdServer) MoveLeader(ctx context.Context, lead, transferee uint64) error
- func (s *EtcdServer) NewUberApplier() apply.UberApplier
- func (s *EtcdServer) PauseSending()
- func (s *EtcdServer) Process(ctx context.Context, m raftpb.Message) error
- func (s *EtcdServer) PromoteMember(ctx context.Context, id uint64) ([]*membership.Member, error)
- func (s *EtcdServer) Put(ctx context.Context, r *pb.PutRequest) (*pb.PutResponse, error)
- func (s *EtcdServer) RaftHandler() http.Handler
- func (s *EtcdServer) Range(ctx context.Context, r *pb.RangeRequest) (*pb.RangeResponse, error)
- func (s *EtcdServer) ReadyNotify() <-chan struct{}
- func (s *EtcdServer) RemoveMember(ctx context.Context, id uint64) ([]*membership.Member, error)
- func (s *EtcdServer) ReportSnapshot(id uint64, status raft.SnapshotStatus)
- func (s *EtcdServer) ReportUnreachable(id uint64)
- func (s *EtcdServer) ResumeSending()
- func (s *EtcdServer) RoleAdd(ctx context.Context, r *pb.AuthRoleAddRequest) (*pb.AuthRoleAddResponse, error)
- func (s *EtcdServer) RoleDelete(ctx context.Context, r *pb.AuthRoleDeleteRequest) (*pb.AuthRoleDeleteResponse, error)
- func (s *EtcdServer) RoleGet(ctx context.Context, r *pb.AuthRoleGetRequest) (*pb.AuthRoleGetResponse, error)
- func (s *EtcdServer) RoleGrantPermission(ctx context.Context, r *pb.AuthRoleGrantPermissionRequest) (*pb.AuthRoleGrantPermissionResponse, error)
- func (s *EtcdServer) RoleList(ctx context.Context, r *pb.AuthRoleListRequest) (*pb.AuthRoleListResponse, error)
- func (s *EtcdServer) RoleRevokePermission(ctx context.Context, r *pb.AuthRoleRevokePermissionRequest) (*pb.AuthRoleRevokePermissionResponse, error)
- func (s *EtcdServer) Start()
- func (s *EtcdServer) Stop()
- func (s *EtcdServer) StopNotify() <-chan struct{}
- func (s *EtcdServer) StoppingNotify() <-chan struct{}
- func (s *EtcdServer) StorageVersion() *semver.Version
- func (s *EtcdServer) Term() uint64
- func (s *EtcdServer) TryTransferLeadershipOnShutdown() error
- func (s *EtcdServer) Txn(ctx context.Context, r *pb.TxnRequest) (*pb.TxnResponse, error)
- func (s *EtcdServer) UpdateMember(ctx context.Context, memb membership.Member) ([]*membership.Member, error)
- func (s *EtcdServer) UserAdd(ctx context.Context, r *pb.AuthUserAddRequest) (*pb.AuthUserAddResponse, error)
- func (s *EtcdServer) UserChangePassword(ctx context.Context, r *pb.AuthUserChangePasswordRequest) (*pb.AuthUserChangePasswordResponse, error)
- func (s *EtcdServer) UserDelete(ctx context.Context, r *pb.AuthUserDeleteRequest) (*pb.AuthUserDeleteResponse, error)
- func (s *EtcdServer) UserGet(ctx context.Context, r *pb.AuthUserGetRequest) (*pb.AuthUserGetResponse, error)
- func (s *EtcdServer) UserGrantRole(ctx context.Context, r *pb.AuthUserGrantRoleRequest) (*pb.AuthUserGrantRoleResponse, error)
- func (s *EtcdServer) UserList(ctx context.Context, r *pb.AuthUserListRequest) (*pb.AuthUserListResponse, error)
- func (s *EtcdServer) UserRevokeRole(ctx context.Context, r *pb.AuthUserRevokeRoleRequest) (*pb.AuthUserRevokeRoleResponse, error)
- func (s *EtcdServer) Version() *serverversion.Manager
- func (s *EtcdServer) Watchable() mvcc.WatchableKV
- type Hasher
- type Lessor
- type RaftKV
- type RequestV2
- type Response
- type Server
- type ServerPeer
- type ServerPeerV2
- type ServerV2
- type ServerV3
Constants ¶
const ( DefaultSnapshotCount = 10000 // DefaultSnapshotCatchUpEntries is the number of entries for a slow follower // to catch-up after compacting the raft storage entries. // We expect the follower has a millisecond level latency with the leader. // The max throughput is around 10K. Keep a 5K entries is enough for helping // follower to catch up. DefaultSnapshotCatchUpEntries uint64 = 5000 StoreClusterPrefix = "/0" StoreKeysPrefix = "/1" // HealthInterval is the minimum time the cluster should be healthy // before accepting add and delete member requests. HealthInterval = 5 * time.Second DowngradeEnabledPath = "/downgrade/enabled" )
const PeerHashKVPath = "/members/hashkv"
Variables ¶
This section is empty.
Functions ¶
func GetClusterFromRemotePeers ¶
func GetClusterFromRemotePeers(lg *zap.Logger, urls []string, rt http.RoundTripper) (*membership.RaftCluster, error)
GetClusterFromRemotePeers takes a set of URLs representing etcd peers, and attempts to construct a Cluster by accessing the members endpoint on one of these URLs. The first URL to provide a response is used. If no URLs provide a response, or a Cluster cannot be successfully created from a received response, an error is returned. Each request has a 10-second timeout. Because the upper limit of TTL is 5s, 10 second is enough for building connection and finishing request.
func GetMembershipInfoInV2Format ¶
func GetMembershipInfoInV2Format(lg *zap.Logger, cl *membership.RaftCluster) []byte
func HashByRev ¶
func HashByRev(ctx context.Context, cid types.ID, cc *http.Client, url string, rev int64) (*pb.HashKVResponse, error)
HashByRev fetch hash of kv store at the given rev via http call to the given url
func NewRaftLogger ¶
NewRaftLogger builds "raft.Logger" from "*zap.Config".
func NewRaftLoggerFromZapCore ¶
func NewRaftLoggerFromZapCore(cr zapcore.Core, syncer zapcore.WriteSyncer) raft.Logger
NewRaftLoggerFromZapCore creates "raft.Logger" from "zap.Core" and "zapcore.WriteSyncer".
func NewRaftLoggerZap ¶
NewRaftLoggerZap converts "*zap.Logger" to "raft.Logger".
func NewServerVersionAdapter ¶
func NewServerVersionAdapter(s *EtcdServer) *serverVersionAdapter
Types ¶
type AccessController ¶
type AccessController struct { CORS map[string]struct{} HostWhitelist map[string]struct{} // contains filtered or unexported fields }
AccessController controls etcd server HTTP request access.
func NewAccessController ¶
func NewAccessController() *AccessController
NewAccessController returns a new "AccessController" with default "*" values.
func (*AccessController) IsHostWhitelisted ¶
func (ac *AccessController) IsHostWhitelisted(host string) bool
IsHostWhitelisted returns true if the host is whitelisted. If whitelist is empty, allow all.
func (*AccessController) OriginAllowed ¶
func (ac *AccessController) OriginAllowed(origin string) bool
OriginAllowed determines whether the server will allow a given CORS origin. If CORS is empty, allow all.
type Authenticator ¶
type Authenticator interface { AuthEnable(ctx context.Context, r *pb.AuthEnableRequest) (*pb.AuthEnableResponse, error) AuthDisable(ctx context.Context, r *pb.AuthDisableRequest) (*pb.AuthDisableResponse, error) AuthStatus(ctx context.Context, r *pb.AuthStatusRequest) (*pb.AuthStatusResponse, error) Authenticate(ctx context.Context, r *pb.AuthenticateRequest) (*pb.AuthenticateResponse, error) UserAdd(ctx context.Context, r *pb.AuthUserAddRequest) (*pb.AuthUserAddResponse, error) UserDelete(ctx context.Context, r *pb.AuthUserDeleteRequest) (*pb.AuthUserDeleteResponse, error) UserChangePassword(ctx context.Context, r *pb.AuthUserChangePasswordRequest) (*pb.AuthUserChangePasswordResponse, error) UserGrantRole(ctx context.Context, r *pb.AuthUserGrantRoleRequest) (*pb.AuthUserGrantRoleResponse, error) UserGet(ctx context.Context, r *pb.AuthUserGetRequest) (*pb.AuthUserGetResponse, error) UserRevokeRole(ctx context.Context, r *pb.AuthUserRevokeRoleRequest) (*pb.AuthUserRevokeRoleResponse, error) RoleAdd(ctx context.Context, r *pb.AuthRoleAddRequest) (*pb.AuthRoleAddResponse, error) RoleGrantPermission(ctx context.Context, r *pb.AuthRoleGrantPermissionRequest) (*pb.AuthRoleGrantPermissionResponse, error) RoleGet(ctx context.Context, r *pb.AuthRoleGetRequest) (*pb.AuthRoleGetResponse, error) RoleRevokePermission(ctx context.Context, r *pb.AuthRoleRevokePermissionRequest) (*pb.AuthRoleRevokePermissionResponse, error) RoleDelete(ctx context.Context, r *pb.AuthRoleDeleteRequest) (*pb.AuthRoleDeleteResponse, error) UserList(ctx context.Context, r *pb.AuthUserListRequest) (*pb.AuthUserListResponse, error) RoleList(ctx context.Context, r *pb.AuthRoleListRequest) (*pb.AuthRoleListResponse, error) }
type CorruptionChecker ¶
type EtcdServer ¶
type EtcdServer struct { Cfg config.ServerConfig SyncTicker *time.Ticker *AccessController // contains filtered or unexported fields }
EtcdServer is the production implementation of the Server interface
func NewServer ¶
func NewServer(cfg config.ServerConfig) (srv *EtcdServer, err error)
NewServer creates a new EtcdServer from the supplied configuration. The configuration is considered static for the lifetime of the EtcdServer.
func (*EtcdServer) AddMember ¶
func (s *EtcdServer) AddMember(ctx context.Context, memb membership.Member) ([]*membership.Member, error)
func (*EtcdServer) Alarm ¶
func (s *EtcdServer) Alarm(ctx context.Context, r *pb.AlarmRequest) (*pb.AlarmResponse, error)
func (*EtcdServer) Alarms ¶
func (s *EtcdServer) Alarms() []*pb.AlarmMember
func (*EtcdServer) AppliedIndex ¶
func (s *EtcdServer) AppliedIndex() uint64
func (*EtcdServer) ApplyWait ¶
func (s *EtcdServer) ApplyWait() <-chan struct{}
func (*EtcdServer) AuthDisable ¶
func (s *EtcdServer) AuthDisable(ctx context.Context, r *pb.AuthDisableRequest) (*pb.AuthDisableResponse, error)
func (*EtcdServer) AuthEnable ¶
func (s *EtcdServer) AuthEnable(ctx context.Context, r *pb.AuthEnableRequest) (*pb.AuthEnableResponse, error)
func (*EtcdServer) AuthInfoFromCtx ¶
func (*EtcdServer) AuthStatus ¶
func (s *EtcdServer) AuthStatus(ctx context.Context, r *pb.AuthStatusRequest) (*pb.AuthStatusResponse, error)
func (*EtcdServer) AuthStore ¶
func (s *EtcdServer) AuthStore() auth.AuthStore
func (*EtcdServer) Authenticate ¶
func (s *EtcdServer) Authenticate(ctx context.Context, r *pb.AuthenticateRequest) (*pb.AuthenticateResponse, error)
func (*EtcdServer) Backend ¶
func (s *EtcdServer) Backend() backend.Backend
func (*EtcdServer) Cleanup ¶
func (s *EtcdServer) Cleanup()
Cleanup removes allocated objects by EtcdServer.NewServer in situation that EtcdServer::Start was not called (that takes care of cleanup).
func (*EtcdServer) ClientCertAuthEnabled ¶
func (s *EtcdServer) ClientCertAuthEnabled() bool
func (*EtcdServer) Cluster ¶
func (s *EtcdServer) Cluster() api.Cluster
func (*EtcdServer) ClusterVersion ¶
func (s *EtcdServer) ClusterVersion() *semver.Version
func (*EtcdServer) CommittedIndex ¶
func (s *EtcdServer) CommittedIndex() uint64
func (*EtcdServer) Compact ¶
func (s *EtcdServer) Compact(ctx context.Context, r *pb.CompactionRequest) (*pb.CompactionResponse, error)
func (*EtcdServer) Config ¶
func (s *EtcdServer) Config() config.ServerConfig
func (*EtcdServer) CorruptionChecker ¶
func (s *EtcdServer) CorruptionChecker() CorruptionChecker
func (*EtcdServer) CutPeer ¶
func (s *EtcdServer) CutPeer(id types.ID)
CutPeer drops messages to the specified peer.
func (*EtcdServer) DeleteRange ¶
func (s *EtcdServer) DeleteRange(ctx context.Context, r *pb.DeleteRangeRequest) (*pb.DeleteRangeResponse, error)
func (*EtcdServer) Downgrade ¶
func (s *EtcdServer) Downgrade(ctx context.Context, r *pb.DowngradeRequest) (*pb.DowngradeResponse, error)
func (*EtcdServer) DowngradeEnabledHandler ¶
func (s *EtcdServer) DowngradeEnabledHandler() http.Handler
func (*EtcdServer) DowngradeInfo ¶
func (s *EtcdServer) DowngradeInfo() *serverversion.DowngradeInfo
func (*EtcdServer) FeatureEnabled ¶
func (s *EtcdServer) FeatureEnabled(f featuregate.Feature) bool
FeatureEnabled returns true if the feature is enabled by the etcd server, false otherwise.
func (*EtcdServer) FirstCommitInTermNotify ¶
func (s *EtcdServer) FirstCommitInTermNotify() <-chan struct{}
FirstCommitInTermNotify returns channel that will be unlocked on first entry committed in new term, which is necessary for new leader to answer read-only requests (leader is not able to respond any read-only requests as long as linearizable semantic is required)
func (*EtcdServer) ForceSnapshot ¶
func (s *EtcdServer) ForceSnapshot()
func (*EtcdServer) GoAttach ¶
func (s *EtcdServer) GoAttach(f func())
GoAttach creates a goroutine on a given function and tracks it using the etcdserver waitgroup. The passed function should interrupt on s.StoppingNotify().
func (*EtcdServer) HardStop ¶
func (s *EtcdServer) HardStop()
HardStop stops the server without coordination with other members in the cluster.
func (*EtcdServer) HashKVHandler ¶
func (s *EtcdServer) HashKVHandler() http.Handler
func (*EtcdServer) IsIDRemoved ¶
func (s *EtcdServer) IsIDRemoved(id uint64) bool
func (*EtcdServer) IsLearner ¶
func (s *EtcdServer) IsLearner() bool
IsLearner returns if the local member is raft learner
func (*EtcdServer) IsMemberExist ¶
func (s *EtcdServer) IsMemberExist(id types.ID) bool
IsMemberExist returns if the member with the given id exists in cluster.
func (*EtcdServer) KV ¶
func (s *EtcdServer) KV() mvcc.WatchableKV
func (*EtcdServer) Lead ¶
func (s *EtcdServer) Lead() uint64
func (*EtcdServer) Leader ¶
func (s *EtcdServer) Leader() types.ID
func (*EtcdServer) LeaderChangedNotify ¶
func (s *EtcdServer) LeaderChangedNotify() <-chan struct{}
func (*EtcdServer) LeaseGrant ¶
func (s *EtcdServer) LeaseGrant(ctx context.Context, r *pb.LeaseGrantRequest) (*pb.LeaseGrantResponse, error)
func (*EtcdServer) LeaseHandler ¶
func (s *EtcdServer) LeaseHandler() http.Handler
func (*EtcdServer) LeaseLeases ¶
func (s *EtcdServer) LeaseLeases(_ context.Context, _ *pb.LeaseLeasesRequest) (*pb.LeaseLeasesResponse, error)
LeaseLeases is really ListLeases !???
func (*EtcdServer) LeaseRenew ¶
func (*EtcdServer) LeaseRevoke ¶
func (s *EtcdServer) LeaseRevoke(ctx context.Context, r *pb.LeaseRevokeRequest) (*pb.LeaseRevokeResponse, error)
func (*EtcdServer) LeaseTimeToLive ¶
func (s *EtcdServer) LeaseTimeToLive(ctx context.Context, r *pb.LeaseTimeToLiveRequest) (*pb.LeaseTimeToLiveResponse, error)
func (*EtcdServer) LinearizableReadNotify ¶
func (s *EtcdServer) LinearizableReadNotify(ctx context.Context) error
func (*EtcdServer) Logger ¶
func (s *EtcdServer) Logger() *zap.Logger
func (*EtcdServer) MemberID ¶
func (s *EtcdServer) MemberID() types.ID
func (*EtcdServer) MemberId ¶
func (s *EtcdServer) MemberId() types.ID
MemberId returns the ID of the local member. Deprecated: Please use (*EtcdServer) MemberID instead.
func (*EtcdServer) MendPeer ¶
func (s *EtcdServer) MendPeer(id types.ID)
MendPeer recovers the message dropping behavior of the given peer.
func (*EtcdServer) MoveLeader ¶
func (s *EtcdServer) MoveLeader(ctx context.Context, lead, transferee uint64) error
MoveLeader transfers the leader to the given transferee.
func (*EtcdServer) NewUberApplier ¶
func (s *EtcdServer) NewUberApplier() apply.UberApplier
func (*EtcdServer) PauseSending ¶
func (s *EtcdServer) PauseSending()
func (*EtcdServer) Process ¶
Process takes a raft message and applies it to the server's raft state machine, respecting any timeout of the given context.
func (*EtcdServer) PromoteMember ¶
func (s *EtcdServer) PromoteMember(ctx context.Context, id uint64) ([]*membership.Member, error)
PromoteMember promotes a learner node to a voting node.
func (*EtcdServer) Put ¶
func (s *EtcdServer) Put(ctx context.Context, r *pb.PutRequest) (*pb.PutResponse, error)
func (*EtcdServer) RaftHandler ¶
func (s *EtcdServer) RaftHandler() http.Handler
func (*EtcdServer) Range ¶
func (s *EtcdServer) Range(ctx context.Context, r *pb.RangeRequest) (*pb.RangeResponse, error)
func (*EtcdServer) ReadyNotify ¶
func (s *EtcdServer) ReadyNotify() <-chan struct{}
ReadyNotify returns a channel that will be closed when the server is ready to serve client requests
func (*EtcdServer) RemoveMember ¶
func (s *EtcdServer) RemoveMember(ctx context.Context, id uint64) ([]*membership.Member, error)
func (*EtcdServer) ReportSnapshot ¶
func (s *EtcdServer) ReportSnapshot(id uint64, status raft.SnapshotStatus)
ReportSnapshot reports snapshot sent status to the raft state machine, and clears the used snapshot from the snapshot store.
func (*EtcdServer) ReportUnreachable ¶
func (s *EtcdServer) ReportUnreachable(id uint64)
func (*EtcdServer) ResumeSending ¶
func (s *EtcdServer) ResumeSending()
func (*EtcdServer) RoleAdd ¶
func (s *EtcdServer) RoleAdd(ctx context.Context, r *pb.AuthRoleAddRequest) (*pb.AuthRoleAddResponse, error)
func (*EtcdServer) RoleDelete ¶
func (s *EtcdServer) RoleDelete(ctx context.Context, r *pb.AuthRoleDeleteRequest) (*pb.AuthRoleDeleteResponse, error)
func (*EtcdServer) RoleGet ¶
func (s *EtcdServer) RoleGet(ctx context.Context, r *pb.AuthRoleGetRequest) (*pb.AuthRoleGetResponse, error)
func (*EtcdServer) RoleGrantPermission ¶
func (s *EtcdServer) RoleGrantPermission(ctx context.Context, r *pb.AuthRoleGrantPermissionRequest) (*pb.AuthRoleGrantPermissionResponse, error)
func (*EtcdServer) RoleList ¶
func (s *EtcdServer) RoleList(ctx context.Context, r *pb.AuthRoleListRequest) (*pb.AuthRoleListResponse, error)
func (*EtcdServer) RoleRevokePermission ¶
func (s *EtcdServer) RoleRevokePermission(ctx context.Context, r *pb.AuthRoleRevokePermissionRequest) (*pb.AuthRoleRevokePermissionResponse, error)
func (*EtcdServer) Start ¶
func (s *EtcdServer) Start()
Start performs any initialization of the Server necessary for it to begin serving requests. It must be called before Do or Process. Start must be non-blocking; any long-running server functionality should be implemented in goroutines.
func (*EtcdServer) Stop ¶
func (s *EtcdServer) Stop()
Stop stops the server gracefully, and shuts down the running goroutine. Stop should be called after a Start(s), otherwise it will block forever. When stopping leader, Stop transfers its leadership to one of its peers before stopping the server. Stop terminates the Server and performs any necessary finalization. Do and Process cannot be called after Stop has been invoked.
func (*EtcdServer) StopNotify ¶
func (s *EtcdServer) StopNotify() <-chan struct{}
StopNotify returns a channel that receives an empty struct when the server is stopped.
func (*EtcdServer) StoppingNotify ¶
func (s *EtcdServer) StoppingNotify() <-chan struct{}
StoppingNotify returns a channel that receives an empty struct when the server is being stopped.
func (*EtcdServer) StorageVersion ¶
func (s *EtcdServer) StorageVersion() *semver.Version
func (*EtcdServer) Term ¶
func (s *EtcdServer) Term() uint64
func (*EtcdServer) TryTransferLeadershipOnShutdown ¶
func (s *EtcdServer) TryTransferLeadershipOnShutdown() error
TryTransferLeadershipOnShutdown transfers the leader to the chosen transferee. It is only used in server graceful shutdown.
func (*EtcdServer) Txn ¶
func (s *EtcdServer) Txn(ctx context.Context, r *pb.TxnRequest) (*pb.TxnResponse, error)
func (*EtcdServer) UpdateMember ¶
func (s *EtcdServer) UpdateMember(ctx context.Context, memb membership.Member) ([]*membership.Member, error)
func (*EtcdServer) UserAdd ¶
func (s *EtcdServer) UserAdd(ctx context.Context, r *pb.AuthUserAddRequest) (*pb.AuthUserAddResponse, error)
func (*EtcdServer) UserChangePassword ¶
func (s *EtcdServer) UserChangePassword(ctx context.Context, r *pb.AuthUserChangePasswordRequest) (*pb.AuthUserChangePasswordResponse, error)
func (*EtcdServer) UserDelete ¶
func (s *EtcdServer) UserDelete(ctx context.Context, r *pb.AuthUserDeleteRequest) (*pb.AuthUserDeleteResponse, error)
func (*EtcdServer) UserGet ¶
func (s *EtcdServer) UserGet(ctx context.Context, r *pb.AuthUserGetRequest) (*pb.AuthUserGetResponse, error)
func (*EtcdServer) UserGrantRole ¶
func (s *EtcdServer) UserGrantRole(ctx context.Context, r *pb.AuthUserGrantRoleRequest) (*pb.AuthUserGrantRoleResponse, error)
func (*EtcdServer) UserList ¶
func (s *EtcdServer) UserList(ctx context.Context, r *pb.AuthUserListRequest) (*pb.AuthUserListResponse, error)
func (*EtcdServer) UserRevokeRole ¶
func (s *EtcdServer) UserRevokeRole(ctx context.Context, r *pb.AuthUserRevokeRoleRequest) (*pb.AuthUserRevokeRoleResponse, error)
func (*EtcdServer) Version ¶
func (s *EtcdServer) Version() *serverversion.Manager
func (*EtcdServer) Watchable ¶
func (s *EtcdServer) Watchable() mvcc.WatchableKV
Watchable returns a watchable interface attached to the etcdserver.
type Lessor ¶
type Lessor interface { // LeaseGrant sends LeaseGrant request to raft and toApply it after committed. LeaseGrant(ctx context.Context, r *pb.LeaseGrantRequest) (*pb.LeaseGrantResponse, error) // LeaseRevoke sends LeaseRevoke request to raft and toApply it after committed. LeaseRevoke(ctx context.Context, r *pb.LeaseRevokeRequest) (*pb.LeaseRevokeResponse, error) // LeaseRenew renews the lease with given ID. The renewed TTL is returned. Or an error // is returned. LeaseRenew(ctx context.Context, id lease.LeaseID) (int64, error) // LeaseTimeToLive retrieves lease information. LeaseTimeToLive(ctx context.Context, r *pb.LeaseTimeToLiveRequest) (*pb.LeaseTimeToLiveResponse, error) // LeaseLeases lists all leases. LeaseLeases(ctx context.Context, r *pb.LeaseLeasesRequest) (*pb.LeaseLeasesResponse, error) }
type RaftKV ¶
type RaftKV interface { Range(ctx context.Context, r *pb.RangeRequest) (*pb.RangeResponse, error) Put(ctx context.Context, r *pb.PutRequest) (*pb.PutResponse, error) DeleteRange(ctx context.Context, r *pb.DeleteRangeRequest) (*pb.DeleteRangeResponse, error) Txn(ctx context.Context, r *pb.TxnRequest) (*pb.TxnResponse, error) Compact(ctx context.Context, r *pb.CompactionRequest) (*pb.CompactionResponse, error) }
type Server ¶
type Server interface { // AddMember attempts to add a member into the cluster. It will return // ErrIDRemoved if member ID is removed from the cluster, or return // ErrIDExists if member ID exists in the cluster. AddMember(ctx context.Context, memb membership.Member) ([]*membership.Member, error) // RemoveMember attempts to remove a member from the cluster. It will // return ErrIDRemoved if member ID is removed from the cluster, or return // ErrIDNotFound if member ID is not in the cluster. RemoveMember(ctx context.Context, id uint64) ([]*membership.Member, error) // UpdateMember attempts to update an existing member in the cluster. It will // return ErrIDNotFound if the member ID does not exist. UpdateMember(ctx context.Context, updateMemb membership.Member) ([]*membership.Member, error) // PromoteMember attempts to promote a non-voting node to a voting node. It will // return ErrIDNotFound if the member ID does not exist. // return ErrLearnerNotReady if the member are not ready. // return ErrMemberNotLearner if the member is not a learner. PromoteMember(ctx context.Context, id uint64) ([]*membership.Member, error) // ClusterVersion is the cluster-wide minimum major.minor version. // Cluster version is set to the min version that an etcd member is // compatible with when first bootstrap. // // ClusterVersion is nil until the cluster is bootstrapped (has a quorum). // // During a rolling upgrades, the ClusterVersion will be updated // automatically after a sync. (5 second by default) // // The API/raft component can utilize ClusterVersion to determine if // it can accept a client request or a raft RPC. // NOTE: ClusterVersion might be nil when etcd 2.1 works with etcd 2.0 and // the leader is etcd 2.0. etcd 2.0 leader will not update clusterVersion since // this feature is introduced post 2.0. ClusterVersion() *semver.Version // StorageVersion is the storage schema version. It's supported starting // from 3.6. StorageVersion() *semver.Version Cluster() api.Cluster Alarms() []*pb.AlarmMember // LeaderChangedNotify returns a channel for application level code to be notified // when etcd leader changes, this function is intend to be used only in application // which embed etcd. // Caution: // 1. the returned channel is being closed when the leadership changes. // 2. so the new channel needs to be obtained for each raft term. // 3. user can loose some consecutive channel changes using this API. LeaderChangedNotify() <-chan struct{} }
type ServerPeer ¶
type ServerPeerV2 ¶
type ServerPeerV2 interface { ServerPeer HashKVHandler() http.Handler DowngradeEnabledHandler() http.Handler }
type ServerV3 ¶
type ServerV3 interface { Server apply.RaftStatusGetter }
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package api manages the capabilities and features that are exposed to clients by the etcd cluster.
|
Package api manages the capabilities and features that are exposed to clients by the etcd cluster. |
etcdhttp
Package etcdhttp implements HTTP transportation layer for etcdserver.
|
Package etcdhttp implements HTTP transportation layer for etcdserver. |
membership
Package membership describes individual etcd members and clusters of members.
|
Package membership describes individual etcd members and clusters of members. |
rafthttp
Package rafthttp implements HTTP transportation layer for raft pkg.
|
Package rafthttp implements HTTP transportation layer for raft pkg. |
snap
Package snap handles Raft nodes' states with snapshots.
|
Package snap handles Raft nodes' states with snapshots. |
v2discovery
Package v2discovery provides an implementation of the cluster discovery that is used by etcd with v2 client.
|
Package v2discovery provides an implementation of the cluster discovery that is used by etcd with v2 client. |
v2error
Package v2error describes errors in etcd project.
|
Package v2error describes errors in etcd project. |
v2store
Package v2store defines etcd's in-memory key/value store in v2 API.
|
Package v2store defines etcd's in-memory key/value store in v2 API. |
v3alarm
Package v3alarm manages health status alarms in etcd.
|
Package v3alarm manages health status alarms in etcd. |
v3client
Package v3client provides clientv3 interfaces from an etcdserver.
|
Package v3client provides clientv3 interfaces from an etcdserver. |
v3compactor
Package v3compactor implements automated policies for compacting etcd's mvcc storage.
|
Package v3compactor implements automated policies for compacting etcd's mvcc storage. |
v3discovery
Package v3discovery provides an implementation of the cluster discovery that is used by etcd with v3 client.
|
Package v3discovery provides an implementation of the cluster discovery that is used by etcd with v3 client. |
v3election
Package v3election provides a v3 election service from an etcdserver.
|
Package v3election provides a v3 election service from an etcdserver. |
v3election/v3electionpb/gw
Package v3electionpb is a reverse proxy.
|
Package v3electionpb is a reverse proxy. |
v3lock
Package v3lock provides a v3 locking service from an etcdserver.
|
Package v3lock provides a v3 locking service from an etcdserver. |
v3lock/v3lockpb/gw
Package v3lockpb is a reverse proxy.
|
Package v3lockpb is a reverse proxy. |
v3rpc
Package v3rpc implements etcd v3 RPC system based on gRPC.
|
Package v3rpc implements etcd v3 RPC system based on gRPC. |
Package cindex provides an interface and implementation for getting/saving consistentIndex.
|
Package cindex provides an interface and implementation for getting/saving consistentIndex. |
Package version provides functions for getting/saving storage version.
|
Package version provides functions for getting/saving storage version. |