storeprovider

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: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CollOption

type CollOption func(c *collTypeConfig)

CollOption is a collection option

func WithCacheEnabled added in v0.1.5

func WithCacheEnabled() CollOption

WithCacheEnabled enables caching for the given collection type

func WithDecorator

func WithDecorator(decorator Decorator) CollOption

WithDecorator sets a decorator for a collection type allowing the key/value to be validated/modified before being persisted

type Decorator

type Decorator interface {
	// BeforeSave has the opportunity to decorate the key and/or value before the key-value is saved.
	BeforeSave(key *storeapi.Key, value *storeapi.ExpiringValue) (*storeapi.Key, *storeapi.ExpiringValue, error)

	// BeforeLoad has the opportunity to decorate the key before it is loaded/deleted.
	BeforeLoad(key *storeapi.Key) (*storeapi.Key, error)
}

Decorator allows the key/value to be modified/validated before being persisted.

type Option

type Option func(p *StoreProvider)

Option is a store provider option

func WithCollectionType

func WithCollectionType(collType pb.CollectionType, opts ...CollOption) Option

WithCollectionType adds a collection type to the set of collection types supported by the off-ledger store along with any options

type StoreProvider

type StoreProvider struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

StoreProvider is a store provider

func New

func New(
	identifierProvider collcommon.IdentifierProvider,
	identityDeserializerProvider collcommon.IdentityDeserializerProvider,
	collConfigProvider collcommon.CollectionConfigProvider,
	opts ...Option) *StoreProvider

New returns a store provider factory

func (*StoreProvider) Close

func (sp *StoreProvider) Close()

Close shuts down all of the stores

func (*StoreProvider) OpenStore

func (sp *StoreProvider) OpenStore(channelID string) (olapi.Store, error)

OpenStore opens the store for the given channel

func (*StoreProvider) StoreForChannel

func (sp *StoreProvider) StoreForChannel(channelID string) olapi.Store

StoreForChannel returns the store for the given channel

Directories

Path Synopsis
store
api

Jump to

Keyboard shortcuts

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