kv

package
v2.0.0-RC.4 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	// Key of item
	Key string
	// Value of item
	Value string
	// live until time provided by TTL in RFC 3339 format
	TTL string
}

Item represents general storage item

type RPCServer

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

Wrapper for the plugin

func NewRPCServer

func NewRPCServer(srv Storage, log logger.Logger) *RPCServer

NewRPCServer construct RPC server for the particular plugin

func (*RPCServer) Close

func (r *RPCServer) Close(storage string, ok *bool) error

in string, storages

func (*RPCServer) Delete

func (r *RPCServer) Delete(in []string, ok *bool) error

in Data

func (*RPCServer) Has

func (r *RPCServer) Has(in []string, res *map[string]bool) error

data Data

func (*RPCServer) MExpire

func (r *RPCServer) MExpire(in []Item, ok *bool) error

in Data

func (*RPCServer) MGet

func (r *RPCServer) MGet(in []string, res *map[string]interface{}) error

in Data

func (*RPCServer) Set

func (r *RPCServer) Set(in []Item, ok *bool) error

in SetData

func (*RPCServer) TTL

func (r *RPCServer) TTL(in []string, res *map[string]interface{}) error

in Data

type Storage

type Storage interface {
	// Has checks if value exists.
	Has(keys ...string) (map[string]bool, error)

	// Get loads value content into a byte slice.
	Get(key string) ([]byte, error)

	// MGet loads content of multiple values
	// Returns the map with existing keys and associated values
	MGet(keys ...string) (map[string]interface{}, error)

	// Set used to upload item to KV with TTL
	// 0 value in TTL means no TTL
	Set(items ...Item) error

	// MExpire sets the TTL for multiply keys
	MExpire(items ...Item) error

	// TTL return the rest time to live for provided keys
	// Not supported for the memcached and boltdb
	TTL(keys ...string) (map[string]interface{}, error)

	// Delete one or multiple keys.
	Delete(keys ...string) error

	// Close closes the storage and underlying resources.
	Close() error
}

Storage represents single abstract storage.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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