riverpilot

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2025 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PeriodicJob added in v0.23.0

type PeriodicJob struct {
	ID        string
	CreatedAt time.Time
	NextRunAt time.Time
	UpdatedAt time.Time
}

type PeriodicJobGetAllParams added in v0.23.0

type PeriodicJobGetAllParams struct {
	Schema string
}

type PeriodicJobKeepAliveAndReapParams added in v0.23.0

type PeriodicJobKeepAliveAndReapParams struct {
	ID     []string
	Schema string
}

type PeriodicJobUpsertManyParams added in v0.23.0

type PeriodicJobUpsertManyParams struct {
	Jobs   []*PeriodicJobUpsertParams
	Schema string
}

type PeriodicJobUpsertParams added in v0.23.0

type PeriodicJobUpsertParams struct {
	ID        string
	NextRunAt time.Time
	UpdatedAt time.Time
}

type Pilot

type Pilot interface {
	PilotPeriodicJob

	JobGetAvailable(
		ctx context.Context,
		exec riverdriver.Executor,
		state ProducerState,
		params *riverdriver.JobGetAvailableParams,
	) ([]*rivertype.JobRow, error)

	JobInsertMany(
		ctx context.Context,
		execTx riverdriver.ExecutorTx,
		params *riverdriver.JobInsertFastManyParams,
	) ([]*riverdriver.JobInsertFastResult, error)

	JobSetStateIfRunningMany(ctx context.Context, execTx riverdriver.ExecutorTx, params *riverdriver.JobSetStateIfRunningManyParams) ([]*rivertype.JobRow, error)

	PilotInit(archetype *baseservice.Archetype)

	// ProducerInit is called when a producer is started. It should return the ID
	// of the new producer, a new state object that will be used to track the
	// producer's state, and an error if the producer could not be initialized.
	ProducerInit(ctx context.Context, exec riverdriver.Executor, params *ProducerInitParams) (int64, ProducerState, error)

	ProducerKeepAlive(ctx context.Context, exec riverdriver.Executor, params *riverdriver.ProducerKeepAliveParams) error

	ProducerShutdown(ctx context.Context, exec riverdriver.Executor, params *ProducerShutdownParams) error

	QueueMetadataChanged(ctx context.Context, exec riverdriver.Executor, params *QueueMetadataChangedParams) error
}

A Pilot bridges the gap between the River client and the driver, implementing higher level functionality on top of the driver's underlying queries. It tracks closely to the underlying driver's API, but may add additional functionality or logic wrapping the queries.

This should be considered a River internal API and its stability is not guaranteed. DO NOT USE.

type PilotPeriodicJob added in v0.23.0

type PilotPeriodicJob interface {
	// PeriodicJobGetAll gets all currently known periodic jobs.
	//
	// API is not stable. DO NOT USE.
	PeriodicJobGetAll(ctx context.Context, exec riverdriver.Executor, params *PeriodicJobGetAllParams) ([]*PeriodicJob, error)

	// PeriodicJobTouchMany updates the `updated_at` timestamp on many jobs at
	// once to keep them alive and reaps any jobs that haven't been seen in some
	// time.
	//
	// API is not stable. DO NOT USE.
	PeriodicJobKeepAliveAndReap(ctx context.Context, exec riverdriver.Executor, params *PeriodicJobKeepAliveAndReapParams) ([]*PeriodicJob, error)

	// PeriodicJobUpsertMany upserts many periodic jobs.
	//
	// API is not stable. DO NOT USE.
	PeriodicJobUpsertMany(ctx context.Context, exec riverdriver.Executor, params *PeriodicJobUpsertManyParams) ([]*PeriodicJob, error)
}

PilotPeriodicJob contains pilot functions related to periodic jobs. This is extracted as its own interface so there's less surface area to mock in places like the periodic job enqueuer where that's needed.

type ProducerInitParams added in v0.20.0

type ProducerInitParams struct {
	ClientID   string
	ProducerID int64
	Queue      string
	Schema     string
}

type ProducerShutdownParams added in v0.21.0

type ProducerShutdownParams struct {
	ProducerID int64
	Queue      string
	Schema     string
}

type ProducerState added in v0.20.0

type ProducerState interface {
	JobFinish(job *rivertype.JobRow)
}

type QueueMetadataChangedParams added in v0.21.0

type QueueMetadataChangedParams struct {
	Queue    string
	Metadata []byte
}

type StandardPilot

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

func (*StandardPilot) JobGetAvailable added in v0.20.0

func (*StandardPilot) JobInsertMany

func (*StandardPilot) JobSetStateIfRunningMany

func (p *StandardPilot) JobSetStateIfRunningMany(ctx context.Context, execTx riverdriver.ExecutorTx, params *riverdriver.JobSetStateIfRunningManyParams) ([]*rivertype.JobRow, error)

func (*StandardPilot) PeriodicJobGetAll added in v0.23.0

func (p *StandardPilot) PeriodicJobGetAll(ctx context.Context, exec riverdriver.Executor, params *PeriodicJobGetAllParams) ([]*PeriodicJob, error)

func (*StandardPilot) PeriodicJobKeepAliveAndReap added in v0.23.0

func (p *StandardPilot) PeriodicJobKeepAliveAndReap(ctx context.Context, exec riverdriver.Executor, params *PeriodicJobKeepAliveAndReapParams) ([]*PeriodicJob, error)

func (*StandardPilot) PeriodicJobUpsertMany added in v0.23.0

func (p *StandardPilot) PeriodicJobUpsertMany(ctx context.Context, exec riverdriver.Executor, params *PeriodicJobUpsertManyParams) ([]*PeriodicJob, error)

func (*StandardPilot) PilotInit

func (p *StandardPilot) PilotInit(archetype *baseservice.Archetype)

func (*StandardPilot) ProducerInit added in v0.20.0

func (*StandardPilot) ProducerKeepAlive added in v0.20.0

func (p *StandardPilot) ProducerKeepAlive(ctx context.Context, exec riverdriver.Executor, params *riverdriver.ProducerKeepAliveParams) error

func (*StandardPilot) ProducerShutdown added in v0.20.0

func (p *StandardPilot) ProducerShutdown(ctx context.Context, exec riverdriver.Executor, params *ProducerShutdownParams) error

func (*StandardPilot) QueueMetadataChanged added in v0.20.0

func (p *StandardPilot) QueueMetadataChanged(ctx context.Context, exec riverdriver.Executor, params *QueueMetadataChangedParams) error

Jump to

Keyboard shortcuts

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