Documentation ¶
Index ¶
- Constants
- Variables
- func AssertNoV2StoreContent(lg *zap.Logger, st v2store.Store, deprecationStage config.V2DeprecationEnum) error
- func CreateConfigChangeEnts(lg *zap.Logger, ids []uint64, self uint64, term, index uint64) []raftpb.Entry
- func GetEffectiveNodeIDsFromWalEntries(lg *zap.Logger, snap *raftpb.Snapshot, ents []raftpb.Entry) []uint64
- func OpenBackend(cfg config.ServerConfig, hooks backend.Hooks) backend.Backend
- func OpenSnapshotBackend(cfg config.ServerConfig, ss *snap.Snapshotter, snapshot raftpb.Snapshot, ...) (backend.Backend, error)
- func RecoverSnapshotBackend(cfg config.ServerConfig, oldbe backend.Backend, snapshot raftpb.Snapshot, ...) (backend.Backend, error)
- type BackendHooks
- type BackendQuota
- type Quota
- type Storage
Constants ¶
const ( // DefaultQuotaBytes is the number of bytes the backend Size may // consume before exceeding the space quota. DefaultQuotaBytes = int64(2 * 1024 * 1024 * 1024) // 2GB // MaxQuotaBytes is the maximum number of bytes suggested for a backend // quota. A larger quota may lead to degraded performance. MaxQuotaBytes = int64(8 * 1024 * 1024 * 1024) // 8GB )
Variables ¶
var (
DefaultQuotaSize = humanize.Bytes(uint64(DefaultQuotaBytes))
)
Functions ¶
func AssertNoV2StoreContent ¶
func AssertNoV2StoreContent(lg *zap.Logger, st v2store.Store, deprecationStage config.V2DeprecationEnum) error
AssertNoV2StoreContent -> depending on the deprecation stage, warns or report an error if the v2store contains custom content.
func CreateConfigChangeEnts ¶
func CreateConfigChangeEnts(lg *zap.Logger, ids []uint64, self uint64, term, index uint64) []raftpb.Entry
CreateConfigChangeEnts creates a series of Raft entries (i.e. EntryConfChange) to remove the set of given IDs from the cluster. The ID `self` is _not_ removed, even if present in the set. If `self` is not inside the given ids, it creates a Raft entry to add a default member with the given `self`.
func GetEffectiveNodeIDsFromWalEntries ¶
func GetEffectiveNodeIDsFromWalEntries(lg *zap.Logger, snap *raftpb.Snapshot, ents []raftpb.Entry) []uint64
GetEffectiveNodeIDsFromWalEntries returns an ordered set of IDs included in the given snapshot and the entries. The given snapshot/entries can contain three kinds of ID-related entry: - ConfChangeAddNode, in which case the contained ID will Be added into the set. - ConfChangeRemoveNode, in which case the contained ID will Be removed from the set. - ConfChangeAddLearnerNode, in which the contained ID will Be added into the set.
func OpenBackend ¶
OpenBackend returns a backend using the current etcd db.
func OpenSnapshotBackend ¶
func OpenSnapshotBackend(cfg config.ServerConfig, ss *snap.Snapshotter, snapshot raftpb.Snapshot, hooks *BackendHooks) (backend.Backend, error)
OpenSnapshotBackend renames a snapshot db to the current etcd db and opens it.
func RecoverSnapshotBackend ¶
func RecoverSnapshotBackend(cfg config.ServerConfig, oldbe backend.Backend, snapshot raftpb.Snapshot, beExist bool, hooks *BackendHooks) (backend.Backend, error)
RecoverSnapshotBackend recovers the DB from a snapshot in case etcd crashes before updating the backend db after persisting raft snapshot to disk, violating the invariant snapshot.Metadata.Index < db.consistentIndex. In this case, replace the db with the snapshot db sent by the leader.
Types ¶
type BackendHooks ¶
type BackendHooks struct {
// contains filtered or unexported fields
}
func NewBackendHooks ¶
func NewBackendHooks(lg *zap.Logger, indexer cindex.ConsistentIndexer) *BackendHooks
func (*BackendHooks) OnPreCommitUnsafe ¶
func (bh *BackendHooks) OnPreCommitUnsafe(tx backend.BatchTx)
func (*BackendHooks) SetConfState ¶
func (bh *BackendHooks) SetConfState(confState *raftpb.ConfState)
type BackendQuota ¶
type BackendQuota struct {
// contains filtered or unexported fields
}
func (*BackendQuota) Available ¶
func (b *BackendQuota) Available(v interface{}) bool
func (*BackendQuota) Cost ¶
func (b *BackendQuota) Cost(v interface{}) int
func (*BackendQuota) Remaining ¶
func (b *BackendQuota) Remaining() int64
type Quota ¶
type Quota interface { // Available judges whether the given request fits within the quota. Available(req interface{}) bool // Cost computes the charge against the quota for a given request. Cost(req interface{}) int // Remaining is the amount of charge left for the quota. Remaining() int64 }
Quota represents an arbitrary quota against arbitrary requests. Each request costs some charge; if there is not enough remaining charge, then there are too few resources available within the quota to apply the request.
type Storage ¶
type Storage interface { // Save function saves ents and state to the underlying stable storage. // Save MUST block until st and ents are on stable storage. Save(st raftpb.HardState, ents []raftpb.Entry) error // SaveSnap function saves snapshot to the underlying stable storage. SaveSnap(snap raftpb.Snapshot) error // Close closes the Storage and performs finalization. Close() error // Release releases the locked wal files older than the provided snapshot. Release(snap raftpb.Snapshot) error // Sync WAL Sync() error // MinimalEtcdVersion returns minimal etcd storage able to interpret WAL log. MinimalEtcdVersion() *semver.Version }
func NewStorage ¶
Directories ¶
Path | Synopsis |
---|---|
Package backend defines a standard interface for etcd's backend MVCC storage.
|
Package backend defines a standard interface for etcd's backend MVCC storage. |
Package mvcc defines etcd's stable MVCC storage.
|
Package mvcc defines etcd's stable MVCC storage. |
Package wal provides an implementation of write ahead log that is used by etcd.
|
Package wal provides an implementation of write ahead log that is used by etcd. |