Documentation ¶
Index ¶
- type Collections
- func (*Collections) Descriptor() ([]byte, []int)
- func (m *Collections) GetMap() map[string]*TxNums
- func (m *Collections) GetMissingDataMap() map[string]bool
- func (*Collections) ProtoMessage()
- func (m *Collections) Reset()
- func (m *Collections) String() string
- func (m *Collections) XXX_DiscardUnknown()
- func (m *Collections) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *Collections) XXX_Merge(src proto.Message)
- func (m *Collections) XXX_Size() int
- func (m *Collections) XXX_Unmarshal(b []byte) error
- type ErrIllegalArgs
- type ErrIllegalCall
- type ErrOutOfRange
- type ExpiryData
- func (*ExpiryData) Descriptor() ([]byte, []int)
- func (m *ExpiryData) GetMap() map[string]*Collections
- func (*ExpiryData) ProtoMessage()
- func (m *ExpiryData) Reset()
- func (m *ExpiryData) String() string
- func (m *ExpiryData) XXX_DiscardUnknown()
- func (m *ExpiryData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *ExpiryData) XXX_Merge(src proto.Message)
- func (m *ExpiryData) XXX_Size() int
- func (m *ExpiryData) XXX_Unmarshal(b []byte) error
- type Provider
- type Store
- type StoreEnv
- type TxNums
- func (*TxNums) Descriptor() ([]byte, []int)
- func (m *TxNums) GetList() []uint64
- func (*TxNums) ProtoMessage()
- func (m *TxNums) Reset()
- func (m *TxNums) String() string
- func (m *TxNums) XXX_DiscardUnknown()
- func (m *TxNums) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *TxNums) XXX_Merge(src proto.Message)
- func (m *TxNums) XXX_Size() int
- func (m *TxNums) XXX_Unmarshal(b []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collections ¶ added in v1.2.0
type Collections struct { // for pvt data, there would be an // entry in TxNums Map map[string]*TxNums `` /* 126-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 `` /* 149-byte string literal not displayed */ XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Collections) Descriptor ¶ added in v1.2.0
func (*Collections) Descriptor() ([]byte, []int)
func (*Collections) GetMap ¶ added in v1.2.0
func (m *Collections) GetMap() map[string]*TxNums
func (*Collections) GetMissingDataMap ¶
func (m *Collections) GetMissingDataMap() map[string]bool
func (*Collections) ProtoMessage ¶ added in v1.2.0
func (*Collections) ProtoMessage()
func (*Collections) Reset ¶ added in v1.2.0
func (m *Collections) Reset()
func (*Collections) String ¶ added in v1.2.0
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 (dst *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 ¶ added in v1.2.0
type ExpiryData struct { Map map[string]*Collections `` /* 126-byte string literal not displayed */ XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*ExpiryData) Descriptor ¶ added in v1.2.0
func (*ExpiryData) Descriptor() ([]byte, []int)
func (*ExpiryData) GetMap ¶ added in v1.2.0
func (m *ExpiryData) GetMap() map[string]*Collections
func (*ExpiryData) ProtoMessage ¶ added in v1.2.0
func (*ExpiryData) ProtoMessage()
func (*ExpiryData) Reset ¶ added in v1.2.0
func (m *ExpiryData) Reset()
func (*ExpiryData) String ¶ added in v1.2.0
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 (dst *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 Provider ¶
Provider provides handle to specific 'Store' that in turn manages private write sets for a ledger
type Store ¶
type Store interface { // Init initializes the store. This function is expected to be invoked before using the store Init(btlPolicy pvtdatapolicy.BTLPolicy) // InitLastCommittedBlockHeight sets the last commited block height into the pvt data store // This function is used in a special case where the peer is started up with the blockchain // from an earlier version of a peer when the pvt data feature (and hence this store) was not // available. This function is expected to be called only this situation and hence is // expected to throw an error if the store is not empty. On a successful return from this // fucntion the state of the store is expected to be same as of calling the prepare/commit // function for block `0` through `blockNum` with no pvt data InitLastCommittedBlock(blockNum uint64) 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 GetPvtDataByBlockNum(blockNum uint64, filter ledger.PvtNsCollFilter) ([]*ledger.TxPvtData, 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. GetMissingPvtDataInfoForMostRecentBlocks(maxBlock int) (ledger.MissingPvtDataInfo, error) // Prepare prepares the Store for commiting the pvt data and storing both 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. // This call does not commit the pvt data and store missing private data. Subsequently, the caller // is expected to call either `Commit` or `Rollback` function. Return from this should ensure // that enough preparation is done such that `Commit` function invoked afterwards can commit the // data and the store is capable of surviving a crash between this function call and the next // invoke to the `Commit` Prepare(blockNum uint64, pvtData []*ledger.TxPvtData, missing *ledger.MissingPrivateDataList) error // Commit commits the pvt data passed in the previous invoke to the `Prepare` function Commit() error // Rollback rolls back the pvt data passed in the previous invoke to the `Prepare` function Rollback() error // IsEmpty returns true if the store does not have any block committed yet IsEmpty() (bool, error) // LastCommittedBlockHeight returns the height of the last committed block LastCommittedBlockHeight() (uint64, error) // HasPendingBatch returns if the store has a pending batch HasPendingBatch() (bool, error) // Shutdown stops the store Shutdown() }
Store manages the permanent storage of private write sets for a ledger Beacsue the pvt data is supposed to be in sync with the blocks in the ledger, both should logically happen in an atomic operation. In order to accomplish this, an implementation of this store should provide support for a two-phase like commit/rollback capability. The expected use is such that - first the private data will be given to this store (via `Prepare` funtion) and then the block is appended to the block storage. Finally, one of the functions `Commit` or `Rollback` is invoked on this store based on whether the block was written successfully or not. The store implementation is expected to survive a server crash between the call to `Prepare` and `Commit`/`Rollback`
type StoreEnv ¶
type StoreEnv struct { TestStoreProvider Provider TestStore Store // contains filtered or unexported fields }
StoreEnv provides the store env for testing
func NewTestStoreEnv ¶
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 ¶ added in v1.2.0
type TxNums struct { List []uint64 `protobuf:"varint,1,rep,packed,name=list" json:"list,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*TxNums) Descriptor ¶ added in v1.2.0
func (*TxNums) ProtoMessage ¶ added in v1.2.0
func (*TxNums) ProtoMessage()
func (*TxNums) XXX_DiscardUnknown ¶
func (m *TxNums) XXX_DiscardUnknown()