fabric-sdk-go: github.com/hyperledger/fabric-sdk-go/pkg/fab/keyvaluestore Index | Files

package keyvaluestore

import "github.com/hyperledger/fabric-sdk-go/pkg/fab/keyvaluestore"

Index

Package Files

filekeyvaluestore.go

type FileKeyValueStore Uses

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

FileKeyValueStore stores each value into a separate file. KeySerializer maps a key to a unique file path (raletive to the store path) ValueSerializer and ValueDeserializer serializes/de-serializes a value to and from a byte array that is stored in the path derived from the key.

func New Uses

func New(opts *FileKeyValueStoreOptions) (*FileKeyValueStore, error)

New creates a new instance of FileKeyValueStore using provided options

func (*FileKeyValueStore) Delete Uses

func (fkvs *FileKeyValueStore) Delete(key interface{}) error

Delete deletes the value for a key.

func (*FileKeyValueStore) GetPath Uses

func (fkvs *FileKeyValueStore) GetPath() string

GetPath returns the store path

func (*FileKeyValueStore) Load Uses

func (fkvs *FileKeyValueStore) Load(key interface{}) (interface{}, error)

Load returns the value stored in the store for a key. If a value for the key was not found, returns (nil, ErrNotFound)

func (*FileKeyValueStore) Store Uses

func (fkvs *FileKeyValueStore) Store(key interface{}, value interface{}) error

Store sets the value for the key.

type FileKeyValueStoreOptions Uses

type FileKeyValueStoreOptions struct {
    // Store path, mandatory
    Path string
    // Optional. If not provided, default key serializer is used.
    KeySerializer KeySerializer
    // Optional. If not provided, default Marshaller is used.
    Marshaller Marshaller
    // Optional. If not provided, default Unmarshaller is used.
    Unmarshaller Unmarshaller
}

FileKeyValueStoreOptions allow overriding store defaults

type KeySerializer Uses

type KeySerializer func(key interface{}) (string, error)

KeySerializer converts a key to a unique fila path

type Marshaller Uses

type Marshaller func(value interface{}) ([]byte, error)

Marshaller marshals a value into a byte array

type Unmarshaller Uses

type Unmarshaller func(value []byte) (interface{}, error)

Unmarshaller unmarshals a value from a byte array

Package keyvaluestore imports 5 packages (graph) and is imported by 2 packages. Updated 2019-04-27. Refresh now. Tools for package owners.