store

package
v0.0.0-...-20fe154 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotLeader is returned when an operation that must be done by
	//   the cluster leader is being tryed on a follower
	ErrNotLeader = errors.New("RAFT: Not leader")
	// ErrRemovingNode is returned when service fails to remove a node from
	//   the cluster
	ErrRemovingNode = errors.New("RAFT: Error removing node")
)

Functions

This section is empty.

Types

type Store

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

Store is the struct that holds the information on the nodes In order to replicate and distribute in a secure way the information

the keys and values are changed via distributed consensus (raft).

func New

New returns the Store

func (*Store) Delete

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

Delete deletes the given key.

func (*Store) Get

func (s *Store) Get(key string) (structs.Session, error)

Get returns the value for the given key.

func (*Store) Join

func (s *Store) Join(nodeID, addr string) error

Join joins a node, identified by nodeID and located at addr, to this store. The node must be ready to respond to Raft communications at that address.

func (*Store) Open

func (s *Store) Open(enableSingle bool, id string, port uint16) error

Open opens the store. If `enableSingle` this server will become leader

since it will hold all the work, but it will be a single point of failure.

Use it only for tests.

func (*Store) Set

func (s *Store) Set(key string, value structs.Session) error

Set sets the value for the given key.

Jump to

Keyboard shortcuts

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