snapshot

package
v3.10.2 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2022 License: Apache-2.0 Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileRestore

type FileRestore struct {
	Options RestoreOptions
	// contains filtered or unexported fields
}

FileRestore reads records from a file

func (*FileRestore) Init

func (f *FileRestore) Init(opts ...RestoreOption) error

Init proc

func (*FileRestore) Start

func (f *FileRestore) Start() (<-chan *store.Record, error)

Start starts reading records from a file. The returned channel is closed when complete

type FileSnapshot

type FileSnapshot struct {
	Options Options
	// contains filtered or unexported fields
}

FileSnapshot backs up incoming records to a File

func (*FileSnapshot) Init

func (f *FileSnapshot) Init(opts ...Option) error

Init validates the options

func (*FileSnapshot) Start

func (f *FileSnapshot) Start() (chan<- *store.Record, error)

Start opens a channel which receive *store.Record and writes them to storage

func (*FileSnapshot) Wait

func (f *FileSnapshot) Wait()

Wait waits for the snapshotter to commit the backups to persistent storage

type Option

type Option func(s *Options)

Option is an individual option

func Destination

func Destination(dest string) Option

Destination is the URL to snapshot to, e.g. file:///path/to/file

type Options

type Options struct {
	Destination string
}

Options configure a snapshotter

type Restore

type Restore interface {
	// Init validates the RestoreOptions and returns an error if they are invalid.
	// Init must be called before a Restore is used
	Init(opts ...RestoreOption) error
	// Start opens a channel over which records from the snapshot are retrieved.
	// The channel will be closed when the entire snapshot has been read.
	Start() (<-chan *store.Record, error)
}

Restore emits records from a go-micro store snapshot

func NewFileRestore

func NewFileRestore(opts ...RestoreOption) Restore

NewFileRestore for restore by file

type RestoreOption

type RestoreOption func(r *RestoreOptions)

RestoreOption is an individual option

func Source

func Source(source string) RestoreOption

Source is the source URL of a snapshot, e.g. file:///path/to/file

type RestoreOptions

type RestoreOptions struct {
	Source string
}

RestoreOptions configure a Restore

type Snapshot

type Snapshot interface {
	// Init validates the Snapshot options and returns an error if they are invalid.
	// Init must be called before the Snapshot is used
	Init(opts ...Option) error
	// Start opens a channel that receives *store.Record, adding any incoming records to a backup
	// close() the channel to commit the results.
	Start() (chan<- *store.Record, error)
	// Wait waits for any operations to be committed to underlying storage
	Wait()
}

Snapshot creates snapshots of a go-micro store

func NewFileSnapshot

func NewFileSnapshot(opts ...Option) Snapshot

NewFileSnapshot returns a FileSnapshot

Jump to

Keyboard shortcuts

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