node

package
v0.0.0-...-73ed01f Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2021 License: MIT Imports: 9 Imported by: 0

README

node

The node package implements some main functions the replica has to perform to get started and respond to requests.

It then uses these structs to initialise a new raft node.

  • The Get, Set and Delete functions are called by the leader in the cluster on corresponding request from the admin
  • The Join and Leave functions implements the logic for new replicas joining and leaving the replica.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RavelNode

type RavelNode struct {
	Fsm  *fsm.RavelFSM
	Raft *raft.Raft
}

RavelNode represents a node inside the cluster.

func (*RavelNode) Delete

func (n *RavelNode) Delete(key []byte) error

Delete deletes the entry with given key

func (*RavelNode) Get

func (n *RavelNode) Get(key []byte) ([]byte, error)

Get returns the value for the given key

func (*RavelNode) GetAndDelete

func (n *RavelNode) GetAndDelete(key []byte) ([]byte, error)

GetAndDelete returns the value for the given key

func (*RavelNode) Join

func (n *RavelNode) Join(nodeID, raftAddr string) error

Join will join the node available on raftAddr with ID nodeID to this node if its a leader

func (*RavelNode) Leave

func (n *RavelNode) Leave(nodeID string) error

Leave removes the node with nodeID from this leader

func (*RavelNode) Open

func (n *RavelNode) Open(enableSingle bool, localID string, badgerPath string, BindAddr string) (*raft.Raft, *fsm.RavelFSM, error)

Open creates initialises a raft.Raft instance

func (*RavelNode) Set

func (n *RavelNode) Set(key []byte, value []byte) error

Set sets the key with the value

Jump to

Keyboard shortcuts

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