store

package
v0.0.0-...-bfcd41d 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: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExpiringValue

type ExpiringValue struct {
	Value  []byte
	Expiry time.Time
}

ExpiringValue is holds the value and expiration time.

type ExpiringValues

type ExpiringValues []*ExpiringValue

ExpiringValues expiring values

func (ExpiringValues) Values

func (ev ExpiringValues) Values() common.Values

Values returns the ExpiringValues as Values

type Key

type Key struct {
	EndorsedAtTxID string
	Namespace      string
	Collection     string
	Key            string
}

Key is a key for retrieving collection data

func NewKey

func NewKey(endorsedAtTxID string, ns string, coll string, key string) *Key

NewKey returns a new collection key

func (*Key) String

func (k *Key) String() string

String returns the string representation of the key

type MultiKey

type MultiKey struct {
	EndorsedAtTxID string
	Namespace      string
	Collection     string
	Keys           []string
}

MultiKey is a key for retrieving collection data for multiple keys

func NewMultiKey

func NewMultiKey(endorsedAtTxID string, ns string, coll string, keys ...string) *MultiKey

NewMultiKey returns a new collection data multi-key

func (*MultiKey) String

func (k *MultiKey) String() string

String returns the string representation of the key

type Provider

type Provider interface {
	RetrieverForChannel(channel string) Retriever
}

Provider provides private data retrievers

type QueryKey

type QueryKey struct {
	EndorsedAtTxID string
	Namespace      string
	Collection     string
	Query          string
}

QueryKey holds the criteria for retrieving collection data in rich queries

func NewQueryKey

func NewQueryKey(endorsedAtTxID string, ns string, coll string, query string) *QueryKey

NewQueryKey returns a new collection data query-key

func (*QueryKey) String

func (k *QueryKey) String() string

String returns the string representation of the key

type QueryResult

type QueryResult struct {
	*Key
	*ExpiringValue
}

QueryResult holds a single item from the query result set

type ResultsIterator

type ResultsIterator interface {
	// Next returns the next item in the result set. The result is expected to be nil when
	// the iterator gets exhausted
	Next() (*QueryResult, error)

	// Close releases resources occupied by the iterator
	Close()
}

ResultsIterator is an iterator returned by a query

type Retriever

type Retriever interface {
	// GetTransientData gets the value for the given transient data item
	GetTransientData(ctxt context.Context, key *Key) (*ExpiringValue, error)

	// GetTransientDataMultipleKeys gets the values for the multiple transient data items in a single call
	GetTransientDataMultipleKeys(ctxt context.Context, key *MultiKey) (ExpiringValues, error)

	// GetData gets the value for the given data item
	GetData(ctxt context.Context, key *Key) (*ExpiringValue, error)

	// GetDataMultipleKeys gets the values for the multiple data items in a single call
	GetDataMultipleKeys(ctxt context.Context, key *MultiKey) (ExpiringValues, error)

	// Query returns the results of the given query
	Query(ctxt context.Context, key *QueryKey) (ResultsIterator, error)
}

Retriever retrieves private data

type Store

type Store interface {
	// Persist stores the private write set of a transaction.
	Persist(txid string, privateSimulationResultsWithConfig *proto.TxPvtReadWriteSetWithConfigInfo) error

	// GetTransientData gets the value for the given transient data item
	GetTransientData(key *Key) (*ExpiringValue, error)

	// GetTransientDataMultipleKeys gets the values for the multiple transient data items in a single call
	GetTransientDataMultipleKeys(key *MultiKey) (ExpiringValues, error)

	// GetData gets the value for the given item
	GetData(key *Key) (*ExpiringValue, error)

	// GetDataMultipleKeys gets the values for the multiple items in a single call
	GetDataMultipleKeys(key *MultiKey) (ExpiringValues, error)

	// Query executes the given query
	// NOTE: This function is only supported on CouchDB
	Query(key *QueryKey) (ResultsIterator, error)

	// PutData stores the key/value.
	PutData(config *pb.StaticCollectionConfig, key *Key, value *ExpiringValue) error

	// Close closes the store
	Close()
}

Store manages the storage of private data collections.

Jump to

Keyboard shortcuts

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