kvs

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: Apache-2.0 Imports: 11 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCompositeKey

func CreateCompositeKey(objectType string, attributes []string) (string, error)

CreateCompositeKey and its related functions and consts copied from core/chaincode/shim/chaincode.go

func CreateCompositeKeyOrPanic

func CreateCompositeKeyOrPanic(objectType string, attributes []string) string

func CreateRangeKeysForPartialCompositeKey

func CreateRangeKeysForPartialCompositeKey(objectType string, attributes []string) (string, string, error)

func GetDriverNameFromConf

func GetDriverNameFromConf(sp view.ServiceProvider) string

GetDriverNameFromConf returns the driver name from the node's configuration

func SplitCompositeKey

func SplitCompositeKey(compositeKey string) (string, []string, error)

SplitCompositeKey splits the passed composite key into objectType and attributes

Types

type ConfigProvider

type ConfigProvider interface {
	// UnmarshalKey takes a single key and unmarshals it into a Struct
	UnmarshalKey(key string, rawVal interface{}) error
	// IsSet checks to see if the key has been set in any of the data locations
	IsSet(key string) bool
	// GetInt returns the value associated with the key as an integer
	GetInt(key string) int
}

ConfigProvider models the DB configuration provider

type Iterator added in v0.2.0

type Iterator interface {
	HasNext() bool
	Close() error
	Next(state interface{}) (string, error)
}

type KVS

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

func GetService

func GetService(ctx view.ServiceProvider) *KVS

GetService returns the KVS instance registered in the passed context. If no KVS instance is registered, it panics.

func New

func New(sp view.ServiceProvider, driverName, namespace string) (*KVS, error)

New returns a new KVS instance for the passed namespace using the passed driver

func NewWithConfig

func NewWithConfig(sp view.ServiceProvider, driverName, namespace string, cp ConfigProvider) (*KVS, error)

NewWithConfig returns a new KVS instance for the passed namespace using the passed driver and config provider

func (*KVS) Delete

func (o *KVS) Delete(id string) error

func (*KVS) Exists

func (o *KVS) Exists(id string) bool

func (*KVS) Get

func (o *KVS) Get(id string, state interface{}) error

func (*KVS) GetByPartialCompositeID

func (o *KVS) GetByPartialCompositeID(prefix string, attrs []string) (Iterator, error)

func (*KVS) Put

func (o *KVS) Put(id string, state interface{}) error

func (*KVS) Stop

func (o *KVS) Stop()

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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