Documentation
¶
Overview ¶
Package chaininfo is a library for processing fabric protobufs, and Luther specific data structures maintained on-chain.
Index ¶
- Constants
- func GetPvtWriteSetValue(ns string, pdc string, key string, pvtData *rwset.TxPvtReadWriteSet) ([]byte, error)
- type Block
- type CallbackState
- type CommonBlock
- type ConnectorEvent
- func (s *ConnectorEvent) ObjectID() string
- func (s *ConnectorEvent) RequestBody() json.RawMessage
- func (s *ConnectorEvent) RequestEnglish() string
- func (s *ConnectorEvent) RequestID() string
- func (s *ConnectorEvent) RequestMSPID() string
- func (s *ConnectorEvent) RequestSystem() string
- func (s *ConnectorEvent) UnmarshalError() error
- type ConnectorEventContext
- type ConnectorEventHeader
- type ConnectorEventUnmarshaler
- type Event
- type NSRWSet
- type PrivRSetRecord
- type PrivWSetRecord
- type PvtRWSet
- type RSetRecord
- type RWSet
- type Transaction
- type TransactionDetails
- func (s *TransactionDetails) GetEvent() *Event
- func (s *TransactionDetails) GetNamespaceReadWriteSet() []*NSRWSet
- func (s *TransactionDetails) GetReadSetSize() int64
- func (s *TransactionDetails) GetWriteSetSize() int64
- func (s *TransactionDetails) GetWriteSetValue(ns string, key string) ([]byte, error)
- type TransactionID
- type TxValidation
- type Version
- type WSetRecord
Constants ¶
const ( LutherEventKey = "luther" LutherEventName = "txEventName" LutherEventRequestID = "txRequestID" LutherEventTxTimestamp = "txTimestamp" LutherConnectorEventPrefix = "$connector_events:" LutherConnectorEventContextPrefix = "$cr:" LutherConnectorEventContextPDC = "private" MaxConnectorEventsPerTx = 10 )
Variables ¶
This section is empty.
Functions ¶
func GetPvtWriteSetValue ¶
func GetPvtWriteSetValue(ns string, pdc string, key string, pvtData *rwset.TxPvtReadWriteSet) ([]byte, error)
GetPvtWriteSetValue looks up the value for a key stored in a PDC write set.
Types ¶
type Block ¶
type Block struct {
// contains filtered or unexported fields
}
Block is a container for the transaction information.
func (*Block) GetBlockNum ¶
GetBlockNum returns the block number.
func (*Block) GetTransactions ¶
func (b *Block) GetTransactions() []*Transaction
GetTransactions returns the transactions in the block.
func (*Block) GetValidation ¶
func (s *Block) GetValidation(txNum int) *TxValidation
type CallbackState ¶
type CallbackState struct {
Context ConnectorEventContext `json:"ctx"`
}
CallbackState wraps a context.
type CommonBlock ¶
func (*CommonBlock) Write ¶
func (s *CommonBlock) Write(w io.Writer)
type ConnectorEvent ¶
type ConnectorEvent struct {
// contains filtered or unexported fields
}
Event models an on-chain event.
func (*ConnectorEvent) ObjectID ¶
func (s *ConnectorEvent) ObjectID() string
ObjectID is the ID of the object that triggered the request.
func (*ConnectorEvent) RequestBody ¶
func (s *ConnectorEvent) RequestBody() json.RawMessage
RequestBody returns a copy of the request.
func (*ConnectorEvent) RequestEnglish ¶
func (s *ConnectorEvent) RequestEnglish() string
RequestEnglish is the english description for the request.
func (*ConnectorEvent) RequestID ¶
func (s *ConnectorEvent) RequestID() string
RequestID returns the ID of the request within the connector event.
func (*ConnectorEvent) RequestMSPID ¶
func (s *ConnectorEvent) RequestMSPID() string
RequestMSPID the ID of the MSP meant to process this event.
func (*ConnectorEvent) RequestSystem ¶
func (s *ConnectorEvent) RequestSystem() string
RequestSystem is the system name for the request.
func (*ConnectorEvent) UnmarshalError ¶
func (s *ConnectorEvent) UnmarshalError() error
UnmarshalError returns an error encountered while extracting the particular connector event. This allows the caller to handle errors at the individual request level.
type ConnectorEventContext ¶
type ConnectorEventContext struct { ObjectID string `json:"oid"` RequestMSPID string `json:"msp"` RequestKey string `json:"key"` RequestPDC string `json:"pdc"` RequestSystem string `json:"sys"` RequestEnglish string `json:"eng"` }
ConnetorEventContext stores the context of the request.
func (*ConnectorEventContext) String ¶
func (s *ConnectorEventContext) String() string
func (*ConnectorEventContext) Valid ¶
func (s *ConnectorEventContext) Valid() error
Valid determines if the event contect has the minimum set of fields to proceed with processing.
type ConnectorEventHeader ¶
type ConnectorEventHeader struct {
RequestID string `json:"rid"`
}
ConnectorEventHeader captures metadata about a request.
func (*ConnectorEventHeader) String ¶
func (s *ConnectorEventHeader) String() string
type ConnectorEventUnmarshaler ¶
type ConnectorEventUnmarshaler struct { // CCIDFilter selects which chaincode to retrieve events from. CCIDFilter string MSPFilter string }
ConnectorEventUnmarshaler unmarshals connector events within a block with private data.
func (*ConnectorEventUnmarshaler) Unmarshal ¶
func (s *ConnectorEventUnmarshaler) Unmarshal(blkPvt *fabricpeer.BlockAndPrivateData) ([]*ConnectorEvent, error)
Unmarshal returns connector events.
type Event ¶
type Event struct {
*fabricpeer.ChaincodeEvent
}
func (*Event) GetChaincodeId ¶
func (*Event) GetPayload ¶
func (*Event) IsLutherEvent ¶
func (*Event) ToLutherEvent ¶
type PrivRSetRecord ¶
func (*PrivRSetRecord) GetKeyHash ¶
func (s *PrivRSetRecord) GetKeyHash() []byte
func (*PrivRSetRecord) GetVersion ¶
func (s *PrivRSetRecord) GetVersion() *Version
type PrivWSetRecord ¶
func (*PrivWSetRecord) GetKeyHash ¶
func (s *PrivWSetRecord) GetKeyHash() []byte
func (*PrivWSetRecord) GetVaHashl ¶
func (s *PrivWSetRecord) GetVaHashl() []byte
type PvtRWSet ¶
type PvtRWSet struct { CollectionName string HashedReadSet []*PrivRSetRecord HashedWriteSet []*PrivWSetRecord }
func (*PvtRWSet) GetCollectionName ¶
func (*PvtRWSet) GetHashedReadSet ¶
func (s *PvtRWSet) GetHashedReadSet() []*PrivRSetRecord
func (*PvtRWSet) GetHashedWriteSet ¶
func (s *PvtRWSet) GetHashedWriteSet() []*PrivWSetRecord
type RSetRecord ¶
func (*RSetRecord) GetKey ¶
func (s *RSetRecord) GetKey() string
func (*RSetRecord) GetVersion ¶
func (s *RSetRecord) GetVersion() *Version
type RWSet ¶
type RWSet struct { ReadSet []*RSetRecord WriteSet []*WSetRecord }
func (*RWSet) GetReadSet ¶
func (s *RWSet) GetReadSet() []*RSetRecord
func (*RWSet) GetWriteSet ¶
func (s *RWSet) GetWriteSet() []*WSetRecord
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
Transaction is a container for the transaction information exported by QueryBlock.
func NewTransaction ¶
func NewTransaction(envelopeBytes []byte) (*Transaction, error)
NewTransaction creates an immutable transaction object.
func (*Transaction) GetDetails ¶
func (t *Transaction) GetDetails() *TransactionDetails
func (*Transaction) GetNumber ¶
func (t *Transaction) GetNumber() int
func (*Transaction) GetSize ¶
func (t *Transaction) GetSize() int
type TransactionDetails ¶
type TransactionDetails struct {
// contains filtered or unexported fields
}
func NewTransactionDetails ¶
func NewTransactionDetails(txBytes []byte) (*TransactionDetails, error)
NewTransactionDetails converts proto bytes for a tx into a helper struct.
func (*TransactionDetails) GetEvent ¶
func (s *TransactionDetails) GetEvent() *Event
func (*TransactionDetails) GetNamespaceReadWriteSet ¶
func (s *TransactionDetails) GetNamespaceReadWriteSet() []*NSRWSet
func (*TransactionDetails) GetReadSetSize ¶
func (s *TransactionDetails) GetReadSetSize() int64
func (*TransactionDetails) GetWriteSetSize ¶
func (s *TransactionDetails) GetWriteSetSize() int64
func (*TransactionDetails) GetWriteSetValue ¶
func (s *TransactionDetails) GetWriteSetValue(ns string, key string) ([]byte, error)
type TransactionID ¶
type TransactionID string
type TxValidation ¶
type TxValidation int32
func (*TxValidation) GetReason ¶
func (s *TxValidation) GetReason() string
func (*TxValidation) Valid ¶
func (s *TxValidation) Valid() bool
type WSetRecord ¶
func (*WSetRecord) GetKey ¶
func (s *WSetRecord) GetKey() string
func (*WSetRecord) GetVal ¶
func (s *WSetRecord) GetVal() []byte