Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(schema): update event index definitions #21565

Merged
merged 5 commits into from
Sep 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 33 additions & 8 deletions schema/appdata/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
}
Expand Down
Loading