pvtdatastorage

package
v2.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2021 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BootKVHash

type BootKVHash struct {
	KeyHash              []byte   `protobuf:"bytes,1,opt,name=keyHash,proto3" json:"keyHash,omitempty"`
	ValueHash            []byte   `protobuf:"bytes,2,opt,name=valueHash,proto3" json:"valueHash,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*BootKVHash) Descriptor

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

func (*BootKVHash) GetKeyHash

func (m *BootKVHash) GetKeyHash() []byte

func (*BootKVHash) GetValueHash

func (m *BootKVHash) GetValueHash() []byte

func (*BootKVHash) ProtoMessage

func (*BootKVHash) ProtoMessage()

func (*BootKVHash) Reset

func (m *BootKVHash) Reset()

func (*BootKVHash) String

func (m *BootKVHash) String() string

func (*BootKVHash) XXX_DiscardUnknown

func (m *BootKVHash) XXX_DiscardUnknown()

func (*BootKVHash) XXX_Marshal

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

func (*BootKVHash) XXX_Merge

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

func (*BootKVHash) XXX_Size

func (m *BootKVHash) XXX_Size() int

func (*BootKVHash) XXX_Unmarshal

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

type BootKVHashes

type BootKVHashes struct {
	List                 []*BootKVHash `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"`
	XXX_NoUnkeyedLiteral struct{}      `json:"-"`
	XXX_unrecognized     []byte        `json:"-"`
	XXX_sizecache        int32         `json:"-"`
}

func (*BootKVHashes) Descriptor

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

func (*BootKVHashes) GetList

func (m *BootKVHashes) GetList() []*BootKVHash

func (*BootKVHashes) ProtoMessage

func (*BootKVHashes) ProtoMessage()

func (*BootKVHashes) Reset

func (m *BootKVHashes) Reset()

func (*BootKVHashes) String

func (m *BootKVHashes) String() string

func (*BootKVHashes) XXX_DiscardUnknown

func (m *BootKVHashes) XXX_DiscardUnknown()

func (*BootKVHashes) XXX_Marshal

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

func (*BootKVHashes) XXX_Merge

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

func (*BootKVHashes) XXX_Size

func (m *BootKVHashes) XXX_Size() int

func (*BootKVHashes) XXX_Unmarshal

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

type CollElgInfo

type CollElgInfo struct {
	NsCollMap            map[string]*CollNames `` /* 159-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}              `json:"-"`
	XXX_unrecognized     []byte                `json:"-"`
	XXX_sizecache        int32                 `json:"-"`
}

func (*CollElgInfo) Descriptor

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

func (*CollElgInfo) GetNsCollMap

func (m *CollElgInfo) GetNsCollMap() map[string]*CollNames

func (*CollElgInfo) ProtoMessage

func (*CollElgInfo) ProtoMessage()

func (*CollElgInfo) Reset

func (m *CollElgInfo) Reset()

func (*CollElgInfo) String

func (m *CollElgInfo) String() string

func (*CollElgInfo) XXX_DiscardUnknown

func (m *CollElgInfo) XXX_DiscardUnknown()

func (*CollElgInfo) XXX_Marshal

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

func (*CollElgInfo) XXX_Merge

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

func (*CollElgInfo) XXX_Size

func (m *CollElgInfo) XXX_Size() int

func (*CollElgInfo) XXX_Unmarshal

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

type CollNames

type CollNames struct {
	Entries              []string `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*CollNames) Descriptor

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

func (*CollNames) GetEntries

func (m *CollNames) GetEntries() []string

func (*CollNames) ProtoMessage

func (*CollNames) ProtoMessage()

func (*CollNames) Reset

func (m *CollNames) Reset()

func (*CollNames) String

func (m *CollNames) String() string

func (*CollNames) XXX_DiscardUnknown

func (m *CollNames) XXX_DiscardUnknown()

func (*CollNames) XXX_Marshal

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

func (*CollNames) XXX_Merge

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

func (*CollNames) XXX_Size

func (m *CollNames) XXX_Size() int

func (*CollNames) XXX_Unmarshal

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

type ExpiryData

type ExpiryData struct {
	Map                  map[string]*NamespaceExpiryData `` /* 147-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}                        `json:"-"`
	XXX_unrecognized     []byte                          `json:"-"`
	XXX_sizecache        int32                           `json:"-"`
}

func (*ExpiryData) Descriptor

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

func (*ExpiryData) GetMap

func (m *ExpiryData) GetMap() map[string]*NamespaceExpiryData

func (*ExpiryData) ProtoMessage

func (*ExpiryData) ProtoMessage()

func (*ExpiryData) Reset

func (m *ExpiryData) Reset()

func (*ExpiryData) String

func (m *ExpiryData) String() string

func (*ExpiryData) XXX_DiscardUnknown

func (m *ExpiryData) XXX_DiscardUnknown()

func (*ExpiryData) XXX_Marshal

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

func (*ExpiryData) XXX_Merge

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

func (*ExpiryData) XXX_Size

func (m *ExpiryData) XXX_Size() int

func (*ExpiryData) XXX_Unmarshal

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

type NamespaceExpiryData

type NamespaceExpiryData struct {
	// for pvt data, there would be an
	// entry in TxNums
	PresentData map[string]*TxNums `` /* 163-byte string literal not displayed */
	// for any number of missing pvt data of a collection,
	// there would be an entry in the map
	MissingData map[string]bool `` /* 164-byte string literal not displayed */
	//entries for hashes for the pvtdata key-values (loaded from snapshot data)
	BootKVHashes         map[string]*TxNums `` /* 165-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}           `json:"-"`
	XXX_unrecognized     []byte             `json:"-"`
	XXX_sizecache        int32              `json:"-"`
}

func (*NamespaceExpiryData) Descriptor

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

func (*NamespaceExpiryData) GetBootKVHashes

func (m *NamespaceExpiryData) GetBootKVHashes() map[string]*TxNums

func (*NamespaceExpiryData) GetMissingData

func (m *NamespaceExpiryData) GetMissingData() map[string]bool

func (*NamespaceExpiryData) GetPresentData

func (m *NamespaceExpiryData) GetPresentData() map[string]*TxNums

func (*NamespaceExpiryData) ProtoMessage

func (*NamespaceExpiryData) ProtoMessage()

func (*NamespaceExpiryData) Reset

func (m *NamespaceExpiryData) Reset()

func (*NamespaceExpiryData) String

func (m *NamespaceExpiryData) String() string

func (*NamespaceExpiryData) XXX_DiscardUnknown

func (m *NamespaceExpiryData) XXX_DiscardUnknown()

func (*NamespaceExpiryData) XXX_Marshal

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

func (*NamespaceExpiryData) XXX_Merge

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

func (*NamespaceExpiryData) XXX_Size

func (m *NamespaceExpiryData) XXX_Size() int

func (*NamespaceExpiryData) XXX_Unmarshal

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

type PrivateDataConfig

type PrivateDataConfig struct {
	// PrivateDataConfig is used to configure a private data storage provider
	*ledger.PrivateDataConfig
	// StorePath is the filesystem path for private data storage.
	// It is internally computed by the ledger component,
	// so it is not in ledger.PrivateDataConfig and not exposed to other components.
	StorePath string
}

PrivateDataConfig encapsulates the configuration for private data storage on the ledger

type Provider

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

Provider provides handle to specific 'Store' that in turn manages private write sets for a ledger

func NewProvider

func NewProvider(conf *PrivateDataConfig) (*Provider, error)

NewProvider instantiates a StoreProvider

func (*Provider) Close

func (p *Provider) Close()

Close closes the store

func (*Provider) Drop

func (p *Provider) Drop(ledgerid string) error

Drop drops channel-specific data from the pvtdata store

func (*Provider) OpenStore

func (p *Provider) OpenStore(ledgerid string) (*Store, error)

OpenStore returns a handle to a store

func (*Provider) SnapshotDataImporterFor

func (p *Provider) SnapshotDataImporterFor(
	ledgerID string,
	lastBlockInSnapshot uint64,
	membershipProvider ledger.MembershipInfoProvider,
	configHistoryRetriever *confighistory.Retriever,
	tempDirRoot string,
) (*SnapshotDataImporter, error)

SnapshotDataImporterFor returns an implementation of interface privacyenabledstate.SnapshotPvtdataHashesConsumer The returned struct is expected to be registered for receiving the pvtdata hashes from snapshot and loads the data into pvtdata store.

type SnapshotDataImporter

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

func (*SnapshotDataImporter) ConsumeSnapshotData

func (i *SnapshotDataImporter) ConsumeSnapshotData(
	namespace, collection string,
	keyHash, valueHash []byte,
	version *version.Height,
) error

func (*SnapshotDataImporter) Done

func (i *SnapshotDataImporter) Done() error

type Store

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

Store manages the permanent storage of private write sets for a ledger

func (*Store) Commit

func (s *Store) Commit(blockNum uint64, pvtData []*ledger.TxPvtData, missingPvtData ledger.TxMissingPvtData) error

Commit commits the pvt data as well as both the eligible and ineligible missing private data --- `eligible` denotes that the missing private data belongs to a collection for which this peer is a member; `ineligible` denotes that the missing private data belong to a collection for which this peer is not a member.

func (*Store) CommitPvtDataOfOldBlocks

func (s *Store) CommitPvtDataOfOldBlocks(
	blocksPvtData map[uint64][]*ledger.TxPvtData,
	unreconciledMissingData ledger.MissingPvtDataInfo,
) error

CommitPvtDataOfOldBlocks commits the pvtData (i.e., previously missing data) of old blockp. The parameter `blocksPvtData` refers a list of old block's pvtdata which are missing in the pvtstore. Given a list of old block's pvtData, `CommitPvtDataOfOldBlocks` performs the following three operations (1) construct update entries (i.e., dataEntries, expiryEntries, missingDataEntries)

from the above created data entries

(2) create a db update batch from the update entries (3) commit the update batch to the pvtStore

func (*Store) FetchBootKVHashes

func (s *Store) FetchBootKVHashes(blkNum, txNum uint64, ns, coll string) (map[string][]byte, error)

FetchBootKVHashes returns the KVHashes from the data that was loaded from a snapshot at the time of bootstrapping. This funciton returns an error if the supplied blkNum is greater than the last block number in the booting snapshot

func (*Store) GetLastUpdatedOldBlocksPvtData

func (s *Store) GetLastUpdatedOldBlocksPvtData() (map[uint64][]*ledger.TxPvtData, error)

GetLastUpdatedOldBlocksPvtData returns the pvtdata of blocks listed in `lastUpdatedOldBlocksList` TODO FAB-16293 -- GetLastUpdatedOldBlocksPvtData() can be removed either in v2.0 or in v2.1. If we decide to rebuild stateDB in v2.0, by default, the rebuild logic would take care of synching stateDB with pvtdataStore without calling GetLastUpdatedOldBlocksPvtData(). Hence, it can be safely removed. Suppose if we decide not to rebuild stateDB in v2.0, we can remove this function in v2.1.

func (*Store) GetMissingPvtDataInfoForMostRecentBlocks

func (s *Store) GetMissingPvtDataInfoForMostRecentBlocks(maxBlock int) (ledger.MissingPvtDataInfo, error)

GetMissingPvtDataInfoForMostRecentBlocks returns the missing private data information for the most recent `maxBlock` blocks which miss at least a private data of a eligible collection.

func (*Store) GetPvtDataByBlockNum

func (s *Store) GetPvtDataByBlockNum(blockNum uint64, filter ledger.PvtNsCollFilter) ([]*ledger.TxPvtData, error)

GetPvtDataByBlockNum returns only the pvt data corresponding to the given block number The pvt data is filtered by the list of 'ns/collections' supplied in the filter A nil filter does not filter any results

func (*Store) Init

func (s *Store) Init(btlPolicy pvtdatapolicy.BTLPolicy)

Init initializes the store. This function is expected to be invoked before using the store

func (*Store) LastCommittedBlockHeight

func (s *Store) LastCommittedBlockHeight() (uint64, error)

LastCommittedBlockHeight returns the height of the last committed block

func (*Store) ProcessCollsEligibilityEnabled

func (s *Store) ProcessCollsEligibilityEnabled(committingBlk uint64, nsCollMap map[string][]string) error

ProcessCollsEligibilityEnabled notifies the store when the peer becomes eligible to receive data for an existing collection. Parameter 'committingBlk' refers to the block number that contains the corresponding collection upgrade transaction and the parameter 'nsCollMap' contains the collections for which the peer is now eligible to receive pvt data

func (*Store) ResetLastUpdatedOldBlocksList

func (s *Store) ResetLastUpdatedOldBlocksList() error

ResetLastUpdatedOldBlocksList removes the `lastUpdatedOldBlocksList` entry from the store

type StoreEnv

type StoreEnv struct {
	TestStoreProvider *Provider
	TestStore         *Store
	// contains filtered or unexported fields
}

StoreEnv provides the store env for testing

func NewTestStoreEnv

func NewTestStoreEnv(
	t *testing.T,
	ledgerid string,
	btlPolicy pvtdatapolicy.BTLPolicy,
	conf *PrivateDataConfig) *StoreEnv

NewTestStoreEnv construct a StoreEnv for testing

func (*StoreEnv) Cleanup

func (env *StoreEnv) Cleanup()

Cleanup cleansup the store env after testing

func (*StoreEnv) CloseAndReopen

func (env *StoreEnv) CloseAndReopen()

CloseAndReopen closes and opens the store provider

type TxNums

type TxNums struct {
	List                 []uint64 `protobuf:"varint,1,rep,packed,name=list,proto3" json:"list,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*TxNums) Descriptor

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

func (*TxNums) GetList

func (m *TxNums) GetList() []uint64

func (*TxNums) ProtoMessage

func (*TxNums) ProtoMessage()

func (*TxNums) Reset

func (m *TxNums) Reset()

func (*TxNums) String

func (m *TxNums) String() string

func (*TxNums) XXX_DiscardUnknown

func (m *TxNums) XXX_DiscardUnknown()

func (*TxNums) XXX_Marshal

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

func (*TxNums) XXX_Merge

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

func (*TxNums) XXX_Size

func (m *TxNums) XXX_Size() int

func (*TxNums) XXX_Unmarshal

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

Jump to

Keyboard shortcuts

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