ingest

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogWriter

type LogWriter interface {
	// A nil error means every event is committed or its key already exists in
	// logs. Writers must honor ctx; shutdown waits for their active call to exit.
	CommitLogs(ctx context.Context, logs []db.IngestLog) error
}

type Options

type Options struct {
	Connection              *natsconn.NatsConnection
	Pool                    *pgxpool.Pool
	Writer                  LogWriter
	StreamMaxBytes          int64 // Zero preserves an existing finite limit; new streams default to 1 GiB.
	AckWait                 time.Duration
	AllowRetentionMigration bool // Only after backup/preflight and stopping all old writers.
}

type Service

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

Service owns every fetched message until commit/ACK, rejection or shutdown. DB and NATS connections are borrowed; their owner closes them after Shutdown.

func Open

func Open(ctx context.Context, opts Options) (*Service, error)

Open validates options and prepares durable broker state synchronously.

func (*Service) Run

func (s *Service) Run(ctx context.Context) (err error)

Run is called once. Canceling ctx is a hard stop; use Shutdown to drain first.

func (*Service) Shutdown

func (s *Service) Shutdown(ctx context.Context) error

Shutdown stops new pulls, commits accepted work and waits before borrowed connections may close. Deadline expiration cancels DB calls, then joins Run.

Jump to

Keyboard shortcuts

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