retriever

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewProvider

func NewProvider(providers *collcommon.Providers, opts ...Option) olapi.Provider

NewProvider returns a new collection data provider

Types

type Decorator

type Decorator interface {
	// BeforeLoad has the opportunity to decorate the key before target is loaded or deleted.
	BeforeLoad(key *storeapi.Key) (*storeapi.Key, error)

	// AfterQuery has the opportunity to decorate the key and/or value that is returned from a DB query.
	AfterQuery(key *storeapi.Key, value *storeapi.ExpiringValue) (*storeapi.Key, *storeapi.ExpiringValue, error)
}

Decorator allows the key/value to be modified/validated before being persisted. It is also applied to query results before the results are returned to the caller.

type Option

type Option func(p *Provider)

Option is a provider option

func WithDecorator

func WithDecorator(collType pb.CollectionType, decorator Decorator) Option

WithDecorator sets the decorator

func WithValidator

func WithValidator(collType pb.CollectionType, validator Validator) Option

WithValidator sets the key/value validator

type Provider

type Provider struct {
	*collcommon.Providers
	// contains filtered or unexported fields
}

Provider is a collection data data provider.

func (*Provider) RetrieverForChannel

func (p *Provider) RetrieverForChannel(channelID string) olapi.Retriever

RetrieverForChannel returns the collection data retriever for the given channel

type Validator

type Validator func(txID, ns, coll, key string, value []byte) error

Validator is a key/value validator

Jump to

Keyboard shortcuts

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