indexer_manager

package
v0.3.6-dev2 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TransientStoreKey is the transient store key for indexer events.
	TransientStoreKey = "transient_indexer_events"

	// IndexerEventsKey is the key to retrieve the indexer events
	// within the last block.
	IndexerEventsKey = "IndexerEvents"

	ModuleName = "indexer_events"
)

Variables

View Source
var (
	ErrInvalidLengthEvent        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowEvent          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupEvent = fmt.Errorf("proto: unexpected end of group")
)
View Source
var IndexerTendermintEvent_BlockEvent_name = map[int32]string{
	0: "BLOCK_EVENT_UNSPECIFIED",
	1: "BLOCK_EVENT_BEGIN_BLOCK",
	2: "BLOCK_EVENT_END_BLOCK",
}
View Source
var IndexerTendermintEvent_BlockEvent_value = map[string]int32{
	"BLOCK_EVENT_UNSPECIFIED": 0,
	"BLOCK_EVENT_BEGIN_BLOCK": 1,
	"BLOCK_EVENT_END_BLOCK":   2,
}

Functions

func CreateIndexerBlockEventMessage

func CreateIndexerBlockEventMessage(
	block *IndexerTendermintBlock,
) msgsender.Message

CreateIndexerBlockEventMessage creates an on-chain update message for all the Indexer events in a block.

func GetB64EncodedEventMessage

func GetB64EncodedEventMessage(
	eventMessage proto.Message,
) string

GetB64EncodedEventMessage returns the base64 encoded event message. TODO(DEC-1720): Deprecate this function once we change the underlying proto to use bytes.

func GetBytesFromEventData

func GetBytesFromEventData(
	event string,
) []byte

GetBytesFromEventData returns the decoded bytes of the base64 event data string.

Types

type IndexerEventManager

type IndexerEventManager interface {
	Enabled() bool
	AddTxnEvent(ctx sdk.Context, subType string, data string, version uint32)
	SendOffchainData(message msgsender.Message)
	SendOnchainData(block *IndexerTendermintBlock)
	ProduceBlock(ctx sdk.Context) *IndexerTendermintBlock
	AddBlockEvent(
		ctx sdk.Context,
		subType string,
		data string,
		blockEvent IndexerTendermintEvent_BlockEvent,
		version uint32,
	)
	ClearEvents(ctx sdk.Context)
}

func NewIndexerEventManager

func NewIndexerEventManager(
	indexerMessageSender msgsender.IndexerMessageSender,
	indexerEventsTransientStoreKey storetypes.StoreKey,
	sendOffchainData bool,
) IndexerEventManager

func NewIndexerEventManagerNoop

func NewIndexerEventManagerNoop() IndexerEventManager

func NewIndexerEventManagerNoopEnabled

func NewIndexerEventManagerNoopEnabled() IndexerEventManager

type IndexerEventsStoreValue

type IndexerEventsStoreValue struct {
	Events []*IndexerTendermintEventWrapper `protobuf:"bytes,1,rep,name=events,proto3" json:"events,omitempty"`
}

IndexerEventsStoreValue represents the type of the value of the `IndexerEventsStore` in state.

func (*IndexerEventsStoreValue) Descriptor

func (*IndexerEventsStoreValue) Descriptor() ([]byte, []int)

func (*IndexerEventsStoreValue) GetEvents

func (*IndexerEventsStoreValue) Marshal

func (m *IndexerEventsStoreValue) Marshal() (dAtA []byte, err error)

func (*IndexerEventsStoreValue) MarshalTo

func (m *IndexerEventsStoreValue) MarshalTo(dAtA []byte) (int, error)

func (*IndexerEventsStoreValue) MarshalToSizedBuffer

func (m *IndexerEventsStoreValue) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*IndexerEventsStoreValue) ProtoMessage

func (*IndexerEventsStoreValue) ProtoMessage()

func (*IndexerEventsStoreValue) Reset

func (m *IndexerEventsStoreValue) Reset()

func (*IndexerEventsStoreValue) Size

func (m *IndexerEventsStoreValue) Size() (n int)

func (*IndexerEventsStoreValue) String

func (m *IndexerEventsStoreValue) String() string

func (*IndexerEventsStoreValue) Unmarshal

func (m *IndexerEventsStoreValue) Unmarshal(dAtA []byte) error

func (*IndexerEventsStoreValue) XXX_DiscardUnknown

func (m *IndexerEventsStoreValue) XXX_DiscardUnknown()

func (*IndexerEventsStoreValue) XXX_Marshal

func (m *IndexerEventsStoreValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*IndexerEventsStoreValue) XXX_Merge

func (m *IndexerEventsStoreValue) XXX_Merge(src proto.Message)

func (*IndexerEventsStoreValue) XXX_Size

func (m *IndexerEventsStoreValue) XXX_Size() int

func (*IndexerEventsStoreValue) XXX_Unmarshal

func (m *IndexerEventsStoreValue) XXX_Unmarshal(b []byte) error

type IndexerTendermintBlock

type IndexerTendermintBlock struct {
	Height   uint32                    `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"`
	Time     time.Time                 `protobuf:"bytes,2,opt,name=time,proto3,stdtime" json:"time"`
	Events   []*IndexerTendermintEvent `protobuf:"bytes,3,rep,name=events,proto3" json:"events,omitempty"`
	TxHashes []string                  `protobuf:"bytes,4,rep,name=tx_hashes,json=txHashes,proto3" json:"tx_hashes,omitempty"`
}

IndexerTendermintBlock contains all the events for the block along with metadata for the block height, timestamp of the block and a list of all the hashes of the transactions within the block. The transaction hashes follow the ordering of the transactions as they appear within the block.

func (*IndexerTendermintBlock) Descriptor

func (*IndexerTendermintBlock) Descriptor() ([]byte, []int)

func (*IndexerTendermintBlock) GetEvents

func (*IndexerTendermintBlock) GetHeight

func (m *IndexerTendermintBlock) GetHeight() uint32

func (*IndexerTendermintBlock) GetTime

func (m *IndexerTendermintBlock) GetTime() time.Time

func (*IndexerTendermintBlock) GetTxHashes

func (m *IndexerTendermintBlock) GetTxHashes() []string

func (*IndexerTendermintBlock) Marshal

func (m *IndexerTendermintBlock) Marshal() (dAtA []byte, err error)

func (*IndexerTendermintBlock) MarshalTo

func (m *IndexerTendermintBlock) MarshalTo(dAtA []byte) (int, error)

func (*IndexerTendermintBlock) MarshalToSizedBuffer

func (m *IndexerTendermintBlock) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*IndexerTendermintBlock) ProtoMessage

func (*IndexerTendermintBlock) ProtoMessage()

func (*IndexerTendermintBlock) Reset

func (m *IndexerTendermintBlock) Reset()

func (*IndexerTendermintBlock) Size

func (m *IndexerTendermintBlock) Size() (n int)

func (*IndexerTendermintBlock) String

func (m *IndexerTendermintBlock) String() string

func (*IndexerTendermintBlock) Unmarshal

func (m *IndexerTendermintBlock) Unmarshal(dAtA []byte) error

func (*IndexerTendermintBlock) XXX_DiscardUnknown

func (m *IndexerTendermintBlock) XXX_DiscardUnknown()

func (*IndexerTendermintBlock) XXX_Marshal

func (m *IndexerTendermintBlock) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*IndexerTendermintBlock) XXX_Merge

func (m *IndexerTendermintBlock) XXX_Merge(src proto.Message)

func (*IndexerTendermintBlock) XXX_Size

func (m *IndexerTendermintBlock) XXX_Size() int

func (*IndexerTendermintBlock) XXX_Unmarshal

func (m *IndexerTendermintBlock) XXX_Unmarshal(b []byte) error

type IndexerTendermintEvent

type IndexerTendermintEvent struct {
	// Subtype of the event e.g. "order_fill", "subaccount_update", etc.
	Subtype string `protobuf:"bytes,1,opt,name=subtype,proto3" json:"subtype,omitempty"`
	// Base64 encoded proto from the Tendermint event.
	// TODO(DEC-1720): Change to bytes post-migration.
	Data string `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
	// ordering_within_block is either the transaction index or a boolean
	// indicating the event was generated during processing the block rather than
	// any specific transaction e.g. during FinalizeBlock.
	//
	// Types that are valid to be assigned to OrderingWithinBlock:
	//
	//	*IndexerTendermintEvent_TransactionIndex
	//	*IndexerTendermintEvent_BlockEvent_
	OrderingWithinBlock isIndexerTendermintEvent_OrderingWithinBlock `protobuf_oneof:"ordering_within_block"`
	// Index of the event within the list of events that happened either during a
	// transaction or during processing of a block.
	// TODO(DEC-537): Deprecate this field because events are already ordered.
	EventIndex uint32 `protobuf:"varint,5,opt,name=event_index,json=eventIndex,proto3" json:"event_index,omitempty"`
	// Version of the event.
	Version uint32 `protobuf:"varint,6,opt,name=version,proto3" json:"version,omitempty"`
}

IndexerTendermintEvent contains the base64 encoded event proto emitted from the V4 application as well as additional metadata to determine the ordering of the event within the block and the subtype of the event.

func (*IndexerTendermintEvent) Descriptor

func (*IndexerTendermintEvent) Descriptor() ([]byte, []int)

func (*IndexerTendermintEvent) GetBlockEvent

func (*IndexerTendermintEvent) GetData

func (m *IndexerTendermintEvent) GetData() string

func (*IndexerTendermintEvent) GetEventIndex

func (m *IndexerTendermintEvent) GetEventIndex() uint32

func (*IndexerTendermintEvent) GetOrderingWithinBlock

func (m *IndexerTendermintEvent) GetOrderingWithinBlock() isIndexerTendermintEvent_OrderingWithinBlock

func (*IndexerTendermintEvent) GetSubtype

func (m *IndexerTendermintEvent) GetSubtype() string

func (*IndexerTendermintEvent) GetTransactionIndex

func (m *IndexerTendermintEvent) GetTransactionIndex() uint32

func (*IndexerTendermintEvent) GetVersion added in v0.3.0

func (m *IndexerTendermintEvent) GetVersion() uint32

func (*IndexerTendermintEvent) Marshal

func (m *IndexerTendermintEvent) Marshal() (dAtA []byte, err error)

func (*IndexerTendermintEvent) MarshalTo

func (m *IndexerTendermintEvent) MarshalTo(dAtA []byte) (int, error)

func (*IndexerTendermintEvent) MarshalToSizedBuffer

func (m *IndexerTendermintEvent) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*IndexerTendermintEvent) ProtoMessage

func (*IndexerTendermintEvent) ProtoMessage()

func (*IndexerTendermintEvent) Reset

func (m *IndexerTendermintEvent) Reset()

func (*IndexerTendermintEvent) Size

func (m *IndexerTendermintEvent) Size() (n int)

func (*IndexerTendermintEvent) String

func (m *IndexerTendermintEvent) String() string

func (*IndexerTendermintEvent) Unmarshal

func (m *IndexerTendermintEvent) Unmarshal(dAtA []byte) error

func (*IndexerTendermintEvent) XXX_DiscardUnknown

func (m *IndexerTendermintEvent) XXX_DiscardUnknown()

func (*IndexerTendermintEvent) XXX_Marshal

func (m *IndexerTendermintEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*IndexerTendermintEvent) XXX_Merge

func (m *IndexerTendermintEvent) XXX_Merge(src proto.Message)

func (*IndexerTendermintEvent) XXX_OneofWrappers

func (*IndexerTendermintEvent) XXX_OneofWrappers() []interface{}

XXX_OneofWrappers is for the internal use of the proto package.

func (*IndexerTendermintEvent) XXX_Size

func (m *IndexerTendermintEvent) XXX_Size() int

func (*IndexerTendermintEvent) XXX_Unmarshal

func (m *IndexerTendermintEvent) XXX_Unmarshal(b []byte) error

type IndexerTendermintEventWrapper

type IndexerTendermintEventWrapper struct {
	Event   *IndexerTendermintEvent `protobuf:"bytes,1,opt,name=event,proto3" json:"event,omitempty"`
	TxnHash string                  `protobuf:"bytes,2,opt,name=txn_hash,json=txnHash,proto3" json:"txn_hash,omitempty"`
}

IndexerTendermintEventWrapper is a wrapper around IndexerTendermintEvent, with an additional txn_hash field.

func (*IndexerTendermintEventWrapper) Descriptor

func (*IndexerTendermintEventWrapper) Descriptor() ([]byte, []int)

func (*IndexerTendermintEventWrapper) GetEvent

func (*IndexerTendermintEventWrapper) GetTxnHash

func (m *IndexerTendermintEventWrapper) GetTxnHash() string

func (*IndexerTendermintEventWrapper) Marshal

func (m *IndexerTendermintEventWrapper) Marshal() (dAtA []byte, err error)

func (*IndexerTendermintEventWrapper) MarshalTo

func (m *IndexerTendermintEventWrapper) MarshalTo(dAtA []byte) (int, error)

func (*IndexerTendermintEventWrapper) MarshalToSizedBuffer

func (m *IndexerTendermintEventWrapper) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*IndexerTendermintEventWrapper) ProtoMessage

func (*IndexerTendermintEventWrapper) ProtoMessage()

func (*IndexerTendermintEventWrapper) Reset

func (m *IndexerTendermintEventWrapper) Reset()

func (*IndexerTendermintEventWrapper) Size

func (m *IndexerTendermintEventWrapper) Size() (n int)

func (*IndexerTendermintEventWrapper) String

func (*IndexerTendermintEventWrapper) Unmarshal

func (m *IndexerTendermintEventWrapper) Unmarshal(dAtA []byte) error

func (*IndexerTendermintEventWrapper) XXX_DiscardUnknown

func (m *IndexerTendermintEventWrapper) XXX_DiscardUnknown()

func (*IndexerTendermintEventWrapper) XXX_Marshal

func (m *IndexerTendermintEventWrapper) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*IndexerTendermintEventWrapper) XXX_Merge

func (m *IndexerTendermintEventWrapper) XXX_Merge(src proto.Message)

func (*IndexerTendermintEventWrapper) XXX_Size

func (m *IndexerTendermintEventWrapper) XXX_Size() int

func (*IndexerTendermintEventWrapper) XXX_Unmarshal

func (m *IndexerTendermintEventWrapper) XXX_Unmarshal(b []byte) error

type IndexerTendermintEvent_BlockEvent

type IndexerTendermintEvent_BlockEvent int32

enum to specify that the IndexerTendermintEvent is a block event.

const (
	// Default value. This value is invalid and unused.
	IndexerTendermintEvent_BLOCK_EVENT_UNSPECIFIED IndexerTendermintEvent_BlockEvent = 0
	// BLOCK_EVENT_BEGIN_BLOCK indicates that the event was generated during
	// BeginBlock.
	IndexerTendermintEvent_BLOCK_EVENT_BEGIN_BLOCK IndexerTendermintEvent_BlockEvent = 1
	// BLOCK_EVENT_END_BLOCK indicates that the event was generated during
	// EndBlock.
	IndexerTendermintEvent_BLOCK_EVENT_END_BLOCK IndexerTendermintEvent_BlockEvent = 2
)

func (IndexerTendermintEvent_BlockEvent) EnumDescriptor

func (IndexerTendermintEvent_BlockEvent) EnumDescriptor() ([]byte, []int)

func (IndexerTendermintEvent_BlockEvent) String

type IndexerTendermintEvent_BlockEvent_

type IndexerTendermintEvent_BlockEvent_ struct {
	BlockEvent IndexerTendermintEvent_BlockEvent `` /* 174-byte string literal not displayed */
}

func (*IndexerTendermintEvent_BlockEvent_) MarshalTo

func (m *IndexerTendermintEvent_BlockEvent_) MarshalTo(dAtA []byte) (int, error)

func (*IndexerTendermintEvent_BlockEvent_) MarshalToSizedBuffer

func (m *IndexerTendermintEvent_BlockEvent_) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*IndexerTendermintEvent_BlockEvent_) Size

type IndexerTendermintEvent_TransactionIndex

type IndexerTendermintEvent_TransactionIndex struct {
	TransactionIndex uint32 `protobuf:"varint,3,opt,name=transaction_index,json=transactionIndex,proto3,oneof" json:"transaction_index,omitempty"`
}

func (*IndexerTendermintEvent_TransactionIndex) MarshalTo

func (m *IndexerTendermintEvent_TransactionIndex) MarshalTo(dAtA []byte) (int, error)

func (*IndexerTendermintEvent_TransactionIndex) MarshalToSizedBuffer

func (m *IndexerTendermintEvent_TransactionIndex) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*IndexerTendermintEvent_TransactionIndex) Size

Jump to

Keyboard shortcuts

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