raft

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2017 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package store provides a simple distributed key-value store. The keys and associated values are changed via distributed consensus, meaning that the values are changed only when a majority of nodes in the cluster agree on the new value.

Distributed consensus is provided via the Raft algorithm.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NullWriter

type NullWriter int

func (NullWriter) Write

func (NullWriter) Write([]byte) (int, error)

type RaftModule

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

func New

func New() *RaftModule

func (*RaftModule) Delete

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

Delete deletes the given key.

func (*RaftModule) Get

func (s *RaftModule) Get(key string) (string, error)

Get returns the value for the given key.

func (*RaftModule) Join

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

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

func (*RaftModule) Open

func (s *RaftModule) Open() error

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

func (*RaftModule) Set

func (s *RaftModule) Set(key, value string) 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