kv

package
v2.3.1-beta.3 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const PluginName string = "kv"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v2.1.0

type Config struct {
	Data map[string]interface{} `mapstructure:"kv"`
}

Config represents general storage configuration with keys as the user defined kv-names and values as the drivers

type Plugin added in v2.1.0

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

Plugin for the unified storage

func (*Plugin) Available added in v2.2.0

func (p *Plugin) Available()

Available interface implementation

func (*Plugin) Collects added in v2.1.0

func (p *Plugin) Collects() []interface{}

Collects will get all plugins which implement Storage interface

func (*Plugin) GetAllStorageDrivers added in v2.1.0

func (p *Plugin) GetAllStorageDrivers(name endure.Named, storage StorageDriver)

func (*Plugin) Init added in v2.1.0

func (p *Plugin) Init(cfg config.Configurer, log logger.Logger) error

func (*Plugin) Name added in v2.1.0

func (p *Plugin) Name() string

func (*Plugin) RPC added in v2.1.0

func (p *Plugin) RPC() interface{}

RPC returns associated rpc service.

func (*Plugin) Serve added in v2.1.0

func (p *Plugin) Serve() chan error

func (*Plugin) Stop added in v2.1.0

func (p *Plugin) Stop() error

type Provider added in v2.1.0

type Provider interface {
	// Provide provides Storage based on the config key
	KVProvide(key string) (Storage, error)
}

Provider provides storage based on the config

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][]byte, error)

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

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

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

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

Storage represents single abstract storage.

type StorageDriver added in v2.1.0

type StorageDriver interface {
	Provider
}

StorageDriver interface provide storage

Directories

Path Synopsis
drivers

Jump to

Keyboard shortcuts

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