Documentation ¶
Index ¶
- type ApplyOptions
- type ApplySnapAbortError
- type CFFile
- type MetaFile
- type Snap
- func NewSnap(dir string, key SnapKey, sizeTrack *int64, isSending, toBuild bool, ...) (*Snap, error)
- func NewSnapForApplying(dir string, key SnapKey, sizeTrack *int64, deleter SnapshotDeleter) (*Snap, error)
- func NewSnapForBuilding(dir string, key SnapKey, sizeTrack *int64, deleter SnapshotDeleter) (*Snap, error)
- func NewSnapForReceiving(dir string, key SnapKey, snapshotMeta *rspb.SnapshotMeta, sizeTrack *int64, ...) (*Snap, error)
- func NewSnapForSending(dir string, key SnapKey, sizeTrack *int64, deleter SnapshotDeleter) (*Snap, error)
- func (s *Snap) Apply(opts ApplyOptions) error
- func (s *Snap) Build(dbSnap *badger.Txn, region *metapb.Region, snapData *rspb.RaftSnapshotData, ...) error
- func (s *Snap) Delete()
- func (s *Snap) Drop()
- func (s *Snap) Exists() bool
- func (s *Snap) Meta() (os.FileInfo, error)
- func (s *Snap) Path() string
- func (s *Snap) Read(b []byte) (int, error)
- func (s *Snap) Save() error
- func (s *Snap) TotalSize() (total uint64)
- func (s *Snap) Write(b []byte) (int, error)
- type SnapEntry
- type SnapKey
- type SnapKeyWithSending
- type SnapManager
- func (sm *SnapManager) DeleteSnapshot(key SnapKey, snapshot Snapshot, checkEntry bool) bool
- func (sm *SnapManager) Deregister(key SnapKey, entry SnapEntry)
- func (sm *SnapManager) GetSnapshotForApplying(snapKey SnapKey) (Snapshot, error)
- func (sm *SnapManager) GetSnapshotForBuilding(key SnapKey) (Snapshot, error)
- func (sm *SnapManager) GetSnapshotForReceiving(snapKey SnapKey, data []byte) (Snapshot, error)
- func (sm *SnapManager) GetSnapshotForSending(snapKey SnapKey) (Snapshot, error)
- func (sm *SnapManager) GetTotalSnapSize() uint64
- func (sm *SnapManager) HasRegistered(key SnapKey) bool
- func (sm *SnapManager) Init() error
- func (sm *SnapManager) ListIdleSnap() ([]SnapKeyWithSending, error)
- func (sm *SnapManager) Register(key SnapKey, entry SnapEntry)
- func (sm *SnapManager) Stats() SnapStats
- type SnapManagerBuilder
- type SnapState
- type SnapStateType
- type SnapStatistics
- type SnapStats
- type Snapshot
- type SnapshotDeleter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApplyOptions ¶
func NewApplyOptions ¶
func NewApplyOptions(db *badger.DB, region *metapb.Region) *ApplyOptions
type ApplySnapAbortError ¶
type ApplySnapAbortError string
func (ApplySnapAbortError) Error ¶
func (e ApplySnapAbortError) Error() string
type Snap ¶
type Snap struct { CFFiles []*CFFile MetaFile *MetaFile SizeTrack *int64 // contains filtered or unexported fields }
func NewSnapForApplying ¶
func NewSnapForBuilding ¶
func NewSnapForReceiving ¶
func NewSnapForReceiving(dir string, key SnapKey, snapshotMeta *rspb.SnapshotMeta, sizeTrack *int64, deleter SnapshotDeleter) (*Snap, error)
func NewSnapForSending ¶
func (*Snap) Apply ¶
func (s *Snap) Apply(opts ApplyOptions) error
func (*Snap) Build ¶
func (s *Snap) Build(dbSnap *badger.Txn, region *metapb.Region, snapData *rspb.RaftSnapshotData, stat *SnapStatistics, deleter SnapshotDeleter) error
type SnapKey ¶
func SnapKeyFromRegionSnap ¶
type SnapKeyWithSending ¶
type SnapManager ¶
type SnapManager struct { MaxTotalSize uint64 // contains filtered or unexported fields }
func NewSnapManager ¶
func NewSnapManager(path string) *SnapManager
func (*SnapManager) DeleteSnapshot ¶
func (sm *SnapManager) DeleteSnapshot(key SnapKey, snapshot Snapshot, checkEntry bool) bool
func (*SnapManager) Deregister ¶
func (sm *SnapManager) Deregister(key SnapKey, entry SnapEntry)
func (*SnapManager) GetSnapshotForApplying ¶
func (sm *SnapManager) GetSnapshotForApplying(snapKey SnapKey) (Snapshot, error)
func (*SnapManager) GetSnapshotForBuilding ¶
func (sm *SnapManager) GetSnapshotForBuilding(key SnapKey) (Snapshot, error)
func (*SnapManager) GetSnapshotForReceiving ¶
func (sm *SnapManager) GetSnapshotForReceiving(snapKey SnapKey, data []byte) (Snapshot, error)
func (*SnapManager) GetSnapshotForSending ¶
func (sm *SnapManager) GetSnapshotForSending(snapKey SnapKey) (Snapshot, error)
func (*SnapManager) GetTotalSnapSize ¶
func (sm *SnapManager) GetTotalSnapSize() uint64
func (*SnapManager) HasRegistered ¶
func (sm *SnapManager) HasRegistered(key SnapKey) bool
func (*SnapManager) Init ¶
func (sm *SnapManager) Init() error
func (*SnapManager) ListIdleSnap ¶
func (sm *SnapManager) ListIdleSnap() ([]SnapKeyWithSending, error)
func (*SnapManager) Register ¶
func (sm *SnapManager) Register(key SnapKey, entry SnapEntry)
func (*SnapManager) Stats ¶
func (sm *SnapManager) Stats() SnapStats
type SnapManagerBuilder ¶
type SnapManagerBuilder struct {
// contains filtered or unexported fields
}
func (*SnapManagerBuilder) Build ¶
func (smb *SnapManagerBuilder) Build(path string) *SnapManager
func (*SnapManagerBuilder) MaxTotalSize ¶
func (smb *SnapManagerBuilder) MaxTotalSize(v uint64) *SnapManagerBuilder
type SnapState ¶
type SnapState struct { StateType SnapStateType Receiver chan *eraftpb.Snapshot }
type SnapStateType ¶
type SnapStateType int
const ( SnapState_Relax SnapStateType = 0 + iota SnapState_Generating SnapState_Applying )
type SnapStatistics ¶
type Snapshot ¶
type Snapshot interface { io.Reader io.Writer Build(dbSnap *badger.Txn, region *metapb.Region, snapData *rspb.RaftSnapshotData, stat *SnapStatistics, deleter SnapshotDeleter) error Path() string Exists() bool Delete() Meta() (os.FileInfo, error) TotalSize() uint64 Save() error Apply(option ApplyOptions) error }
`Snapshot` is an interface for snapshot. It's used in these scenarios:
- build local snapshot
- read local snapshot and then replicate it to remote raftstores
- receive snapshot from remote raftstore and write it to local storage
- apply snapshot
- snapshot gc
type SnapshotDeleter ¶
type SnapshotDeleter interface { // DeleteSnapshot returns true if it successfully delete the specified snapshot. DeleteSnapshot(key SnapKey, snapshot Snapshot, checkEntry bool) bool }
`SnapshotDeleter` is a trait for deleting snapshot. It's used to ensure that the snapshot deletion happens under the protection of locking to avoid race case for concurrent read/write.
Click to show internal directories.
Click to hide internal directories.