base

package
v0.0.0-...-8f072b4 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2021 License: BSD-3-Clause Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STORE_GET         = "get"
	STORE_PUT         = "put"
	STORE_ADD         = "add"
	STORE_DELETE      = "delete"
	STORE_FLUSH       = "flush"
	STORE_NODE_SIZE   = "nodeSize"
	STORE_APP_METRICS = "getAppMetrics"
)

LRU store commands

View Source
const (
	LRU_TYPE  = "LRU"  // Least recently used
	LFU_TYPE  = "LFU"  // Least frequenty used
	MRU_TYPE  = "MRU"  // Most recently used
	ARC_TYPE  = "ARC"  // Adaptive Replacement Cache
	TLRU_TYPE = "TLRU" // Time-aware Least Recently Used
)

Policy types

Variables

This section is empty.

Functions

func GetNumericalID

func GetNumericalID(ID string, peers []string) int

GetNumericalID is used to get the numerical ID of a node from the list of peers parameters: ID (a string identifier of the node), peers (an array of current nodes in the cluster) returns: int (the numeric value of a node's indentifier), otherwise -1

func PeersList

func PeersList(rawConfig string) []string

func TestAppMetrics

func TestAppMetrics(t *testing.T)

func TestSerializer

func TestSerializer(t *testing.T)

Types

type BaseStore

type BaseStore interface {

	// Build store from a simple store
	BuildStore(config.Configuration)
	// Build store from snapshot
	BuildStoreFromSnapshot()
	// Execute a given command
	Execute(cmd string, args interface{}) interface{}
	// Create snapshot of stores cache
	CreateSnapshot()
	// RunStore starts the store schedulers
	RunStore()
	// 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.
	Join(nodeID string, addr string) 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.
	// localID should be the server identifier for this node.
	Open(enableSingle bool, localID string) error
	// contains filtered or unexported methods
}

type Command

type Command struct {
	Cmd  string
	Args request.CacheRequest
}

Command is the struct used by the replication log. All write commands can be written to the replciation log in this format

type Store

type Store struct {
	RaftDir     string
	RaftBind    string
	Raft        *raft.Raft
	ServerID    string
	NumericalID int
	PeersLength int

	Conf config.Configuration

	Cache cache.Cache
	// contains filtered or unexported fields
}

func NewStore

func NewStore(policy string) *Store

func (*Store) BuildStore

func (store *Store) BuildStore(conf config.Configuration)

func (*Store) BuildStoreFromAof

func (store *Store) BuildStoreFromAof()

func (*Store) BuildStoreFromSnapshot

func (store *Store) BuildStoreFromSnapshot(bs *[]byte)

func (*Store) CreateSnapshot

func (store *Store) CreateSnapshot()

func (*Store) Execute

func (store *Store) Execute(cmd string, args request.CacheRequest) response.CacheResponse

func (*Store) Join

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

func (*Store) Open

func (store *Store) Open(enableSingle bool, localID string) error

func (*Store) RunStore

func (store *Store) RunStore()

func (*Store) StopStore

func (store *Store) StopStore()

Jump to

Keyboard shortcuts

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