indexer

package
v0.0.0-...-091610c Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DATA_STATUS_FINALIZED = "DATA_STATUS_FINALIZED"
	DATA_STATUS_ACCEPTED  = "DATA_STATUS_ACCEPTED"
	DATA_STATUS_PENDING   = "DATA_STATUS_PENDING"
)

Variables

View Source
var AcceptedMessageLock = &sync.Mutex{}
View Source
var AcceptedMessageQueue []IndexerMessage
View Source
var FinalizedMessageLock = &sync.Mutex{}
View Source
var FinalizedMessageQueue []IndexerMessage
View Source
var LastAcceptedEndKey int
View Source
var LastFinalizedCursor int
View Source
var PendingMessageLock = &sync.Mutex{}

Functions

func EventComparator

func EventComparator(event1 IndexerEvent, event2 IndexerEvent) bool

TODO: Improve this with hashing?

func InitIndexerRoutes

func InitIndexerRoutes()

func PrintIndexerError

func PrintIndexerError(funcName string, errMsg string, args ...interface{})

func ProcessMessage

func ProcessMessage(message IndexerMessage)

func ProcessMessageEvents

func ProcessMessageEvents(message IndexerMessage)

func StartMessageProcessor

func StartMessageProcessor()

func TryProcessAcceptedMessages

func TryProcessAcceptedMessages() bool

func TryProcessFinalizedMessages

func TryProcessFinalizedMessages() bool

func TryProcessPendingMessage

func TryProcessPendingMessage() bool

Types

type IndexerCursor

type IndexerCursor struct {
	OrderKey  int    `json:"orderKey"`
	UniqueKey string `json:"uniqueKey"`
}

type IndexerEvent

type IndexerEvent struct {
	Event struct {
		FromAddress string   `json:"fromAddress"`
		Keys        []string `json:"keys"`
		Data        []string `json:"data"`
	} `json:"event"`
}

type IndexerMessage

type IndexerMessage struct {
	Data struct {
		Cursor    IndexerCursor `json:"cursor"`
		EndCursor IndexerCursor `json:"end_cursor"`
		Finality  string        `json:"finality"`
		Batch     []struct {
			Status string         `json:"status"`
			Events []IndexerEvent `json:"events"`
		} `json:"batch"`
	} `json:"data"`
}
var LastProcessedPendingMessage *IndexerMessage
var LatestPendingMessage *IndexerMessage

TODO: Pointers? TODO: Load on init

Jump to

Keyboard shortcuts

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