statecouchdb

package
v0.0.0-...-b544036 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2022 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DropApplicationDBs

func DropApplicationDBs(config *ledger.CouchDBConfig) error

DropApplicationDBs drops all application databases.

func IsEmpty

func IsEmpty(t testing.TB, config *ledger.CouchDBConfig) bool

IsEmpty returns whether or not the couchdb is empty

func RetrieveApplicationDBNames

func RetrieveApplicationDBNames(t testing.TB, config *ledger.CouchDBConfig) []string

RetrieveApplicationDBNames retrieves application DB names

func StartCouchDB

func StartCouchDB(t *testing.T, binds []string) (addr string, stopCouchDBFunc func())

StartCouchDB starts the CouchDB if it is not running already

Types

type CacheValue

type CacheValue struct {
	Version              []byte   `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"`
	Value                []byte   `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	Metadata             []byte   `protobuf:"bytes,3,opt,name=metadata,proto3" json:"metadata,omitempty"`
	AdditionalInfo       []byte   `protobuf:"bytes,4,opt,name=additional_info,json=additionalInfo,proto3" json:"additional_info,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*CacheValue) Descriptor

func (*CacheValue) Descriptor() ([]byte, []int)

func (*CacheValue) GetAdditionalInfo

func (m *CacheValue) GetAdditionalInfo() []byte

func (*CacheValue) GetMetadata

func (m *CacheValue) GetMetadata() []byte

func (*CacheValue) GetValue

func (m *CacheValue) GetValue() []byte

func (*CacheValue) GetVersion

func (m *CacheValue) GetVersion() []byte

func (*CacheValue) ProtoMessage

func (*CacheValue) ProtoMessage()

func (*CacheValue) Reset

func (m *CacheValue) Reset()

func (*CacheValue) String

func (m *CacheValue) String() string

func (*CacheValue) XXX_DiscardUnknown

func (m *CacheValue) XXX_DiscardUnknown()

func (*CacheValue) XXX_Marshal

func (m *CacheValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CacheValue) XXX_Merge

func (m *CacheValue) XXX_Merge(src proto.Message)

func (*CacheValue) XXX_Size

func (m *CacheValue) XXX_Size() int

func (*CacheValue) XXX_Unmarshal

func (m *CacheValue) XXX_Unmarshal(b []byte) error

type VersionAndMetadata

type VersionAndMetadata struct {
	Version              []byte   `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"`
	Metadata             []byte   `protobuf:"bytes,2,opt,name=metadata,proto3" json:"metadata,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*VersionAndMetadata) Descriptor

func (*VersionAndMetadata) Descriptor() ([]byte, []int)

func (*VersionAndMetadata) GetMetadata

func (m *VersionAndMetadata) GetMetadata() []byte

func (*VersionAndMetadata) GetVersion

func (m *VersionAndMetadata) GetVersion() []byte

func (*VersionAndMetadata) ProtoMessage

func (*VersionAndMetadata) ProtoMessage()

func (*VersionAndMetadata) Reset

func (m *VersionAndMetadata) Reset()

func (*VersionAndMetadata) String

func (m *VersionAndMetadata) String() string

func (*VersionAndMetadata) XXX_DiscardUnknown

func (m *VersionAndMetadata) XXX_DiscardUnknown()

func (*VersionAndMetadata) XXX_Marshal

func (m *VersionAndMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*VersionAndMetadata) XXX_Merge

func (m *VersionAndMetadata) XXX_Merge(src proto.Message)

func (*VersionAndMetadata) XXX_Size

func (m *VersionAndMetadata) XXX_Size() int

func (*VersionAndMetadata) XXX_Unmarshal

func (m *VersionAndMetadata) XXX_Unmarshal(b []byte) error

type VersionedDB

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

VersionedDB implements VersionedDB interface

func (*VersionedDB) ApplyUpdates

func (vdb *VersionedDB) ApplyUpdates(updates *statedb.UpdateBatch, height *version.Height) error

ApplyUpdates implements method in VersionedDB interface

func (*VersionedDB) BytesKeySupported

func (vdb *VersionedDB) BytesKeySupported() bool

BytesKeySupported implements method in VersionvdbedDB interface

func (*VersionedDB) ClearCachedVersions

func (vdb *VersionedDB) ClearCachedVersions()

ClearCachedVersions clears committedVersions and revisionNumbers

func (*VersionedDB) Close

func (vdb *VersionedDB) Close()

Close implements method in VersionedDB interface

func (*VersionedDB) ExecuteQuery

func (vdb *VersionedDB) ExecuteQuery(namespace, query string) (statedb.ResultsIterator, error)

ExecuteQuery implements method in VersionedDB interface

func (*VersionedDB) ExecuteQueryWithPagination

func (vdb *VersionedDB) ExecuteQueryWithPagination(namespace, query, bookmark string, pageSize int32) (statedb.QueryResultsIterator, error)

ExecuteQueryWithPagination implements method in VersionedDB interface

func (*VersionedDB) GetCachedVersion

func (vdb *VersionedDB) GetCachedVersion(namespace string, key string) (*version.Height, bool)

GetCachedVersion returns version from cache. `LoadCommittedVersions` function populates the cache

func (*VersionedDB) GetDBType

func (vdb *VersionedDB) GetDBType() string

GetDBType returns the hosted stateDB

func (*VersionedDB) GetFullScanIterator

func (vdb *VersionedDB) GetFullScanIterator(skipNamespace func(string) bool) (statedb.FullScanIterator, error)

GetFullScanIterator implements method in VersionedDB interface. This function returns a FullScanIterator that can be used to iterate over entire data in the statedb for a channel. `skipNamespace` parameter can be used to control if the consumer wants the FullScanIterator to skip one or more namespaces from the returned results.

func (*VersionedDB) GetLatestSavePoint

func (vdb *VersionedDB) GetLatestSavePoint() (*version.Height, error)

GetLatestSavePoint implements method in VersionedDB interface

func (*VersionedDB) GetState

func (vdb *VersionedDB) GetState(namespace string, key string) (*statedb.VersionedValue, error)

GetState implements method in VersionedDB interface

func (*VersionedDB) GetStateMultipleKeys

func (vdb *VersionedDB) GetStateMultipleKeys(namespace string, keys []string) ([]*statedb.VersionedValue, error)

GetStateMultipleKeys implements method in VersionedDB interface

func (*VersionedDB) GetStateRangeScanIterator

func (vdb *VersionedDB) GetStateRangeScanIterator(namespace string, startKey string, endKey string) (statedb.ResultsIterator, error)

GetStateRangeScanIterator implements method in VersionedDB interface startKey is inclusive endKey is exclusive

func (*VersionedDB) GetStateRangeScanIteratorWithPagination

func (vdb *VersionedDB) GetStateRangeScanIteratorWithPagination(namespace string, startKey string, endKey string, pageSize int32) (statedb.QueryResultsIterator, error)

GetStateRangeScanIteratorWithPagination implements method in VersionedDB interface startKey is inclusive endKey is exclusive pageSize limits the number of results returned

func (*VersionedDB) GetVersion

func (vdb *VersionedDB) GetVersion(namespace string, key string) (*version.Height, error)

GetVersion implements method in VersionedDB interface

func (*VersionedDB) LoadCommittedVersions

func (vdb *VersionedDB) LoadCommittedVersions(keys []*statedb.CompositeKey) error

LoadCommittedVersions populates committedVersions and revisionNumbers into cache. A bulk retrieve from couchdb is used to populate the cache. committedVersions cache will be used for state validation of readsets revisionNumbers cache will be used during commit phase for couchdb bulk updates

func (*VersionedDB) Open

func (vdb *VersionedDB) Open() error

Open implements method in VersionedDB interface

func (*VersionedDB) ProcessIndexesForChaincodeDeploy

func (vdb *VersionedDB) ProcessIndexesForChaincodeDeploy(namespace string, indexFilesData map[string][]byte) error

ProcessIndexesForChaincodeDeploy creates indexes for a specified namespace

func (*VersionedDB) ValidateKeyValue

func (vdb *VersionedDB) ValidateKeyValue(key string, value []byte) error

ValidateKeyValue implements method in VersionedDB interface

type VersionedDBProvider

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

VersionedDBProvider implements interface VersionedDBProvider

func NewVersionedDBProvider

func NewVersionedDBProvider(config *ledger.CouchDBConfig, metricsProvider metrics.Provider, sysNamespaces []string) (*VersionedDBProvider, error)

NewVersionedDBProvider instantiates VersionedDBProvider

func (*VersionedDBProvider) BytesKeySupported

func (provider *VersionedDBProvider) BytesKeySupported() bool

BytesKeySupported returns true if a db created supports bytes as a key

func (*VersionedDBProvider) Close

func (provider *VersionedDBProvider) Close()

Close closes the underlying db instance

func (*VersionedDBProvider) Drop

func (provider *VersionedDBProvider) Drop(dbName string) error

Drop drops the couch dbs and redologger data for the channel. It is not an error if a database does not exist.

func (*VersionedDBProvider) GetDBHandle

func (provider *VersionedDBProvider) GetDBHandle(dbName string, nsProvider statedb.NamespaceProvider) (statedb.VersionedDB, error)

GetDBHandle gets the handle to a named database

func (*VersionedDBProvider) HealthCheck

func (provider *VersionedDBProvider) HealthCheck(ctx context.Context) error

HealthCheck checks to see if the couch instance of the peer is healthy

func (*VersionedDBProvider) ImportFromSnapshot

func (provider *VersionedDBProvider) ImportFromSnapshot(
	dbName string,
	savepoint *version.Height,
	itr statedb.FullScanIterator,
) error

ImportFromSnapshot loads the public state and pvtdata hashes from the snapshot files previously generated

Jump to

Keyboard shortcuts

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