Documentation
¶
Index ¶
- Constants
- func GetNumericalID(ID string, peers []string) int
- func PeersList(rawConfig string) []string
- func TestAppMetrics(t *testing.T)
- func TestSerializer(t *testing.T)
- type BaseStore
- type Command
- type HandlerType
- type Store
- func (store *Store) BuildStore(conf config.Configuration)
- func (store *Store) BuildStoreFromAof()
- func (store *Store) BuildStoreFromSnapshot(bs *[]byte)
- func (store *Store) CreateSnapshot()
- func (store *Store) Execute(cmd string, args request.CacheRequest) response.CacheResponse
- func (store *Store) Join(nodeID string, addr string) error
- func (store *Store) Open(enableSingle bool, localID string) error
- func (store *Store) RunStore()
- func (store *Store) StopStore()
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 ¶
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 TestAppMetrics ¶
func TestSerializer ¶
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 HandlerType ¶
type HandlerType func(request.CacheRequest) response.CacheResponse
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 (*Store) BuildStore ¶
func (store *Store) BuildStore(conf config.Configuration)
func (*Store) BuildStoreFromAof ¶
func (store *Store) BuildStoreFromAof()
func (*Store) BuildStoreFromSnapshot ¶
func (*Store) CreateSnapshot ¶
func (store *Store) CreateSnapshot()
func (*Store) Execute ¶
func (store *Store) Execute(cmd string, args request.CacheRequest) response.CacheResponse
Click to show internal directories.
Click to hide internal directories.