Documentation ¶
Index ¶
- type ErrPvtdataNotAvailable
- type ErrUnsupportedTransaction
- type Initializer
- type KVWrite
- func (*KVWrite) Descriptor() ([]byte, []int)
- func (m *KVWrite) GetCollection() string
- func (m *KVWrite) GetIsDelete() bool
- func (m *KVWrite) GetKey() []byte
- func (m *KVWrite) GetNamespace() string
- func (m *KVWrite) GetValue() []byte
- func (m *KVWrite) GetVersionBytes() []byte
- func (*KVWrite) ProtoMessage()
- func (m *KVWrite) Reset()
- func (m *KVWrite) String() string
- func (m *KVWrite) XXX_DiscardUnknown()
- func (m *KVWrite) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *KVWrite) XXX_Merge(src proto.Message)
- func (m *KVWrite) XXX_Size() int
- func (m *KVWrite) XXX_Unmarshal(b []byte) error
- type LockBasedTxMgr
- func (txmgr *LockBasedTxMgr) Commit() error
- func (txmgr *LockBasedTxMgr) CommitLostBlock(blockAndPvtdata *ledger.BlockAndPvtData) error
- func (txmgr *LockBasedTxMgr) ExportPubStateAndPvtStateHashes(dir string, newHashFunc snapshot.NewHashFunc) (map[string][]byte, error)
- func (txmgr *LockBasedTxMgr) GetLastSavepoint() (*version.Height, error)
- func (txmgr *LockBasedTxMgr) Name() string
- func (txmgr *LockBasedTxMgr) NewQueryExecutor(txid string) (ledger.QueryExecutor, error)
- func (txmgr *LockBasedTxMgr) NewQueryExecutorNoCollChecks() (ledger.QueryExecutor, error)
- func (txmgr *LockBasedTxMgr) NewTxSimulator(txid string) (ledger.TxSimulator, error)
- func (txmgr *LockBasedTxMgr) RemoveStaleAndCommitPvtDataOfOldBlocks(reconciledPvtdata map[uint64][]*ledger.TxPvtData) error
- func (txmgr *LockBasedTxMgr) Rollback()
- func (txmgr *LockBasedTxMgr) ShouldRecover(lastAvailableBlock uint64) (bool, uint64, error)
- func (txmgr *LockBasedTxMgr) Shutdown()
- func (txmgr *LockBasedTxMgr) ValidateAndPrepare(blockAndPvtdata *ledger.BlockAndPvtData, doMVCCValidation bool) ([]*validation.TxStatInfo, []byte, error)
- type Updates
- func (*Updates) Descriptor() ([]byte, []int)
- func (m *Updates) GetKvwrites() []*KVWrite
- func (*Updates) ProtoMessage()
- func (m *Updates) Reset()
- func (m *Updates) String() string
- func (m *Updates) XXX_DiscardUnknown()
- func (m *Updates) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Updates) XXX_Merge(src proto.Message)
- func (m *Updates) XXX_Size() int
- func (m *Updates) XXX_Unmarshal(b []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrPvtdataNotAvailable ¶ added in v1.1.0
type ErrPvtdataNotAvailable struct {
Msg string
}
ErrPvtdataNotAvailable is to be thrown when an application seeks a private data item during simulation and the simulator is not capable of returning the version of the private data item consistent with the snapshot exposed to the simulation
func (*ErrPvtdataNotAvailable) Error ¶ added in v1.1.0
func (e *ErrPvtdataNotAvailable) Error() string
type ErrUnsupportedTransaction ¶ added in v1.1.0
type ErrUnsupportedTransaction struct {
Msg string
}
ErrUnsupportedTransaction is expected to be thrown if a unsupported query is performed in an update transaction
func (*ErrUnsupportedTransaction) Error ¶ added in v1.1.0
func (e *ErrUnsupportedTransaction) Error() string
type Initializer ¶ added in v1.5.6
type Initializer struct { LedgerID string DB *privacyenabledstate.DB StateListeners []ledger.StateListener BtlPolicy pvtdatapolicy.BTLPolicy BookkeepingProvider bookkeeping.Provider CCInfoProvider ledger.DeployedChaincodeInfoProvider CustomTxProcessors map[common.HeaderType]ledger.CustomTxProcessor HashFunc rwsetutil.HashFunc }
Initializer captures the dependencies for tx manager
type KVWrite ¶ added in v1.5.6
type KVWrite struct { Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"` Collection string `protobuf:"bytes,2,opt,name=collection,proto3" json:"collection,omitempty"` Key []byte `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` IsDelete bool `protobuf:"varint,4,opt,name=isDelete,proto3" json:"isDelete,omitempty"` Value []byte `protobuf:"bytes,5,opt,name=value,proto3" json:"value,omitempty"` VersionBytes []byte `protobuf:"bytes,6,opt,name=version_bytes,json=versionBytes,proto3" json:"version_bytes,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*KVWrite) Descriptor ¶ added in v1.5.6
func (*KVWrite) GetCollection ¶ added in v1.5.6
func (*KVWrite) GetIsDelete ¶ added in v1.5.6
func (*KVWrite) GetNamespace ¶ added in v1.5.6
func (*KVWrite) GetVersionBytes ¶ added in v1.5.6
func (*KVWrite) ProtoMessage ¶ added in v1.5.6
func (*KVWrite) ProtoMessage()
func (*KVWrite) XXX_DiscardUnknown ¶ added in v1.5.6
func (m *KVWrite) XXX_DiscardUnknown()
func (*KVWrite) XXX_Marshal ¶ added in v1.5.6
func (*KVWrite) XXX_Unmarshal ¶ added in v1.5.6
type LockBasedTxMgr ¶ added in v1.5.6
type LockBasedTxMgr struct {
// contains filtered or unexported fields
}
LockBasedTxMgr a simple implementation of interface `txmgmt.TxMgr`. This implementation uses a read-write lock to prevent conflicts between transaction simulation and committing
func NewLockBasedTxMgr ¶ added in v1.5.6
func NewLockBasedTxMgr(initializer *Initializer) (*LockBasedTxMgr, error)
NewLockBasedTxMgr constructs a new instance of NewLockBasedTxMgr
func (*LockBasedTxMgr) Commit ¶ added in v1.5.6
func (txmgr *LockBasedTxMgr) Commit() error
Commit implements method in interface `txmgmt.TxMgr`
func (*LockBasedTxMgr) CommitLostBlock ¶ added in v1.5.6
func (txmgr *LockBasedTxMgr) CommitLostBlock(blockAndPvtdata *ledger.BlockAndPvtData) error
CommitLostBlock implements method in interface kvledger.Recoverer
func (*LockBasedTxMgr) ExportPubStateAndPvtStateHashes ¶ added in v1.5.6
func (txmgr *LockBasedTxMgr) ExportPubStateAndPvtStateHashes(dir string, newHashFunc snapshot.NewHashFunc) (map[string][]byte, error)
ExportPubStateAndPvtStateHashes simply delegates the call to the statedb for exporting the data for a snapshot. It is assumed that the consumer would invoke this function when the commits are paused
func (*LockBasedTxMgr) GetLastSavepoint ¶ added in v1.5.6
func (txmgr *LockBasedTxMgr) GetLastSavepoint() (*version.Height, error)
GetLastSavepoint returns the block num recorded in savepoint, returns 0 if NO savepoint is found
func (*LockBasedTxMgr) Name ¶ added in v1.5.6
func (txmgr *LockBasedTxMgr) Name() string
Name returns the name of the database that manages all active states.
func (*LockBasedTxMgr) NewQueryExecutor ¶ added in v1.5.6
func (txmgr *LockBasedTxMgr) NewQueryExecutor(txid string) (ledger.QueryExecutor, error)
NewQueryExecutor implements method in interface `txmgmt.TxMgr`
func (*LockBasedTxMgr) NewQueryExecutorNoCollChecks ¶ added in v1.5.6
func (txmgr *LockBasedTxMgr) NewQueryExecutorNoCollChecks() (ledger.QueryExecutor, error)
NewQueryExecutorNoCollChecks is a workaround to make the initilization of lifecycle cache work. The issue is that in the current lifecycle code the cache is initialized via Initialize function of a statelistener which gets invoked during ledger opening. This invovation eventually leads to a call to DeployedChaincodeInfoProvider which inturn needs the channel config in order to varify the name of the implicit collection. And the channelconfig is loaded only after the ledger is opened. So, as a workaround, we skip the check of collection name in this function by supplying a relaxed query executor - This is perfectly safe otherwise. As a proper fix, the initialization of other components should take place outside ledger by explicit querying the ledger state so that the sequence of initialization is explicitly controlled. However that needs a bigger refactoring of code.
func (*LockBasedTxMgr) NewTxSimulator ¶ added in v1.5.6
func (txmgr *LockBasedTxMgr) NewTxSimulator(txid string) (ledger.TxSimulator, error)
NewTxSimulator implements method in interface `txmgmt.TxMgr`
func (*LockBasedTxMgr) RemoveStaleAndCommitPvtDataOfOldBlocks ¶ added in v1.5.6
func (txmgr *LockBasedTxMgr) RemoveStaleAndCommitPvtDataOfOldBlocks(reconciledPvtdata map[uint64][]*ledger.TxPvtData) error
RemoveStaleAndCommitPvtDataOfOldBlocks implements method in interface `txmgmt.TxMgr` The following six operations are performed: (1) constructs the unique pvt data from the passed reconciledPvtdata (2) acquire a lock on oldBlockCommit (3) checks for stale pvtData by comparing [version, valueHash] and removes stale data (4) creates update batch from the the non-stale pvtData (5) update the BTL bookkeeping managed by the purge manager and update expiring keys. (6) commit the non-stale pvt data to the stateDB This function assumes that the passed input contains only transactions that had been marked "Valid". In the current design, kvledger (a single consumer of this function), filters out the data of "invalid" transactions and supplies the data for "valid" transactions only.
func (*LockBasedTxMgr) Rollback ¶ added in v1.5.6
func (txmgr *LockBasedTxMgr) Rollback()
Rollback implements method in interface `txmgmt.TxMgr`
func (*LockBasedTxMgr) ShouldRecover ¶ added in v1.5.6
func (txmgr *LockBasedTxMgr) ShouldRecover(lastAvailableBlock uint64) (bool, uint64, error)
ShouldRecover implements method in interface kvledger.Recoverer
func (*LockBasedTxMgr) Shutdown ¶ added in v1.5.6
func (txmgr *LockBasedTxMgr) Shutdown()
Shutdown implements method in interface `txmgmt.TxMgr`
func (*LockBasedTxMgr) ValidateAndPrepare ¶ added in v1.5.6
func (txmgr *LockBasedTxMgr) ValidateAndPrepare(blockAndPvtdata *ledger.BlockAndPvtData, doMVCCValidation bool) ( []*validation.TxStatInfo, []byte, error, )
ValidateAndPrepare implements method in interface `txmgmt.TxMgr`
type Updates ¶ added in v1.5.6
type Updates struct { Kvwrites []*KVWrite `protobuf:"bytes,1,rep,name=kvwrites,proto3" json:"kvwrites,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Updates) Descriptor ¶ added in v1.5.6
func (*Updates) GetKvwrites ¶ added in v1.5.6
func (*Updates) ProtoMessage ¶ added in v1.5.6
func (*Updates) ProtoMessage()
func (*Updates) XXX_DiscardUnknown ¶ added in v1.5.6
func (m *Updates) XXX_DiscardUnknown()