snapshot.go 447 B

1234567891011121314151617181920
  1. package raft
  2. type Snapshot struct {
  3. Data []byte
  4. // the configuration
  5. Nodes []int64
  6. // the index at which the snapshot was taken.
  7. Index int64
  8. // the log term of the index
  9. Term int64
  10. }
  11. // A snapshoter can make a snapshot of its current state atomically.
  12. // It can restore from a snapshot and get the latest snapshot it took.
  13. type Snapshoter interface {
  14. Snap(index, term int64, nodes []int64)
  15. Restore(snap Snapshot)
  16. GetSnap() Snapshot
  17. }