store

package
v0.0.0-...-53d447e Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2017 License: Apache-2.0 Imports: 11 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 {
	RaftBindAddr    string
	RaftDir         string
	PublishCallback func(source, key string, value []byte)
	// contains filtered or unexported fields
}

Store is a collection of key-value stores, where all changes are made via Raft consensus

func NewStore

func NewStore(raftBindAddr, raftDir string, logger fglog.Logger) *Store

NewStore initializes a new store with the provided properties

func (*Store) DeleteKey

func (s *Store) DeleteKey(source string, key string) error

DeleteKey deletes the key and value for the given source in storage

func (*Store) DeleteSource

func (s *Store) DeleteSource(source string) error

DeleteSource deletes the given source in storage

func (*Store) Get

func (s *Store) Get(source string, key string) []byte

Get the value for the given source and key in storage

func (*Store) GetKeys

func (s *Store) GetKeys(source string) ([]string, error)

GetKeys returns a list of keys for the given source found in storage

func (*Store) GetSources

func (s *Store) GetSources() ([]string, error)

GetSources returns a list of sources found in storage

func (*Store) IsLeader

func (s *Store) IsLeader() bool

IsLeader indicates whether this store is currently the leader of the cluster

func (*Store) Join

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

Join the node located at addr to this store. The node must be ready to respond to raft communications

func (*Store) Leader

func (s *Store) Leader() string

Leader returns the address of the cluster leader, or an empty string if unknown

func (*Store) Open

func (s *Store) Open(startAsLeader bool) error

Open the store. If startAsLeader is set, and there are no existing peers, this first node becomes the leader of the cluster

func (*Store) Set

func (s *Store) Set(source string, key string, value []byte) error

Set the value for the given source and key in storage

Jump to

Keyboard shortcuts

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