Documentation ¶
Index ¶
- Variables
- func GetSnapshotDirName(index uint64, extra uint64) string
- type Mode
- type SSEnv
- func (se *SSEnv) CreateTempDir() error
- func (se *SSEnv) FinalDirExists() bool
- func (se *SSEnv) FinalizeIndex(index uint64)
- func (se *SSEnv) FinalizeSnapshot() error
- func (se *SSEnv) GetFinalDir() string
- func (se *SSEnv) GetRootDir() string
- func (se *SSEnv) GetTempDir() string
- func (se *SSEnv) MustRemoveTempDir()
- func (se *SSEnv) RemoveFinalDir() error
- func (se *SSEnv) RemoveTempDir() error
- type SnapshotDirFunc
Constants ¶
This section is empty.
Variables ¶
var ( // ErrSnapshotOutOfDate is the error to indicate that snapshot is out of date. ErrSnapshotOutOfDate = errors.New("snapshot out of date") // SnapshotDirNameRe is the regex of snapshot names. SnapshotDirNameRe = regexp.MustCompile(`^snapshot-[0-9A-F]+-[0-9A-F]+$`) // SnapshotDirNamePartsRe is used to find the index value from snapshot folder name. SnapshotDirNamePartsRe = regexp.MustCompile(`^snapshot-([0-9A-F]+)-[0-9A-F]+$`) // GenSnapshotDirNameRe is the regex of temp snapshot directory name used when // generating snapshots. GenSnapshotDirNameRe = regexp.MustCompile(`^snapshot-[0-9A-F]+-[0-9A-F]+\.generating$`) // RecvSnapshotDirNameRe is the regex of temp snapshot directory name used when // receiving snapshots from remote NodeHosts. RecvSnapshotDirNameRe = regexp.MustCompile(`^snapshot-[0-9A-F]+-[0-9A-F]+\.receiving$`) )
Functions ¶
func GetSnapshotDirName ¶ added in v0.2.0
GetSnapshotDirName returns the snapshot dir name for the snapshot captured at the specified index.
Types ¶
type SSEnv ¶ added in v0.2.0
type SSEnv struct {
// contains filtered or unexported fields
}
SSEnv is the struct used to manage involved directories for taking or receiving snapshots.
func NewSSEnv ¶ added in v0.2.0
func NewSSEnv(f SnapshotDirFunc, shardID uint64, replicaID uint64, index uint64, extra uint64, mode Mode, fs vfs.FS) SSEnv
NewSSEnv creates and returns a new SSEnv instance. extra is the replicaID of the sending replica in ReceivingMode or a random uint64 in CreatingMode. It is caller's responsibility to ensure the randomness of the extra value in CreatingMode.
func (*SSEnv) CreateTempDir ¶ added in v0.2.0
CreateTempDir creates the temp snapshot directory.
func (*SSEnv) FinalDirExists ¶ added in v0.2.0
func (*SSEnv) FinalizeIndex ¶ added in v0.2.0
func (*SSEnv) FinalizeSnapshot ¶ added in v0.2.0
FinalizeSnapshot finalizes the snapshot.
func (*SSEnv) GetFinalDir ¶ added in v0.2.0
GetFinalDir returns the final snapshot directory.
func (*SSEnv) GetRootDir ¶ added in v0.2.0
GetRootDir returns the root directory. The temp and final snapshot directories are children of the root directory.
func (*SSEnv) GetTempDir ¶ added in v0.2.0
GetTempDir returns the temp snapshot directory.
func (*SSEnv) MustRemoveTempDir ¶ added in v0.2.0
func (se *SSEnv) MustRemoveTempDir()
MustRemoveTempDir removes the temp snapshot directory and panic if there is any error.
func (*SSEnv) RemoveFinalDir ¶ added in v0.2.0
RemoveFinalDir removes the final snapshot directory.
func (*SSEnv) RemoveTempDir ¶ added in v0.2.0
RemoveTempDir removes the temp snapshot directory.
type SnapshotDirFunc ¶ added in v0.2.0
SnapshotDirFunc is the function type that returns the snapshot dir for the specified replica.