snapshots

package
v0.0.67 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2024 License: Apache-2.0, MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Arrow

type Arrow struct {
	File *os.File
	Tree Persist
	Mem  memory.Allocator
}

func (*Arrow) Backup

func (a *Arrow) Backup(sink io.Writer) (err error)

func (*Arrow) Persist

func (a *Arrow) Persist(sink raft.SnapshotSink) (err error)

func (*Arrow) Release

func (a *Arrow) Release()

type ArrowRestore

type ArrowRestore struct {
	Mem  memory.Allocator
	File *os.File
}

func (*ArrowRestore) Record

func (a *ArrowRestore) Record(f func(arrow.Record) error) error

type FileSnapshotSink

type FileSnapshotSink struct {
	// contains filtered or unexported fields
}

FileSnapshotSink implements SnapshotSink with a file.

func (*FileSnapshotSink) Cancel

func (s *FileSnapshotSink) Cancel() error

Cancel is used to indicate an unsuccessful end.

func (*FileSnapshotSink) Close

func (s *FileSnapshotSink) Close() error

Close is used to indicate a successful end.

func (*FileSnapshotSink) ID

func (s *FileSnapshotSink) ID() string

ID returns the ID of the snapshot, can be used with Open() after the snapshot is finalized.

func (*FileSnapshotSink) Write

func (s *FileSnapshotSink) Write(b []byte) (int, error)

Write is used to append to the state file. We write to the buffered IO object to reduce the amount of context switches.

type Persist

type Persist interface {
	Persist(f lsm.CompactCallback)
}

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store implements the SnapshotStore interface and allows snapshots to be made on the local disk.

func New

func New(base string, retain int) (*Store, error)

New creates a new FileSnapshotStore based on a base directory. The `retain` parameter controls how many snapshots are retained. Must be at least 1.

func (*Store) Create

func (f *Store) Create(version raft.SnapshotVersion, index, term uint64,
	configuration raft.Configuration, configurationIndex uint64, trans raft.Transport) (raft.SnapshotSink, error)

Create is used to start a new snapshot

func (*Store) List

func (f *Store) List() ([]*raft.SnapshotMeta, error)

List returns available snapshots in the store.

func (*Store) Open

func (f *Store) Open(id string) (*raft.SnapshotMeta, io.ReadCloser, error)

Open takes a snapshot ID and returns a ReadCloser for that snapshot.

func (*Store) ReapSnapshots

func (f *Store) ReapSnapshots() error

ReapSnapshots reaps any snapshots beyond the retain count.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL