Documentation ¶
Index ¶
- Constants
- type BlockHandler
- type CCEvent
- type CCEventHandler
- type Category
- type CollHashRead
- type CollHashReadHandler
- type CollHashWrite
- type CollHashWriteHandler
- type ConfigUpdate
- type ConfigUpdateHandler
- type Context
- type ErrorHandler
- type Handlers
- type LSCCWrite
- type LSCCWriteHandler
- type Opt
- func WithBlockHandler(handler BlockHandler) Opt
- func WithCCEventHandler(handler CCEventHandler) Opt
- func WithCollHashReadHandler(handler CollHashReadHandler) Opt
- func WithCollHashWriteHandler(handler CollHashWriteHandler) Opt
- func WithConfigUpdateHandler(handler ConfigUpdateHandler) Opt
- func WithErrorHandler(handler ErrorHandler) Opt
- func WithLSCCWriteHandler(handler LSCCWriteHandler) Opt
- func WithReadHandler(handler ReadHandler) Opt
- func WithWriteHandler(handler WriteHandler) Opt
- type Options
- type Read
- type ReadHandler
- type Visitor
- type Write
- type WriteHandler
Constants ¶
const ( // LsccID is the ID of the Lifecycle system chaincode LsccID = "lscc" // CollectionSeparator is used as a separator between the namespace (chaincode ID) and collection name CollectionSeparator = "~" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockHandler ¶ added in v0.1.6
BlockHandler publishes blocks
type CCEvent ¶
type CCEvent struct { BlockNum uint64 TxID string TxNum uint64 Event *pb.ChaincodeEvent }
CCEvent contains all information related to a chaincode Event on the block
type CCEventHandler ¶
CCEventHandler publishes chaincode events
type Category ¶ added in v0.1.3
type Category string
Category defines the error category
const ( // UnmarshalErr indicates that an error occurred while attempting to unmarshal block data UnmarshalErr Category = "UNMARSHAL_ERROR" // ReadHandlerErr indicates that the read handler returned an error ReadHandlerErr Category = "READ_HANDLER_ERROR" // WriteHandlerErr indicates that the write handler returned an error WriteHandlerErr Category = "WRITE_HANDLER_ERROR" // CollHashReadHandlerErr indicates that the collection hash read handler returned an error CollHashReadHandlerErr Category = "COLL_HASH_READ_HANDLER_ERROR" // CollHashWriteHandlerErr indicates that the collection hash write handler returned an error CollHashWriteHandlerErr Category = "COLL_HASH_WRITE_HANDLER_ERROR" // LSCCWriteHandlerErr indicates that the LSCC write handler returned an error LSCCWriteHandlerErr Category = "LSCCWRITE_HANDLER_ERROR" // CCEventHandlerErr indicates that the chaincode event handler returned an error CCEventHandlerErr Category = "CCEVENT_HANDLER_ERROR" // ConfigUpdateHandlerErr indicates that the configuration update handler returned an error ConfigUpdateHandlerErr Category = "CONFIG_UPDATE_HANDLER_ERROR" // BlockHandlerErr indicates that the block handler returned an error BlockHandlerErr Category = "BLOCK_HANDLER_ERROR" )
type CollHashRead ¶ added in v0.1.4
type CollHashRead struct { BlockNum uint64 TxID string TxNum uint64 Namespace string Collection string Read *kvrwset.KVReadHash }
CollHashRead contains all information related to a KV collection hash read on the block
type CollHashReadHandler ¶ added in v0.1.4
type CollHashReadHandler func(read *CollHashRead) error
CollHashReadHandler publishes KV collection hash read events
type CollHashWrite ¶ added in v0.1.4
type CollHashWrite struct { BlockNum uint64 TxID string TxNum uint64 Namespace string Collection string Write *kvrwset.KVWriteHash }
CollHashWrite contains all information related to a KV collection hash write on the block
type CollHashWriteHandler ¶ added in v0.1.4
type CollHashWriteHandler func(write *CollHashWrite) error
CollHashWriteHandler publishes KV collection hash write events
type ConfigUpdate ¶
type ConfigUpdate struct { BlockNum uint64 ConfigUpdate *cb.ConfigUpdate }
ConfigUpdate contains all information related to a config-update on the block
type ConfigUpdateHandler ¶
type ConfigUpdateHandler func(update *ConfigUpdate) error
ConfigUpdateHandler publishes config updates
type Context ¶ added in v0.1.3
type Context struct { Category Category ChannelID string BlockNum uint64 TxNum uint64 TxID string Read *Read Write *Write CollHashRead *CollHashRead CollHashWrite *CollHashWrite CCEvent *CCEvent LSCCWrite *LSCCWrite ConfigUpdate *ConfigUpdate }
Context holds the context at the time of a Visitor error
type ErrorHandler ¶ added in v0.1.3
ErrorHandler allows clients to handle errors
type Handlers ¶
type Handlers struct { HandleCCEvent CCEventHandler HandleRead ReadHandler HandleWrite WriteHandler HandleCollHashRead CollHashReadHandler HandleCollHashWrite CollHashWriteHandler HandleLSCCWrite LSCCWriteHandler HandleConfigUpdate ConfigUpdateHandler HandleBlock BlockHandler }
Handlers contains the full set of handlers
type LSCCWrite ¶
type LSCCWrite struct { BlockNum uint64 TxID string TxNum uint64 CCID string CCData *ccprovider.ChaincodeData CCP *pb.CollectionConfigPackage }
LSCCWrite contains all information related to an LSCC write on the block
type LSCCWriteHandler ¶
LSCCWriteHandler publishes LSCC write events
type Opt ¶
type Opt func(options *Options)
Opt is a block visitor option
func WithBlockHandler ¶ added in v0.1.6
func WithBlockHandler(handler BlockHandler) Opt
WithBlockHandler sets the block handler
func WithCCEventHandler ¶
func WithCCEventHandler(handler CCEventHandler) Opt
WithCCEventHandler sets the chaincode event handler
func WithCollHashReadHandler ¶ added in v0.1.4
func WithCollHashReadHandler(handler CollHashReadHandler) Opt
WithCollHashReadHandler sets the collection hash read handler
func WithCollHashWriteHandler ¶ added in v0.1.4
func WithCollHashWriteHandler(handler CollHashWriteHandler) Opt
WithCollHashWriteHandler sets the collection hash write handler
func WithConfigUpdateHandler ¶
func WithConfigUpdateHandler(handler ConfigUpdateHandler) Opt
WithConfigUpdateHandler sets the config-update handler
func WithErrorHandler ¶ added in v0.1.3
func WithErrorHandler(handler ErrorHandler) Opt
WithErrorHandler provides an error handler that's invoked when an error occurs in one of the handlers.
func WithLSCCWriteHandler ¶
func WithLSCCWriteHandler(handler LSCCWriteHandler) Opt
WithLSCCWriteHandler sets the LSCC write handler
func WithReadHandler ¶
func WithReadHandler(handler ReadHandler) Opt
WithReadHandler sets the read handler
func WithWriteHandler ¶
func WithWriteHandler(handler WriteHandler) Opt
WithWriteHandler sets the write handler
type Options ¶
type Options struct { *Handlers HandleError ErrorHandler }
Options contains all block Visitor options
type Visitor ¶
type Visitor struct { *Options // contains filtered or unexported fields }
Visitor traverses a block and publishes KV Read, KV Write, LSCC write, and chaincode events to registered handlers
func (*Visitor) LedgerHeight ¶
LedgerHeight returns ledger height based on last block published
func (*Visitor) SetLastCommittedBlockNum ¶ added in v0.1.1
SetLastCommittedBlockNum initializes the visitor with the given block number - only if the given block number is greater than the current last committed block number.
type Write ¶
type Write struct { BlockNum uint64 TxID string TxNum uint64 Namespace string Write *kvrwset.KVWrite }
Write contains all information related to a KV write on the block
type WriteHandler ¶
WriteHandler publishes KV write events