Documentation ¶
Index ¶
- Variables
- func Read(lg *zap.Logger, snapname string) (*snappb.ShotData, error)
- type SnapshotAPI
- type Snapshotter
- func (s *Snapshotter) DBFilePath(id uint64) (string, error)
- func (s *Snapshotter) Load() (*snappb.ShotData, error)
- func (s *Snapshotter) LoadNewestAvailable(walSnaps []log.Snapshot) (*snappb.ShotData, error)
- func (s *Snapshotter) ReleaseSnapDBs(snap snappb.ShotData) error
- func (s *Snapshotter) SaveDBFrom(r io.Reader, id uint64) (int64, error)
- func (s *Snapshotter) SaveSnapData(snapshot snappb.ShotData) error
- func (s *Snapshotter) SnapNames() ([]string, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoSnapshot = errors.New("snap: no available snapshot") ErrEmptySnapshot = errors.New("snap: empty snapshot") ErrCRCMismatch = errors.New("snap: crc mismatch") )
View Source
var ErrNoDBSnapshot = errors.New("snap: snapshot file doesn't exist")
Functions ¶
Types ¶
type SnapshotAPI ¶
type SnapshotAPI interface { // Load returns the newest snapshot. Load() (*snappb.ShotData, error) // LoadNewestAvailable loads the newest snapshot available that is in walSnaps. LoadNewestAvailable(walSnaps []log.Snapshot) (*snappb.ShotData, error) SaveSnapData(snapshot snappb.ShotData) error ReleaseSnapDBs(snap snappb.ShotData) error // SnapNames returns the filename of the snapshots in logical time order (from newest to oldest). // If there is no available snapshots, an ErrNoSnapshot will be returned. SnapNames() ([]string, error) }
type Snapshotter ¶
type Snapshotter struct {
// contains filtered or unexported fields
}
func (*Snapshotter) DBFilePath ¶
func (s *Snapshotter) DBFilePath(id uint64) (string, error)
DBFilePath returns the file path for the snapshot of the database with given id. If the snapshot does not exist, it returns error.
func (*Snapshotter) Load ¶
func (s *Snapshotter) Load() (*snappb.ShotData, error)
Load returns the newest snapshot.
func (*Snapshotter) LoadNewestAvailable ¶
LoadNewestAvailable loads the newest snapshot available that is in walSnaps.
func (*Snapshotter) ReleaseSnapDBs ¶
func (s *Snapshotter) ReleaseSnapDBs(snap snappb.ShotData) error
func (*Snapshotter) SaveDBFrom ¶
SaveDBFrom saves snapshot of the database from the given reader. It guarantees the save operation is atomic.
func (*Snapshotter) SaveSnapData ¶
func (s *Snapshotter) SaveSnapData(snapshot snappb.ShotData) error
func (*Snapshotter) SnapNames ¶
func (s *Snapshotter) SnapNames() ([]string, error)
SnapNames returns the filename of the snapshots in logical time order (from newest to oldest). If there is no available snapshots, an ErrNoSnapshot will be returned.
Click to show internal directories.
Click to hide internal directories.