server

package
v0.0.0-...-63beb8f Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Size   = "PureKvRPC.Size"
	Del    = "PureKvRPC.Del"
	DelAll = "PureKvRPC.DelAll"
	Set    = "PureKvRPC.Set"
	Has    = "PureKvRPC.Has"
	Get    = "PureKvRPC.Get"
)

Shortcuts for RPC methods

Variables

This section is empty.

Functions

This section is empty.

Types

type PayLoad

type PayLoad struct {
	Ok    bool
	TTL   int
	Key   string
	Value []byte
}

PayLoad holds record and optional status

type PureKvRPC

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

PureKvRPC main structure for holding maps and key iterators

func NewPureKvRPC

func NewPureKvRPC(shardsNumber, TTLGarbageCollectionTimeoutMs int) *PureKvRPC

NewPureKv instantiates the new PureKvRPC object

func (*PureKvRPC) Del

func (kv *PureKvRPC) Del(req PayLoad, res *PayLoad) error

Del drops any record from map by key

func (*PureKvRPC) DelAll

func (kv *PureKvRPC) DelAll(req PayLoad, res *PayLoad) error

DestroyAll resets the entire store

func (*PureKvRPC) Dump

func (kv *PureKvRPC) Dump(path string) error

Dump ...

func (*PureKvRPC) Get

func (kv *PureKvRPC) Get(req PayLoad, res *PayLoad) error

Get returns value by key from one of the maps

func (*PureKvRPC) Has

func (kv *PureKvRPC) Has(req PayLoad, res *PayLoad) error

Has checks that key presented in store

func (*PureKvRPC) Load

func (kv *PureKvRPC) Load(path string) error

Load ...

func (*PureKvRPC) Set

func (kv *PureKvRPC) Set(req PayLoad, res *PayLoad) error

Set just creates the new key value pair

func (*PureKvRPC) Size

func (kv *PureKvRPC) Size(req PayLoad, res *PayLoad) error

Size calculates total number of instances in the map

type Server

type Server struct {
	Port int
	// contains filtered or unexported fields
}

Server holds config for RPC server

func InitServer

func InitServer(port, shards, TTLGarbageCollectionTimeoutMs int) *Server

InitServer creates a new instance of Server

func (*Server) Start

func (s *Server) Start()

startRPC starts a new listener and registers the RPC server

func (*Server) Stop

func (s *Server) Stop() error

Stop terminates server listener and close the store

Jump to

Keyboard shortcuts

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