eventstore

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusPending    = "PENDING"
	StatusInProgress = "IN_PROGRESS"
	StatusSuccess    = "SUCCESS"
	StatusExpired    = "EXPIRED"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store provides database access for TSS events.

func NewStore

func NewStore(db *gorm.DB, logger zerolog.Logger) *Store

NewStore creates a new event store.

func (*Store) ClearExpiredAndSuccessfulEvents

func (s *Store) ClearExpiredAndSuccessfulEvents() (int64, error)

ClearExpiredAndSuccessfulEvents deletes both expired and successful events.

func (*Store) CreateEvent

func (s *Store) CreateEvent(event *store.TSSEvent) error

CreateEvent stores a new TSSEvent. Returns error if event already exists.

func (*Store) GetEvent

func (s *Store) GetEvent(eventID string) (*store.TSSEvent, error)

GetEvent retrieves an event by ID.

func (*Store) GetEventsByStatus

func (s *Store) GetEventsByStatus(status string, limit int) ([]store.TSSEvent, error)

GetEventsByStatus returns all events with the given status.

func (*Store) GetPendingEvents

func (s *Store) GetPendingEvents(currentBlock uint64, minBlockConfirmation uint64) ([]store.TSSEvent, error)

GetPendingEvents returns all pending events that are ready to be processed. Events are ready if they are at least `minBlockConfirmation` blocks behind the current block.

func (*Store) ResetInProgressEventsToPending

func (s *Store) ResetInProgressEventsToPending() (int64, error)

ResetInProgressEventsToPending resets all IN_PROGRESS events to PENDING status. This should be called on node startup to handle cases where the node crashed while events were in progress, causing sessions to be lost from memory.

func (*Store) UpdateStatus

func (s *Store) UpdateStatus(eventID, status, errorMsg string) error

UpdateStatus updates the status of an event.

func (*Store) UpdateStatusAndBlockNumber

func (s *Store) UpdateStatusAndBlockNumber(eventID, status string, blockNumber uint64) error

UpdateStatusAndBlockNumber updates the status and block number of an event.

Jump to

Keyboard shortcuts

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