wormhole-explorer/fly-event-processor/queue/types.go

44 lines
1.0 KiB
Go
Raw Normal View History

2024-04-24 06:56:22 -07:00
package queue
2024-04-24 08:55:57 -07:00
import (
"context"
"time"
)
// sqsEvent represents a event data from SQS.
type sqsEvent struct {
MessageID string `json:"MessageId"`
Message string `json:"Message"`
}
2024-04-24 06:56:22 -07:00
// Event represents a event data to be handle.
type Event struct {
2024-04-25 13:35:53 -07:00
TrackID string `json:"trackId"`
Type string `json:"type"`
Source string `json:"source"`
Data DuplicateVaa `json:"data"`
2024-04-24 08:55:57 -07:00
}
type DuplicateVaa struct {
VaaID string `json:"vaaId"`
2024-04-25 13:35:53 -07:00
ChainID uint16 `json:"chainId"`
2024-04-24 08:55:57 -07:00
Version uint8 `json:"version"`
GuardianSetIndex uint32 `json:"guardianSetIndex"`
Vaa []byte `json:"vaas"`
Digest string `json:"digest"`
ConsistencyLevel uint8 `json:"consistencyLevel"`
Timestamp *time.Time `json:"timestamp"`
2024-04-24 06:56:22 -07:00
}
// ConsumerMessage defition.
type ConsumerMessage interface {
Retry() uint8
Data() *Event
Done()
Failed()
IsExpired() bool
}
// ConsumeFunc is a function to consume Event.
type ConsumeFunc func(context.Context) <-chan ConsumerMessage