store

package
v0.0.0-...-e92273e Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNode

func NewNode() *proto.Node

Types

type Handle

type Handle interface {
	HandleTopic
	HandleKeyStore
}

type HandleKeyStore

type HandleKeyStore interface {
	HandlePutKeyRequest(req *proto.PutKeyRequest) (response []byte, err error)
	HandleDeleteKeyRequest(req *proto.DeleteKeyRequest) (response []byte, err error)
	HandlePutKeysRequest(req *proto.PutKeysRequest) (response []byte, err error)
}

type HandleTopic

type HandleTopic interface {
	HandleSubRequest(req *proto.SubRequest) (response []byte, err error)
	HandleUnSubRequest(req *proto.UnSubRequest) (response []byte, err error)
}

type Node

type Node struct {
	*proto.Node
}

Node represents a node in the prefix tree.go. It contains a key-value pair and a map of child nodes. The key-value pair is stored in the leaf node. The map of child nodes is stored in the non-leaf node.

func (*Node) DeleteKey

func (t *Node) DeleteKey(key string) error

DeleteKey deletes a key-value pair from the prefix tree.go.

func (*Node) PrefixSearch

func (t *Node) PrefixSearch(prefix string) (map[string]string, error)

PrefixSearch searches for all key-value pairs with keys that have the given prefix.

func (*Node) PutKey

func (t *Node) PutKey(key, value string) error

PutKey inserts a key-value pair into the prefix tree.go.

func (*Node) ReadKey

func (t *Node) ReadKey(key string) (string, bool, error)

ReadKey retrieves the value associated with the given key from the prefix tree.go.

func (*Node) ReadWildcardKey

func (t *Node) ReadWildcardKey(wildcardKey string) (map[string]string, error)

type State

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

func NewState

func NewState() *State

func (*State) Close

func (t *State) Close() error

func (*State) HandleDeleteKeyRequest

func (t *State) HandleDeleteKeyRequest(req *proto.DeleteKeyRequest) (response []byte, err error)

func (*State) HandlePutKeyRequest

func (t *State) HandlePutKeyRequest(req *proto.PutKeyRequest) (response []byte, err error)

func (*State) HandlePutKeysRequest

func (t *State) HandlePutKeysRequest(req *proto.PutKeysRequest) (response []byte, err error)

func (*State) HandleSubRequest

func (t *State) HandleSubRequest(req *proto.SubRequest) (response []byte, err error)

func (*State) HandleUnSubRequest

func (t *State) HandleUnSubRequest(req *proto.UnSubRequest) (response []byte, err error)

func (*State) Lookup

func (t *State) Lookup(i interface{}) (interface{}, error)

func (*State) MatchSubTopics

func (t *State) MatchSubTopics(req *api.MatchSubTopicRequest) *api.MatchSubTopicResponse

func (*State) MatchTopic

func (t *State) MatchTopic(req *api.MatchTopicRequest) *api.MatchTopicResponse

func (*State) ReadKey

func (t *State) ReadKey(key string) (string, bool, error)

func (*State) ReadWithPrefix

func (t *State) ReadWithPrefix(prefix string) (map[string]string, error)

func (*State) RecoverFromSnapshot

func (t *State) RecoverFromSnapshot(reader io.Reader, files []statemachine.SnapshotFile, i <-chan struct{}) error

func (*State) SaveSnapshot

func (t *State) SaveSnapshot(writer io.Writer, collection statemachine.ISnapshotFileCollection, i <-chan struct{}) error

func (*State) Update

func (t *State) Update(bytes []byte) (statemachine.Result, error)

Jump to

Keyboard shortcuts

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