egresstracker

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: Apache-2.0, MIT Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const ReceiptsPath = "/receipts"

Variables

Functions

func NewHandler

func NewHandler(egressBatches retrievaljournal.Journal) echo.HandlerFunc

func ProvideConsolidationStore

func ProvideConsolidationStore(lc fx.Lifecycle, cfg app.AppConfig) (consolidationstore.Store, error)

func ProvideReceiptsClient

func ProvideReceiptsClient(lc fx.Lifecycle, cfg app.AppConfig) *receipts.Client

Types

type EgressTrackerQueue

type EgressTrackerQueue interface {
	Register(fn func(ctx context.Context, batchCID cid.Cid) error) error
	Enqueue(ctx context.Context, batchCID cid.Cid) error
}

func NewEgressTrackerQueue

func NewEgressTrackerQueue(queue *jobqueue.JobQueue[cid.Cid]) EgressTrackerQueue

func ProvideEgressTrackerQueue

func ProvideEgressTrackerQueue(lc fx.Lifecycle, params QueueParams) (EgressTrackerQueue, error)

type QueueParams

type QueueParams struct {
	fx.In

	DB            *sql.DB `name:"egress_tracker_db"`
	StorageConfig app.StorageConfig
}

type Server

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

func NewServer

func NewServer(egressBatches retrievaljournal.Journal) (*Server, error)

func (*Server) RegisterRoutes

func (srv *Server) RegisterRoutes(e *echo.Echo)

type Service

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

Service stores receipts from `space/content/retrieve` invocations, batches them and sends them to an egress tracking service via `space/egress/track` invocations.

func New

func New(
	id principal.Signer,
	egressTrackerConn client.Connection,
	egressTrackerProofs delegation.Proofs,
	batchEndpoint *url.URL,
	journal retrievaljournal.Journal,
	consolidationStore consolidationstore.Store,
	queue EgressTrackerQueue,
	rcptsClient *receipts.Client,
	cleanupCheckInterval time.Duration,
) (*Service, error)

func NewEgressTrackerService

func NewEgressTrackerService(
	lc fx.Lifecycle,
	id principal.Signer,
	journal retrievaljournal.Journal,
	consolidationStore consolidationstore.Store,
	queue EgressTrackerQueue,
	rcptsClient *receipts.Client,
	cfg app.AppConfig,
) (*Service, error)

func (*Service) AddReceipt

func (*Service) Start added in v0.2.3

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

Start starts the periodic cleanup task that checks for consolidated batches and removes them from the store as well as starting the journal rotator if enabled.

func (*Service) Stop added in v0.2.3

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

Stop stops the periodic cleanup task and journal rotator gracefully.

Jump to

Keyboard shortcuts

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