executionrequests

package
v0.0.0-...-d0e4e00 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeliverySnapshot

type DeliverySnapshot struct {
	Request    Request
	CreatedAt  time.Time
	ObservedAt time.Time
}

type DispatchAuthority

type DispatchAuthority struct {
	ClaimToken                     uuid.UUID
	RequestID                      uuid.UUID
	Organization, DataSource, Type string
	Config                         []byte
	CredentialSlug                 *string
	CredentialUpdatedAt            *time.Time
	ReadOnly                       bool
}

type Metrics

type Metrics struct {
	PendingCount            int64
	RunningCount            int64
	OldestPendingAgeSeconds float64
	ConnectorActiveCount    int64
	ConnectorQueuedCount    int64
}

type Repository

type Repository struct{}

func New

func New() Repository

func (Repository) BindSource

func (Repository) BindSource(ctx context.Context, db postgres.DBTX, id uuid.UUID, org string, source slug.Slug) error

func (Repository) BindUser

func (Repository) BindUser(ctx context.Context, tx postgres.DBTX, id uuid.UUID, org string, user slug.Slug) error

BindUser serializes admission with account removal. The service keeps this lock and the new request in the same transaction until dispatch is committed.

func (Repository) Cancel

func (Repository) Cancel(ctx context.Context, db postgres.DBTX, id uuid.UUID) (bool, error)

func (Repository) CheckDispatch

func (Repository) CheckDispatch(ctx context.Context, db postgres.DBTX, expected DispatchAuthority) (bool, error)

CheckDispatch exposes only authority for the claimed UUID, never source data.

func (Repository) Claim

func (Repository) Claim(ctx context.Context, db postgres.DBTX, id uuid.UUID) (Request, bool, error)

func (Repository) ClaimNext

func (Repository) ClaimNext(ctx context.Context, db postgres.DBTX) (Request, bool, error)

ClaimNext obtains the next opaque execution capability through a SECURITY DEFINER function. The executor role has no direct table access.

func (Repository) Complete

func (Repository) Complete(ctx context.Context, db postgres.DBTX, id, claimToken uuid.UUID, result []byte, succeeded bool) error

func (Repository) Create

func (Repository) Create(ctx context.Context, tx postgres.DBTX, request Request, expiresAt time.Time) error

func (Repository) DeleteExpired

func (Repository) DeleteExpired(ctx context.Context, db postgres.DBTX) (int64, error)

DeleteExpired expires encrypted envelopes while retaining unresolved processing metadata. Its count includes only deleted rows, not scrubbed payloads. It runs on the control-plane connection; executors have no table DELETE privilege.

func (Repository) Find

func (Repository) Find(ctx context.Context, db postgres.DBTX, id uuid.UUID, organizationSlug string) (Request, error)

func (Repository) FindForDelivery

func (Repository) FindForDelivery(
	ctx context.Context,
	db postgres.DBTX,
	id uuid.UUID,
) (DeliverySnapshot, bool, error)

FindForDelivery locks one opaque River delivery so the service can decide its disposition without racing another claimant.

func (Repository) Heartbeat

func (Repository) Heartbeat(ctx context.Context, db postgres.DBTX, id, claimToken uuid.UUID) (bool, error)

Heartbeat renews the scoped capability and reports cancellation/deadline.

func (Repository) LockInitiatingAccount

func (Repository) LockInitiatingAccount(ctx context.Context, tx postgres.DBTX, user slug.Slug) error

func (Repository) Metrics

func (Repository) Metrics(ctx context.Context, db postgres.DBTX) (Metrics, error)

Metrics reads only fixed queue aggregates through the executor capability.

func (Repository) Preflight

func (Repository) Preflight(ctx context.Context, db postgres.DBTX) error

Preflight verifies the executor's complete capability set without claiming or mutating work. Missing migration/functions or grants fail startup closed.

func (Repository) PreflightDelivery

func (Repository) PreflightDelivery(ctx context.Context, db postgres.DBTX) error

PreflightDelivery verifies the app worker can claim one opaque River delivery and then heartbeat and complete the resulting request.

type Request

type Request struct {
	ClaimToken        uuid.UUID
	ObservedAt        time.Time
	ObservedLocallyAt time.Time
	ID                uuid.UUID
	OrganizationSlug  string
	DataSourceSlug    string
	Kind              string
	State             State
	RequestCiphertext []byte
	ResultCiphertext  []byte
	DeadlineAt        time.Time
	CancelRequestedAt *time.Time
	LeaseExpiresAt    *time.Time
	QueueDeadlineAt   *time.Time
	ConcurrencyLimit  int
	QueueCapacity     int
}

type State

type State string
const (
	StatePending   State = "pending"
	StateRunning   State = "running"
	StateSucceeded State = "succeeded"
	StateFailed    State = "failed"
	StateCancelled State = "cancelled"
	StateAmbiguous State = "ambiguous"
)

Jump to

Keyboard shortcuts

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