chaininfo

package
v0.0.0-...-9795cd7 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package chaininfo is a library for processing fabric protobufs, and Luther specific data structures maintained on-chain.

Index

Constants

View Source
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 NewBlock

func NewBlock(blk *cb.Block) (*Block, error)

func (*Block) GetBlockNum

func (b *Block) GetBlockNum() uint64

GetBlockNum returns the block number.

func (*Block) GetHash

func (b *Block) GetHash() string

GetHash returns block hash.

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

func (*Block) Write

func (b *Block) Write(w io.Writer)

func (*Block) WriteTx

func (b *Block) WriteTx(i int, w io.Writer)

type CallbackState

type CallbackState struct {
	Context ConnectorEventContext `json:"ctx"`
}

CallbackState wraps a context.

type CommonBlock

type CommonBlock struct {
	cb.Block
}

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

func (s *ConnectorEvent) RequestBody() json.RawMessage

RequestBody returns a copy of the request.

func (*ConnectorEvent) RequestID

func (s *ConnectorEvent) RequestID() string

RequestID returns the ID of the request within the connector event.

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"`
}

ConnetorEventContext stores the context of the request.c:w

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

Unmarshal returns connector events.

type Event

type Event struct {
	*fabricpeer.ChaincodeEvent
}

func (*Event) GetChaincodeId

func (s *Event) GetChaincodeId() string

func (*Event) GetPayload

func (s *Event) GetPayload() []byte

func (*Event) IsLutherEvent

func (s *Event) IsLutherEvent() bool

func (*Event) String

func (s *Event) String() string

func (*Event) ToLutherEvent

func (s *Event) ToLutherEvent() (*lutherEvent, error)

type NSRWSet

type NSRWSet struct {
	RWSet     *RWSet
	Namespace string
}

func (*NSRWSet) GetNamespace

func (s *NSRWSet) GetNamespace() string

func (*NSRWSet) GetReadWriteSet

func (s *NSRWSet) GetReadWriteSet() *RWSet

type PrivRSetRecord

type PrivRSetRecord struct {
	Version *Version
	KeyHash []byte
}

func (*PrivRSetRecord) GetKeyHash

func (s *PrivRSetRecord) GetKeyHash() []byte

func (*PrivRSetRecord) GetVersion

func (s *PrivRSetRecord) GetVersion() *Version

type PrivWSetRecord

type PrivWSetRecord struct {
	KeyHash []byte
	ValHash []byte
}

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 (s *PvtRWSet) GetCollectionName() string

func (*PvtRWSet) GetHashedReadSet

func (s *PvtRWSet) GetHashedReadSet() []*PrivRSetRecord

func (*PvtRWSet) GetHashedWriteSet

func (s *PvtRWSet) GetHashedWriteSet() []*PrivWSetRecord

type RSetRecord

type RSetRecord struct {
	Version *Version
	Key     string
}

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

func (t *Transaction) GetID() TransactionID

ID is the transaction ID.

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 Version

type Version struct {
	BlockNum uint64
	TxNum    uint64
}

func (*Version) String

func (s *Version) String() string

type WSetRecord

type WSetRecord struct {
	Key string
	Val []byte
}

func (*WSetRecord) GetKey

func (s *WSetRecord) GetKey() string

func (*WSetRecord) GetVal

func (s *WSetRecord) GetVal() []byte

Jump to

Keyboard shortcuts

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