api

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB interface {
	// Put stores the given set of keys/values. If expiry time is 0 then the data lives forever.
	Put(keyVal ...*KeyValue) error

	// Get returns the value for the given key or nil if the key doesn't exist
	Get(key string) (*Value, error)

	// Get returns the values for multiple keys. The values are returned in the same order as the keys.
	GetMultiple(keys ...string) ([]*Value, error)

	// DeleteExpiredKeys deletes all of the expired keys
	DeleteExpiredKeys() error

	// Query returns a set of keys/values for the given query
	Query(query string) ([]*KeyValue, error)
}

DB persists collection data.

type DBProvider

type DBProvider interface {
	// GetDB return the DB for the given channel, namespace. and collection
	GetDB(channelID string, coll string, ns string) (DB, error)

	// Close closes the DB provider
	Close()
}

DBProvider returns the persister for the given namespace/collection

type KeyValue

type KeyValue struct {
	*Value
	Key string
}

KeyValue is a struct to store a key value pair

func NewKeyValue

func NewKeyValue(key string, value []byte, txID string, expiryTime time.Time) *KeyValue

NewKeyValue returns a new key

func (*KeyValue) String

func (k *KeyValue) String() string

String returns the string representation of the key

type Value

type Value struct {
	Value      []byte
	TxID       string
	ExpiryTime time.Time
	Revision   string
}

Value is a data value

Jump to

Keyboard shortcuts

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