sqlite

package
v0.0.41 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ConfigurationLimits jobdb.ConfigurationLimits
	// SecretProvider is independent of job storage and remains caller-owned.
	// If nil, a development store opens at <main database>.secrets.db (or in memory).
	SecretProvider jobdb.SecretProvider
	SecretLimits   jobdb.SecretLimits
	// DSN is passed to modernc.org/sqlite. If empty, DBPath is used.
	DSN string
	// DBPath is the durable SQLite database path used when DSN is empty.
	DBPath string
	// BlobDir stores large chapter artifacts on local blobfs. If empty, it is derived from DBPath.
	BlobDir string
	// BlobStoreURI is a blob bucket URL for large chapter artifacts. If set, it overrides BlobDir.
	// blobfs:// is supported by default. Other schemes require an explicit provider import.
	BlobStoreURI string
	// MaxInlineArtifactBytes controls when artifacts move from rows to blobstore.
	MaxInlineArtifactBytes int64
	// Logger is used for runtime diagnostics.
	Logger *slog.Logger
	// WorkerID overrides the runtime's fallback worker id.
	WorkerID string
}

Config describes a local SQLite-backed jobdb runtime.

type EmbeddedRuntime

type EmbeddedRuntime struct {
	Runtime *Runtime
	// contains filtered or unexported fields
}

func StartEmbeddedRuntime

func StartEmbeddedRuntime(ctx context.Context) (*EmbeddedRuntime, error)

func (*EmbeddedRuntime) Shutdown

func (e *EmbeddedRuntime) Shutdown()

type Option

type Option func(*runtimeOptions)

Option customizes New.

func WithBlobStoreURI added in v0.0.10

func WithBlobStoreURI(uri string) Option

func WithConfigurationLimits added in v0.0.33

func WithConfigurationLimits(limits jobdb.ConfigurationLimits) Option

WithConfigurationLimits bounds tenant configuration reads and writes.

func WithLogger

func WithLogger(logger *slog.Logger) Option

func WithMaxInlineArtifactBytes added in v0.0.10

func WithMaxInlineArtifactBytes(limit int64) Option

func WithSecretLimits added in v0.0.30

func WithSecretLimits(limits jobdb.SecretLimits) Option

WithSecretLimits bounds provider calls and their results.

func WithSecretProvider added in v0.0.30

func WithSecretProvider(provider jobdb.SecretProvider) Option

WithSecretProvider sets a caller-owned provider independently of job storage.

func WithWorkerID

func WithWorkerID(workerID string) Option

type Runtime

type Runtime struct {
	*configuration.Service
	// contains filtered or unexported fields
}

Runtime is a SQLite WorkflowRuntime that composes scheduler rows, chapter rows, and Go CDK blob artifact storage.

func New

func New(db *sql.DB, opts ...Option) (*Runtime, error)

New builds a runtime around a caller-owned SQLite handle.

func NewFromConfig

func NewFromConfig(ctx context.Context, cfg Config) (*Runtime, error)

NewFromConfig opens a SQLite database, creates a chapter store over the same *sql.DB rowstore, and returns the composed runtime.

func (*Runtime) ArchiveJobSchema added in v0.0.9

func (r *Runtime) ArchiveJobSchema(ctx context.Context, key jobdb.JobSchemaKey) (jobdb.JobSchemaInfo, error)

func (*Runtime) ArchiveSchedule

func (r *Runtime) ArchiveSchedule(ctx context.Context, req jobdb.ScheduleMutationRequest) (jobdb.ScheduleInfo, error)

func (*Runtime) CancelJob

func (r *Runtime) CancelJob(ctx context.Context, req jobdb.CancelJobRequest) error

func (*Runtime) Close

func (r *Runtime) Close(ctx context.Context) error

Close releases runtime-owned resources, including the default secrets store. Caller-supplied database handles and secret providers remain open.

func (*Runtime) CompleteJobWithLeaseByID

func (r *Runtime) CompleteJobWithLeaseByID(ctx context.Context, jobKey jobdb.JobKey, leaseID string, workerID string, req jobdb.CompleteExecutionRequest) error

func (*Runtime) CompleteTaskIfWaiting

func (r *Runtime) CompleteTaskIfWaiting(ctx context.Context, req jobdb.CompleteTaskIfWaitingRequest) error

func (*Runtime) GetChapter

func (r *Runtime) GetChapter(ctx context.Context, ref jobdb.ChapterRef) (jobdb.Chapter, error)

func (*Runtime) GetConfiguration added in v0.0.33

func (*Runtime) GetJob

func (r *Runtime) GetJob(ctx context.Context, jobKey jobdb.JobKey) (jobdb.JobInfo, error)

func (*Runtime) GetJobLease

func (*Runtime) GetJobSchema added in v0.0.9

func (r *Runtime) GetJobSchema(ctx context.Context, key jobdb.JobSchemaKey) (jobdb.JobSchemaInfo, error)

func (*Runtime) GetSchedule

func (r *Runtime) GetSchedule(ctx context.Context, key jobdb.ScheduleKey) (jobdb.ScheduleInfo, error)

func (*Runtime) KeepAliveLeaseByID

func (r *Runtime) KeepAliveLeaseByID(ctx context.Context, jobKey jobdb.JobKey, leaseID string, workerID string, leaseDuration time.Duration) error

func (*Runtime) KeepAliveLeaseByIDWithExpiry

func (r *Runtime) KeepAliveLeaseByIDWithExpiry(ctx context.Context, jobKey jobdb.JobKey, leaseID string, workerID string, leaseDuration time.Duration) (time.Time, error)

func (*Runtime) ListChapters

func (r *Runtime) ListChapters(ctx context.Context, req jobdb.ListChaptersRequest) ([]jobdb.Chapter, error)

func (*Runtime) ListJobSchemas added in v0.0.9

func (*Runtime) ListJobs

func (*Runtime) ListSchedules

func (*Runtime) OpenArtifact

func (r *Runtime) OpenArtifact(ctx context.Context, ref jobdb.ArtifactRef) (jobdb.ArtifactReader, error)

func (*Runtime) PauseSchedule

func (*Runtime) PollWork

func (*Runtime) PutChapter

func (r *Runtime) PutChapter(ctx context.Context, req jobdb.PutChapterRequest) error

func (*Runtime) RegisterJobSchema added in v0.0.9

func (r *Runtime) RegisterJobSchema(ctx context.Context, req jobdb.RegisterJobSchemaRequest) (jobdb.JobSchemaInfo, error)

func (*Runtime) RemoveDevSecret added in v0.0.29

func (r *Runtime) RemoveDevSecret(ctx context.Context, tenant, name string) error

func (*Runtime) RenewExecutionLeaseByID added in v0.0.22

func (r *Runtime) RenewExecutionLeaseByID(ctx context.Context, key jobdb.JobKey, leaseID, workerID string, duration time.Duration) (jobdb.RenewableExecutionLease, error)

RenewExecutionLeaseByID renews an exact live lease and loads its execution snapshot.

func (*Runtime) RescheduleJobWithLeaseByID

func (r *Runtime) RescheduleJobWithLeaseByID(ctx context.Context, jobKey jobdb.JobKey, leaseID string, workerID string, req jobdb.RescheduleExecutionRequest) error

func (*Runtime) ResolveSecrets added in v0.0.29

ResolveSecrets accepts claims verified by the HTTP transport. Embedded workers use their issued lease's ResolveSecrets method instead of presenting raw IDs.

func (*Runtime) ResumeSchedule

func (*Runtime) SecretResolutionLimits added in v0.0.29

func (r *Runtime) SecretResolutionLimits() jobdb.SecretLimits

func (*Runtime) SetDevSecret added in v0.0.29

func (r *Runtime) SetDevSecret(ctx context.Context, tenant, name, value string) error

SetDevSecret and RemoveDevSecret are development administration operations. HTTP exposure is deliberately limited to runtimes implementing these methods.

func (*Runtime) SubmitJob

func (r *Runtime) SubmitJob(ctx context.Context, req jobdb.SubmitJobRequest) (jobdb.JobHandle, error)

func (*Runtime) SubmitJobWithLeaseByID added in v0.0.13

func (r *Runtime) SubmitJobWithLeaseByID(ctx context.Context, parentJobKey jobdb.JobKey, leaseID string, workerID string, req jobdb.SubmitJobRequest) (jobdb.JobHandle, error)

func (*Runtime) SubmitRestartJob

func (r *Runtime) SubmitRestartJob(ctx context.Context, req jobdb.SubmitRestartJobRequest) (jobdb.JobHandle, error)

func (*Runtime) SubmitRestartJobWithLeaseByID added in v0.0.13

func (r *Runtime) SubmitRestartJobWithLeaseByID(ctx context.Context, parentJobKey jobdb.JobKey, leaseID string, workerID string, req jobdb.SubmitRestartJobRequest) (jobdb.JobHandle, error)

func (*Runtime) TriggerSchedule

func (r *Runtime) TriggerSchedule(ctx context.Context, req jobdb.TriggerScheduleRequest) (jobdb.JobHandle, error)

func (*Runtime) UpsertSchedule

func (r *Runtime) UpsertSchedule(ctx context.Context, req jobdb.UpsertScheduleRequest) (jobdb.ScheduleInfo, error)

Jump to

Keyboard shortcuts

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