pvtdatastorage

package
v0.0.0-...-7780888 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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 Collections

type Collections struct {
	// for pvt data, there would be an
	// entry in TxNums
	Map map[string]*TxNums `` /* 147-byte string literal not displayed */
	// for any number of missing pvt data of a collection,
	// there would be an entry in the map
	MissingDataMap       map[string]bool `` /* 170-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}        `json:"-"`
	XXX_unrecognized     []byte          `json:"-"`
	XXX_sizecache        int32           `json:"-"`
}

func (*Collections) Descriptor

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

func (*Collections) GetMap

func (m *Collections) GetMap() map[string]*TxNums

func (*Collections) GetMissingDataMap

func (m *Collections) GetMissingDataMap() map[string]bool

func (*Collections) ProtoMessage

func (*Collections) ProtoMessage()

func (*Collections) Reset

func (m *Collections) Reset()

func (*Collections) String

func (m *Collections) String() string

func (*Collections) XXX_DiscardUnknown

func (m *Collections) XXX_DiscardUnknown()

func (*Collections) XXX_Marshal

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

func (*Collections) XXX_Merge

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

func (*Collections) XXX_Size

func (m *Collections) XXX_Size() int

func (*Collections) XXX_Unmarshal

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

type ErrIllegalArgs

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

ErrIllegalArgs is to be thrown by a store impl if the args passed are not allowed

func (*ErrIllegalArgs) Error

func (err *ErrIllegalArgs) Error() string

type ErrIllegalCall

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

ErrIllegalCall is to be thrown by a store impl if the store does not expect a call to Prepare/Commit/Rollback/InitLastCommittedBlock

func (*ErrIllegalCall) Error

func (err *ErrIllegalCall) Error() string

type ErrOutOfRange

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

ErrOutOfRange is to be thrown for the request for the data that is not yet committed

func (*ErrOutOfRange) Error

func (err *ErrOutOfRange) Error() string

type ExpiryData

type ExpiryData struct {
	Map                  map[string]*Collections `` /* 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]*Collections

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 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) OpenStore

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

OpenStore returns a handle to a store

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.TxMissingPvtDataMap) 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) 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