Documentation ¶
Index ¶
- type Consumer
- func (c *Consumer) HandleRepoCommit(ctx context.Context, evt *comatproto.SyncSubscribeRepos_Commit) error
- func (c *Consumer) HandleStreamEvent(ctx context.Context, xe *events.XRPCStreamEvent) error
- func (c *Consumer) PersistEvent(ctx context.Context, evt *models.Event, asJSON, compBytes []byte) error
- func (c *Consumer) ReadCursor(ctx context.Context) error
- func (c *Consumer) ReplayEvents(ctx context.Context, compressed bool, cursor int64, playbackRateLimit float64, ...) (int64, error)
- func (c *Consumer) RunSequencer(ctx context.Context) error
- func (c *Consumer) Shutdown()
- func (c *Consumer) TrimEvents(ctx context.Context) error
- func (c *Consumer) WriteCursor(ctx context.Context) error
- type Progress
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Consumer ¶
type Consumer struct { SocketURL string Progress *Progress Emit func(context.Context, *models.Event, []byte, []byte) error UncompressedDB *pebble.DB CompressedDB *pebble.DB EventTTL time.Duration // contains filtered or unexported fields }
Consumer is the consumer of the firehose
func NewConsumer ¶
func NewConsumer( ctx context.Context, logger *slog.Logger, socketURL string, dataDir string, eventTTL time.Duration, emit func(context.Context, *models.Event, []byte, []byte) error, ) (*Consumer, error)
NewConsumer creates a new consumer
func (*Consumer) HandleRepoCommit ¶
func (c *Consumer) HandleRepoCommit(ctx context.Context, evt *comatproto.SyncSubscribeRepos_Commit) error
HandleRepoCommit handles a repo commit event from the firehose and processes the records
func (*Consumer) HandleStreamEvent ¶
HandleStreamEvent handles a stream event from the firehose
func (*Consumer) PersistEvent ¶
func (c *Consumer) PersistEvent(ctx context.Context, evt *models.Event, asJSON, compBytes []byte) error
PersistEvent persists an event to PebbleDB
func (*Consumer) ReadCursor ¶
ReadCursor reads the cursor from file
func (*Consumer) ReplayEvents ¶
func (c *Consumer) ReplayEvents(ctx context.Context, compressed bool, cursor int64, playbackRateLimit float64, emit func(context.Context, int64, string, string, func() []byte) error) (int64, error)
ReplayEvents replays events from PebbleDB
func (*Consumer) TrimEvents ¶
TrimEvents deletes old events from PebbleDB
Click to show internal directories.
Click to hide internal directories.