River

driver

package module
v0.6.0 Go to latest
Published: Nov 3, 2024 License: Proprietary

Index

Constants

const (
	MigrationLineSequence = "sequence"
	MigrationLineWorkflow = "workflow"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	SequenceSchedulerInterval time.Duration
	WorkflowRescuerInterval   time.Duration
}

type ProDriver

type ProDriver[TTx any] interface {
	riverdriver.Driver[TTx]

	GetProExecutor() ProExecutor
	ProConfigInit(pilot riverpilot.Pilot, config *Config)
	UnwrapProExecutor(tx TTx) ProExecutorTx
}

type ProExecutor

type ProExecutor interface {
	riverdriver.Executor

	// BeginPro begins a new subtransaction returning a ProExecutorTx.
	// ErrSubTxNotSupported may be returned if the executor is a transaction and
	// the driver doesn't support subtransactions (like
	// riverdriver/riverdatabasesql for database/sql).
	BeginPro(ctx context.Context) (ProExecutorTx, error)

	SequenceAppendMany(ctx context.Context, seqKeys []string) (int, error)
	SequenceList(ctx context.Context, count int) ([]*Sequence, error)
	// SequencePromote promotes the sequences with the given keys. It returns the
	// keys of the sequences which were actually promoted.
	SequencePromote(ctx context.Context, params *SequencePromoteParams) ([]string, error)
	// SequencePromoteFromTable promotes sequences from the river_job_sequence
	// table. It returns the keys of the sequences which were actually promoted.
	SequencePromoteFromTable(ctx context.Context, params *SequencePromoteFromTableParams) (*SequencePromoteFromTableResult, error)
	SequenceScanAndPromoteStalled(ctx context.Context, params *SequenceScanAndPromoteStalledParams) (*SequenceScanAndPromoteStalledResult, error)
	WorkflowCancel(ctx context.Context, params *WorkflowCancelParams) ([]*rivertype.JobRow, error)
	WorkflowLoadTasksByNames(ctx context.Context, params *WorkflowLoadTasksByNamesParams) ([]*WorkflowTask, error)
}

type ProExecutorTx

type ProExecutorTx interface {
	ProExecutor
	riverdriver.ExecutorTx
}

type Sequence

type Sequence struct {
	ID        int64
	Key       string
	CreatedAt time.Time
}

type SequencePromoteFromTableParams

type SequencePromoteFromTableParams struct {
	GracePeriod time.Duration
	Max         int
	Now         *time.Time
}

type SequencePromoteFromTableResult

type SequencePromoteFromTableResult struct {
	Continue     bool
	NumDeleted   int
	PromotedKeys []string
}

type SequencePromoteParams

type SequencePromoteParams struct {
	GracePeriod time.Duration
	Keys        []string
	Now         *time.Time
}

type SequenceScanAndPromoteStalledParams

type SequenceScanAndPromoteStalledParams struct {
	GracePeriod     time.Duration
	LastSequenceKey string
	Max             int
	Now             *time.Time
}

type SequenceScanAndPromoteStalledResult

type SequenceScanAndPromoteStalledResult struct {
	Continue   bool
	LastSeqKey string
}

type WorkflowCancelParams

type WorkflowCancelParams struct {
	CancelAttemptedAt time.Time
	ControlTopic      string
	WorkflowID        string
}

type WorkflowLoadTasksByNamesParams

type WorkflowLoadTasksByNamesParams struct {
	TaskNames  []string
	WorkflowID string
}

type WorkflowTask

type WorkflowTask struct {
	Deps       []string
	ID         int64
	State      rivertype.JobState
	Task       string
	WorkflowID string
}

Directories

riverpropgxv5 module