store

package
v0.0.0-...-9a0a952 Latest Latest
Warning

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

Go to latest
Published: May 3, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	InMemory      bool
	RaftDirectory string
	RaftAddress   string
	RaftPort      string

	RetainSnapshotCount int
	RaftTimeout         time.Duration
	// contains filtered or unexported fields
}

func New

func New() *Store

New creates and returns a new Store instance by reference

func (*Store) Apply

func (self *Store) Apply(raftLog *raft.Log) interface{}

Apply function to apply a Raft log entry to the key-value store.

func (*Store) Delete

func (self *Store) Delete(key string) error

Delete: Remove a provided key:value pair

func (*Store) Get

func (self *Store) Get(key string) string

Get: Retrieve value at specified key

func (*Store) Restore

func (self *Store) Restore(rc io.ReadCloser) error

Restore Recovers a previous state of the key-value store from snapshot.

func (*Store) Set

func (self *Store) Set(key, value string) error

Set: Establish a provided value for specified key

func (*Store) Snapshot

func (self *Store) Snapshot() (raft.FSMSnapshot, error)

Snapshot returns a snapshot of the key-value store.

func (*Store) StartRaft

func (self *Store) StartRaft(localID string, singleNode, inMemory bool) error

Store.StartRaft configures a raft server localID Server identifier for this node singleNode Enables single node mode at launch, therefore node becomes leader automatically inMemory Whether Raft algorithm stored in memory-only, without filesystem database storage

Jump to

Keyboard shortcuts

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