Skip to content

Commit

Permalink
Showing 1 changed file with 33 additions and 8 deletions.
41 changes: 33 additions & 8 deletions schema/appdata/data.go
Original file line number Diff line number Diff line change
@@ -49,18 +49,23 @@ type EventData struct {

// Event represents the data for a single event.
type Event struct {
// TxIndex is the index of the transaction in the block to which this event is associated.
// It should be set to a negative number if the event is not associated with a transaction.
// Canonically -1 should be used to represent begin block processing and -2 should be used to
// represent end block processing.
// BlockStage represents the stage of the block at which this event is associated.
// If the block stage is unknown, it should be set to UnknownBlockStage.
BlockStage BlockStage

// TxIndex is the 1-based index of the transaction in the block to which this event is associated.
// If TxIndex is zero, it means that we do not know the transaction index.
// Otherwise, the index should start with 1.
TxIndex int32

// MsgIndex is the index of the message in the transaction to which this event is associated.
// If TxIndex is negative, this index could correspond to the index of the message in
// begin or end block processing if such indexes exist, or it can be set to zero.
// MsgIndex is the 1-based index of the message in the transaction to which this event is associated.
// If MsgIndex is zero, it means that we do not know the message index.
// Otherwise, the index should start with 1.
MsgIndex int32

// EventIndex is the index of the event in the message to which this event is associated.
// EventIndex is the 1-based index of the event in the message to which this event is associated.
// If EventIndex is zero, it means that we do not know the event index.
// Otherwise, the index should start with 1.
EventIndex int32

// Type is the type of the event.
@@ -73,6 +78,26 @@ type Event struct {
Attributes ToEventAttributes
}

// BlockStage represents the stage of block processsing for an event.
type BlockStage int32

const (
// UnknownBlockStage indicates that we do not know the block stage.
UnknownBlockStage BlockStage = iota

// PreBlockStage indicates that the event is associated with the pre-block stage.
PreBlockStage

// BeginBlockStage indicates that the event is associated with the begin-block stage.
BeginBlockStage

// TxProcessingStage indicates that the event is associated with the transaction processing stage.
TxProcessingStage

// EndBlockStage indicates that the event is associated with the end-block stage.
EndBlockStage
)

type EventAttribute = struct {
Key, Value string
}

0 comments on commit 561840f

Please sign in to comment.