Documentation
¶
Overview ¶
Package memory implements an in-memory store for unit testing. Zero external dependencies.
Index ¶
- type Store
- func (m *Store) AbortBuildRetirement(ctx context.Context, r durable.BuildRetirementRequest) (durable.LifecycleReceipt, error)
- func (m *Store) AbortQueryRuntimeRemoval(ctx context.Context, r durable.AbortQueryRemovalRequest) (durable.LifecycleReceipt, error)
- func (m *Store) AckEvent(_ context.Context, eventID id.EventID) error
- func (m *Store) AcknowledgeDelivery(ctx context.Context, t durable.DeliveryToken, r durable.SinkReceipt) error
- func (m *Store) AcquireCronLock(_ context.Context, entryID id.CronID, workerID id.WorkerID, ttl time.Duration) (bool, error)
- func (m *Store) AcquireLeadership(_ context.Context, workerID id.WorkerID, ttl time.Duration) (bool, error)
- func (m *Store) AppendSecurityAudit(ctx context.Context, a durable.SecurityAudit) (durable.Delivery, error)
- func (m *Store) ApplyChildDelivery(ctx context.Context, r durable.ChildDeliveryRequest) (durable.ChildDeliveryReceipt, error)
- func (m *Store) ApplyExecutionTimeout(ctx context.Context, r durable.ExecutionTimeoutRequest) (durable.Receipt, error)
- func (m *Store) BeginBuildRetirement(ctx context.Context, r durable.BuildRetirementRequest) (durable.LifecycleReceipt, error)
- func (m *Store) BeginLegacyAttempt(ctx context.Context, a durable.SecurityAudit) (durable.LegacyAttempt, error)
- func (m *Store) BeginQueryRuntimeRemoval(ctx context.Context, r durable.BeginQueryRemovalRequest) (durable.LifecycleReceipt, error)
- func (m *Store) BindQueryRemovalCommit(ctx context.Context, r durable.QueryRemovalCommitRequest) (durable.QueryRemovalCommitReceipt, error)
- func (m *Store) BlockDelivery(ctx context.Context, t durable.DeliveryToken) error
- func (m *Store) CheckQueryRemovalCommit(ctx context.Context, q durable.QueryRemovalCommitLookup) (durable.QueryRemovalCommitStatus, error)
- func (m *Store) CheckQueryRuntimeRemoval(ctx context.Context, f durable.QueryRemovalFence) (durable.QueryRemovalFacts, error)
- func (m *Store) ClaimChildDelivery(ctx context.Context, r durable.ChildDeliveryClaimRequest) (*durable.ChildDelivery, error)
- func (m *Store) ClaimDeliveries(ctx context.Context, r durable.DeliveryClaim) ([]durable.DeliveryRecord, error)
- func (m *Store) ClaimExecutionTimeout(ctx context.Context, r durable.ExecutionTimeoutClaimRequest) (*durable.ExecutionTimeoutTask, error)
- func (m *Store) ClaimReplay(_ context.Context, entryID id.DLQID, jobID id.JobID) error
- func (m *Store) ClaimTask(ctx context.Context, r durable.ClaimRequest) (*durable.Task, error)
- func (m *Store) ClaimTimeoutTask(ctx context.Context, r durable.TimeoutClaimRequest) (*durable.Task, error)
- func (m *Store) Close() error
- func (m *Store) CloseQueryRemovalGuard(ctx context.Context, r durable.QueryRemovalGuardCloseRequest) (durable.QueryRemovalGuardCloseReceipt, error)
- func (m *Store) CommitTransition(ctx context.Context, r durable.CommitRequest) (durable.Receipt, error)
- func (m *Store) CompleteLegacyAttempt(ctx context.Context, o durable.LegacyOutcome) error
- func (m *Store) CountDLQ(_ context.Context) (int64, error)
- func (m *Store) CountDLQEntries(_ context.Context, opts dlq.CountOpts) (int64, error)
- func (m *Store) CountJobs(_ context.Context, opts job.CountOpts) (int64, error)
- func (m *Store) CountRuns(_ context.Context, opts workflow.CountRunsOpts) (int64, error)
- func (s *Store) CreateArtifact(_ context.Context, a *artifact.Artifact, link *artifact.Link) error
- func (m *Store) CreateRun(_ context.Context, run *workflow.Run) error
- func (m *Store) DeferWorkflowTask(ctx context.Context, r durable.WorkflowTaskDeferralRequest) (durable.WorkflowTaskDeferralReceipt, error)
- func (m *Store) DeleteCheckpointsAfter(_ context.Context, runID id.RunID, afterStep string) error
- func (m *Store) DeleteCron(_ context.Context, entryID id.CronID) error
- func (m *Store) DeleteDLQ(_ context.Context, entryID id.DLQID) error
- func (m *Store) DeleteJob(_ context.Context, jobID id.JobID) error
- func (m *Store) DeleteStaleWorkers(_ context.Context, threshold time.Duration) (int64, error)
- func (m *Store) DeliveryStatus(ctx context.Context, r durable.DeliveryStatusRequest) (durable.DeliveryStatus, error)
- func (m *Store) DequeueJobs(_ context.Context, opts job.DequeueOpts) ([]*job.Job, error)
- func (m *Store) DeregisterWorker(_ context.Context, workerID id.WorkerID) error
- func (m *Store) EnqueueJob(_ context.Context, j *job.Job) error
- func (m *Store) EnrollRetirement(ctx context.Context, r durable.RetirementEnrollmentRequest) (durable.LifecycleReceipt, error)
- func (m *Store) FinalizeBuildRetirement(ctx context.Context, r durable.BuildRetirementRequest) (durable.LifecycleReceipt, error)
- func (s *Store) FindArtifactByKey(_ context.Context, backend, bucket, key string) (*artifact.Artifact, error)
- func (s *Store) FindLinkByName(_ context.Context, owner artifact.OwnerRef, name string) (*artifact.Link, error)
- func (m *Store) FinishQueryRuntimeRemoval(ctx context.Context, r durable.FinishQueryRemovalRequest) (durable.LifecycleReceipt, error)
- func (s *Store) GetArtifact(_ context.Context, artifactID id.ArtifactID) (*artifact.Artifact, error)
- func (s *Store) GetArtifactRecord(_ context.Context, artifactID id.ArtifactID) (*artifact.Artifact, error)
- func (m *Store) GetCheckpoint(_ context.Context, runID id.RunID, stepName string) ([]byte, error)
- func (m *Store) GetChildDelivery(ctx context.Context, source durable.Key, id string) (durable.ChildDelivery, error)
- func (m *Store) GetChildExecution(ctx context.Context, parent durable.Key, commandID string) (durable.ChildExecution, error)
- func (m *Store) GetCron(_ context.Context, entryID id.CronID) (*cron.Entry, error)
- func (m *Store) GetDLQ(_ context.Context, entryID id.DLQID) (*dlq.Entry, error)
- func (m *Store) GetDLQByJobID(_ context.Context, jobID id.JobID) (*dlq.Entry, error)
- func (m *Store) GetExecution(ctx context.Context, key durable.Key) (durable.Execution, error)
- func (m *Store) GetJob(_ context.Context, jobID id.JobID) (*job.Job, error)
- func (m *Store) GetLeader(_ context.Context) (*cluster.Worker, error)
- func (m *Store) GetNamespace(ctx context.Context, installation, namespace string) (durable.NamespaceRecord, error)
- func (m *Store) GetParentExecution(ctx context.Context, child durable.Key) (durable.ChildExecution, error)
- func (m *Store) GetRun(_ context.Context, runID id.RunID) (*workflow.Run, error)
- func (m *Store) GetTask(ctx context.Context, key durable.Key, taskID string) (durable.Task, error)
- func (m *Store) GetWorker(_ context.Context, workerID id.WorkerID) (*cluster.Worker, error)
- func (m *Store) GetWorkflowTaskDeferral(ctx context.Context, key durable.Key, taskID string) (durable.WorkflowTaskDeferral, error)
- func (m *Store) HeartbeatJob(_ context.Context, jobID id.JobID, _ id.WorkerID) error
- func (m *Store) HeartbeatWorker(_ context.Context, workerID id.WorkerID) error
- func (m *Store) InspectBuildLifecycle(ctx context.Context, target durable.BuildTarget) (durable.BuildLifecycleFacts, error)
- func (m *Store) InspectCompatibility(ctx context.Context, target durable.NamespaceTarget) (durable.CompatibilityFacts, error)
- func (m *Store) InspectQueryRetention(ctx context.Context, target durable.BuildTarget) (durable.QueryRetentionFacts, error)
- func (s *Store) LinkArtifact(_ context.Context, link *artifact.Link) error
- func (s *Store) ListArtifacts(_ context.Context, opts artifact.ListOpts) ([]*artifact.Artifact, error)
- func (s *Store) ListArtifactsByOwner(_ context.Context, owner artifact.OwnerRef, role artifact.Role) ([]*artifact.Artifact, error)
- func (m *Store) ListArtifactsPage(_ context.Context, opts artifact.PageOpts) (artifact.Page, error)
- func (m *Store) ListCheckpoints(_ context.Context, runID id.RunID) ([]*workflow.Checkpoint, error)
- func (m *Store) ListChildDeliveries(ctx context.Context, source durable.Key, after string, limit int) ([]durable.ChildDelivery, error)
- func (m *Store) ListChildExecutions(ctx context.Context, parent durable.Key, after string, limit int) ([]durable.ChildExecution, error)
- func (m *Store) ListChildRuns(_ context.Context, parentRunID id.RunID) ([]*workflow.Run, error)
- func (m *Store) ListCrons(_ context.Context) ([]*cron.Entry, error)
- func (m *Store) ListDLQ(_ context.Context, opts dlq.ListOpts) ([]*dlq.Entry, error)
- func (m *Store) ListDLQPage(_ context.Context, opts dlq.PageOpts) (dlq.Page, error)
- func (m *Store) ListExecutions(ctx context.Context, r durable.ExecutionList) ([]durable.Execution, string, error)
- func (s *Store) ListJobUsage(_ context.Context, opts job.UsageListOpts) ([]*job.Usage, error)
- func (m *Store) ListJobs(_ context.Context, opts job.ListJobsOpts) (job.Page, error)
- func (m *Store) ListJobsByState(_ context.Context, state job.State, opts job.ListOpts) ([]*job.Job, error)
- func (s *Store) ListLinks(_ context.Context, owner artifact.OwnerRef) ([]*artifact.Link, error)
- func (m *Store) ListNamespaces(ctx context.Context, r durable.NamespaceList) ([]durable.NamespaceRecord, error)
- func (s *Store) ListPurgeable(_ context.Context, grace time.Duration, limit int) ([]*artifact.Artifact, error)
- func (m *Store) ListQueryRuntimes(ctx context.Context, r durable.QueryRuntimeList) (durable.QueryRuntimePage, error)
- func (m *Store) ListRuns(_ context.Context, opts workflow.ListOpts) ([]*workflow.Run, error)
- func (m *Store) ListRunsPage(_ context.Context, opts workflow.ListRunsPageOpts) (workflow.RunPage, error)
- func (m *Store) ListTasks(ctx context.Context, r durable.TaskList) ([]durable.Task, string, error)
- func (m *Store) ListWorkers(_ context.Context) ([]*cluster.Worker, error)
- func (m *Store) LookupLifecycleReceipt(ctx context.Context, q durable.LifecycleReceiptLookup) (durable.LifecycleReceipt, error)
- func (m *Store) LookupQueryRemovalGuardReceipt(ctx context.Context, q durable.QueryRemovalGuardReceiptLookup) (durable.QueryRemovalGuardReceipt, error)
- func (m *Store) LookupQueryRemovalRevalidation(ctx context.Context, q durable.QueryRemovalRevalidationLookup) (durable.QueryRemovalRevalidationMaterial, error)
- func (m *Store) LookupReceipt(ctx context.Context, r durable.ReceiptRequest) (durable.Receipt, bool, error)
- func (m *Store) Migrate(_ context.Context) error
- func (m *Store) Ping(_ context.Context) error
- func (m *Store) PublishEvent(_ context.Context, evt *event.Event) error
- func (s *Store) PurgeArtifact(_ context.Context, artifactID id.ArtifactID) error
- func (m *Store) PurgeDLQ(_ context.Context, before time.Time) (int64, error)
- func (s *Store) PurgeJobUsage(_ context.Context, before time.Time, limit int) (int64, error)
- func (m *Store) PushDLQ(_ context.Context, entry *dlq.Entry) error
- func (m *Store) ReadBuildFacts(ctx context.Context, namespace, build string) (durable.BuildFacts, error)
- func (m *Store) ReadDeliveryStatus(ctx context.Context, r durable.ScopedDeliveryStatus) (durable.DeliveryStatus, error)
- func (m *Store) ReadHistory(ctx context.Context, key durable.Key, after int64, limit int) ([]durable.Event, error)
- func (m *Store) ReapDeadWorkers(_ context.Context, threshold time.Duration) ([]*cluster.Worker, error)
- func (m *Store) ReapStaleJobs(_ context.Context, threshold time.Duration) ([]*job.Job, error)
- func (m *Store) ReclaimExpiredLeases(_ context.Context, limit int) ([]*job.Job, error)
- func (m *Store) RecordHeartbeat(ctx context.Context, r durable.HeartbeatRequest) (durable.Receipt, error)
- func (s *Store) RecordJobUsage(_ context.Context, u *job.Usage) error
- func (m *Store) RecordQueryRuntimeVerification(ctx context.Context, r durable.VerifyQueryRuntimeRequest) (durable.LifecycleReceipt, error)
- func (m *Store) RegisterBuild(ctx context.Context, r durable.RegisterBuildRequest) (durable.LifecycleReceipt, error)
- func (m *Store) RegisterCron(_ context.Context, entry *cron.Entry) error
- func (m *Store) RegisterNamespace(ctx context.Context, c durable.NamespaceConfig) (durable.NamespaceRecord, error)
- func (m *Store) RegisterQueryRuntime(ctx context.Context, r durable.RegisterQueryRuntimeRequest) (durable.LifecycleReceipt, error)
- func (m *Store) RegisterWorker(_ context.Context, w *cluster.Worker) error
- func (m *Store) ReleaseCronLock(_ context.Context, entryID id.CronID, workerID id.WorkerID) error
- func (m *Store) ReleaseReplay(_ context.Context, entryID id.DLQID, jobID id.JobID) error
- func (m *Store) RenewDelivery(ctx context.Context, t durable.DeliveryToken, ttl time.Duration) (time.Time, error)
- func (m *Store) RenewLeadership(_ context.Context, workerID id.WorkerID, ttl time.Duration) (bool, error)
- func (m *Store) RenewLease(_ context.Context, jobID id.JobID, workerID id.WorkerID, epoch int, ...) error
- func (m *Store) RenewTask(ctx context.Context, key durable.Key, token durable.TaskToken, ...) (time.Time, error)
- func (m *Store) ReopenRun(_ context.Context, runID id.RunID, expectedGeneration int64) error
- func (m *Store) ReplayDLQ(_ context.Context, entryID id.DLQID) error
- func (m *Store) RequestCancelExecution(ctx context.Context, r durable.CancelExecutionRequest) (durable.CancelExecutionReceipt, error)
- func (m *Store) RequestWorkerDrain(ctx context.Context, r durable.WorkerDrainRequest) (durable.LifecycleReceipt, error)
- func (m *Store) ResolveExecution(ctx context.Context, r durable.ExecutionTarget) (durable.Execution, error)
- func (m *Store) RetryDelivery(ctx context.Context, r durable.DeliveryRetry) error
- func (m *Store) RevalidateQueryRuntimeRemoval(ctx context.Context, r durable.QueryRemovalRevalidationRequest) (durable.QueryRemovalRevalidationReceipt, error)
- func (m *Store) SaveCheckpoint(_ context.Context, runID id.RunID, stepName string, data []byte) error
- func (m *Store) SetCronEnabled(_ context.Context, entryID id.CronID, enabled bool, nextRunAt *time.Time) error
- func (m *Store) SignalExecution(ctx context.Context, r durable.SignalRequest) (durable.SignalReceipt, error)
- func (m *Store) SignalWithStart(ctx context.Context, r durable.SignalWithStartRequest) (durable.SignalReceipt, error)
- func (m *Store) SignalWithStartOutcome(ctx context.Context, r durable.SignalWithStartRequest) (durable.SignalStartOutcome, error)
- func (m *Store) StartExecution(ctx context.Context, r durable.StartRequest) (durable.Receipt, error)
- func (m *Store) SubscribeEvent(ctx context.Context, name string, timeout time.Duration) (*event.Event, error)
- func (s *Store) SweepEphemeral(_ context.Context, opts artifact.SweepOpts) ([]*artifact.Artifact, error)
- func (s *Store) SweepOrphans(_ context.Context, cutoff time.Time, limit int) ([]*artifact.Artifact, error)
- func (m *Store) UnresolvedLegacyAttempts(ctx context.Context, r durable.LegacyAttemptList) ([]durable.LegacyAttempt, error)
- func (s *Store) UpdateArtifact(_ context.Context, a *artifact.Artifact) error
- func (m *Store) UpdateCronEntry(_ context.Context, entry *cron.Entry) error
- func (m *Store) UpdateCronLastRun(_ context.Context, entryID id.CronID, at time.Time) error
- func (m *Store) UpdateCronNextRun(_ context.Context, entryID id.CronID, nextRunAt time.Time) error
- func (m *Store) UpdateJob(_ context.Context, j *job.Job) error
- func (m *Store) UpdateLeasedJob(_ context.Context, j *job.Job, workerID id.WorkerID, epoch int) error
- func (m *Store) UpdateRun(_ context.Context, run *workflow.Run) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a fully in-memory implementation of store.Store. Safe for concurrent access. Intended for unit testing and development.
func (*Store) AbortBuildRetirement ¶
func (m *Store) AbortBuildRetirement(ctx context.Context, r durable.BuildRetirementRequest) (durable.LifecycleReceipt, error)
func (*Store) AbortQueryRuntimeRemoval ¶
func (m *Store) AbortQueryRuntimeRemoval(ctx context.Context, r durable.AbortQueryRemovalRequest) (durable.LifecycleReceipt, error)
func (*Store) AcknowledgeDelivery ¶
func (m *Store) AcknowledgeDelivery(ctx context.Context, t durable.DeliveryToken, r durable.SinkReceipt) error
func (*Store) AcquireCronLock ¶
func (m *Store) AcquireCronLock(_ context.Context, entryID id.CronID, workerID id.WorkerID, ttl time.Duration) (bool, error)
AcquireCronLock attempts to acquire a distributed lock for a cron entry.
func (*Store) AcquireLeadership ¶
func (m *Store) AcquireLeadership(_ context.Context, workerID id.WorkerID, ttl time.Duration) (bool, error)
AcquireLeadership attempts to become the cluster leader.
func (*Store) AppendSecurityAudit ¶
func (*Store) ApplyChildDelivery ¶
func (m *Store) ApplyChildDelivery(ctx context.Context, r durable.ChildDeliveryRequest) (durable.ChildDeliveryReceipt, error)
func (*Store) ApplyExecutionTimeout ¶
func (*Store) BeginBuildRetirement ¶
func (m *Store) BeginBuildRetirement(ctx context.Context, r durable.BuildRetirementRequest) (durable.LifecycleReceipt, error)
func (*Store) BeginLegacyAttempt ¶
func (m *Store) BeginLegacyAttempt(ctx context.Context, a durable.SecurityAudit) (durable.LegacyAttempt, error)
func (*Store) BeginQueryRuntimeRemoval ¶
func (m *Store) BeginQueryRuntimeRemoval(ctx context.Context, r durable.BeginQueryRemovalRequest) (durable.LifecycleReceipt, error)
func (*Store) BindQueryRemovalCommit ¶
func (m *Store) BindQueryRemovalCommit(ctx context.Context, r durable.QueryRemovalCommitRequest) (durable.QueryRemovalCommitReceipt, error)
BindQueryRemovalCommit records one external permission after fresh native checks.
func (*Store) BlockDelivery ¶
func (*Store) CheckQueryRemovalCommit ¶
func (m *Store) CheckQueryRemovalCommit(ctx context.Context, q durable.QueryRemovalCommitLookup) (durable.QueryRemovalCommitStatus, error)
CheckQueryRemovalCommit reports saved commitment and current guard observations.
func (*Store) CheckQueryRuntimeRemoval ¶
func (m *Store) CheckQueryRuntimeRemoval(ctx context.Context, f durable.QueryRemovalFence) (durable.QueryRemovalFacts, error)
func (*Store) ClaimChildDelivery ¶
func (m *Store) ClaimChildDelivery(ctx context.Context, r durable.ChildDeliveryClaimRequest) (*durable.ChildDelivery, error)
ClaimChildDelivery polls messages even when their source execution has closed.
func (*Store) ClaimDeliveries ¶
func (m *Store) ClaimDeliveries(ctx context.Context, r durable.DeliveryClaim) ([]durable.DeliveryRecord, error)
func (*Store) ClaimExecutionTimeout ¶
func (m *Store) ClaimExecutionTimeout(ctx context.Context, r durable.ExecutionTimeoutClaimRequest) (*durable.ExecutionTimeoutTask, error)
ClaimExecutionTimeout grants an expired run independently of its tasks/build.
func (*Store) ClaimReplay ¶
ClaimReplay marks an unreplayed entry replayed by jobID. The check and the write happen under one lock, so of two concurrent claims exactly one wins.
func (*Store) ClaimTimeoutTask ¶
func (m *Store) ClaimTimeoutTask(ctx context.Context, r durable.TimeoutClaimRequest) (*durable.Task, error)
ClaimTimeoutTask fences execution and grants independent timeout processing.
func (*Store) CloseQueryRemovalGuard ¶
func (m *Store) CloseQueryRemovalGuard(ctx context.Context, r durable.QueryRemovalGuardCloseRequest) (durable.QueryRemovalGuardCloseReceipt, error)
CloseQueryRemovalGuard releases pins only after authenticated complete cutoff.
func (*Store) CommitTransition ¶
func (*Store) CompleteLegacyAttempt ¶
func (*Store) CountDLQEntries ¶
CountDLQEntries counts dead letter entries under the given filters.
func (*Store) CreateArtifact ¶
CreateArtifact inserts an artifact and, when link is non-nil, its first link atomically under the store lock.
func (*Store) DeferWorkflowTask ¶
func (m *Store) DeferWorkflowTask(ctx context.Context, r durable.WorkflowTaskDeferralRequest) (durable.WorkflowTaskDeferralReceipt, error)
func (*Store) DeleteCheckpointsAfter ¶
DeleteCheckpointsAfter removes all checkpoints created after the given step name (by creation order). Used for workflow replay.
func (*Store) DeleteCron ¶
DeleteCron removes a cron entry by ID.
func (*Store) DeleteStaleWorkers ¶
DeleteStaleWorkers removes worker entries whose last-seen timestamp is older than the given threshold. Returns the number of entries removed.
func (*Store) DeliveryStatus ¶
func (m *Store) DeliveryStatus(ctx context.Context, r durable.DeliveryStatusRequest) (durable.DeliveryStatus, error)
func (*Store) DequeueJobs ¶
DequeueJobs atomically claims up to opts.Limit ready jobs from opts.Queues that fit opts, sets them to running, and returns them ordered by priority descending, then locality-preferred first, then RunAt ascending.
A non-positive Limit claims nothing: a worker computing zero free slots must claim zero jobs, matching the SQL backends' `LIMIT 0` behavior rather than reading zero as "unlimited". The fit predicate itself is job.DequeueOpts.Allows / Less, not reimplemented here, so this store stays the reference the SQL backends are checked against.
When opts.Grants() the claim also grants a lease, under the one write lock that already performs the claim. When it does not, the claim writes a running job with no lease at all, which is a supported shape rather than a broken one. Such a job is not invisible to ReclaimExpiredLeases: job.Lease.IsExpired still reports false for its zero expiry, but reclaim adopts it once it has gone silent for job.UnleasedReclaimGrace, so abandoning one no longer strands it for the life of the process. See job.DequeueOpts.LeaseUntil.
func (*Store) DeregisterWorker ¶
DeregisterWorker removes a worker from the cluster registry.
func (*Store) EnqueueJob ¶
EnqueueJob persists a new job in pending state.
func (*Store) EnrollRetirement ¶
func (m *Store) EnrollRetirement(ctx context.Context, r durable.RetirementEnrollmentRequest) (durable.LifecycleReceipt, error)
func (*Store) FinalizeBuildRetirement ¶
func (m *Store) FinalizeBuildRetirement(ctx context.Context, r durable.BuildRetirementRequest) (durable.LifecycleReceipt, error)
func (*Store) FindArtifactByKey ¶
func (s *Store) FindArtifactByKey(_ context.Context, backend, bucket, key string) (*artifact.Artifact, error)
FindArtifactByKey retrieves an artifact by its storage coordinates.
func (*Store) FindLinkByName ¶
func (s *Store) FindLinkByName(_ context.Context, owner artifact.OwnerRef, name string) (*artifact.Link, error)
FindLinkByName returns the link for an owner and name with the highest attempt number, breaking ties by CreatedAt descending — see the artifact.Store doc comment for why ties happen and what the tie-break does and does not fix.
func (*Store) FinishQueryRuntimeRemoval ¶
func (m *Store) FinishQueryRuntimeRemoval(ctx context.Context, r durable.FinishQueryRemovalRequest) (durable.LifecycleReceipt, error)
func (*Store) GetArtifact ¶
func (s *Store) GetArtifact(_ context.Context, artifactID id.ArtifactID) (*artifact.Artifact, error)
GetArtifact retrieves an artifact by ID, excluding soft-deleted ones.
func (*Store) GetArtifactRecord ¶
func (s *Store) GetArtifactRecord(_ context.Context, artifactID id.ArtifactID) (*artifact.Artifact, error)
GetArtifactRecord returns detached metadata even after soft deletion.
func (*Store) GetCheckpoint ¶
GetCheckpoint retrieves checkpoint data for a specific workflow step.
func (*Store) GetChildDelivery ¶
func (m *Store) GetChildDelivery(ctx context.Context, source durable.Key, id string) (durable.ChildDelivery, error)
GetChildDelivery returns an isolated view including its final disposition.
func (*Store) GetChildExecution ¶
func (m *Store) GetChildExecution(ctx context.Context, parent durable.Key, commandID string) (durable.ChildExecution, error)
GetChildExecution reads one parent's immutable child identity and current state.
func (*Store) GetDLQByJobID ¶
GetDLQByJobID returns the newest entry, by ID, for a failed job.
func (*Store) GetExecution ¶
GetExecution returns a copy of the namespace-qualified execution.
func (*Store) GetLeader ¶
GetLeader returns the current cluster leader, or nil if there is no leader.
func (*Store) GetNamespace ¶
func (*Store) GetParentExecution ¶
func (m *Store) GetParentExecution(ctx context.Context, child durable.Key) (durable.ChildExecution, error)
GetParentExecution reads a child's unique original parent relationship.
func (*Store) GetWorkflowTaskDeferral ¶
func (*Store) HeartbeatJob ¶
HeartbeatJob updates the heartbeat timestamp for a running job.
func (*Store) HeartbeatWorker ¶
HeartbeatWorker updates the last-seen timestamp for a worker.
func (*Store) InspectBuildLifecycle ¶
func (m *Store) InspectBuildLifecycle(ctx context.Context, target durable.BuildTarget) (durable.BuildLifecycleFacts, error)
func (*Store) InspectCompatibility ¶
func (m *Store) InspectCompatibility(ctx context.Context, target durable.NamespaceTarget) (durable.CompatibilityFacts, error)
func (*Store) InspectQueryRetention ¶
func (m *Store) InspectQueryRetention(ctx context.Context, target durable.BuildTarget) (durable.QueryRetentionFacts, error)
func (*Store) LinkArtifact ¶
LinkArtifact records that an owner references an artifact. Linking the same tuple twice is a no-op.
func (*Store) ListArtifacts ¶
func (s *Store) ListArtifacts(_ context.Context, opts artifact.ListOpts) ([]*artifact.Artifact, error)
ListArtifacts returns artifacts matching the given options, newest first.
func (*Store) ListArtifactsByOwner ¶
func (s *Store) ListArtifactsByOwner( _ context.Context, owner artifact.OwnerRef, role artifact.Role, ) ([]*artifact.Artifact, error)
ListArtifactsByOwner returns the artifacts linked to an owner, optionally filtered by role.
func (*Store) ListArtifactsPage ¶
ListArtifactsPage returns artifacts newest first by ID, filtered and paged.
func (*Store) ListCheckpoints ¶
ListCheckpoints returns all checkpoints for a workflow run.
func (*Store) ListChildDeliveries ¶
func (m *Store) ListChildDeliveries(ctx context.Context, source durable.Key, after string, limit int) ([]durable.ChildDelivery, error)
ListChildDeliveries pages by exclusive delivery ID, including completed rows.
func (*Store) ListChildExecutions ¶
func (m *Store) ListChildExecutions(ctx context.Context, parent durable.Key, after string, limit int) ([]durable.ChildExecution, error)
ListChildExecutions pages by command ID, with an exclusive cursor.
func (*Store) ListChildRuns ¶
ListChildRuns returns all child workflow runs for a parent.
func (*Store) ListDLQPage ¶
ListDLQPage returns dead letter entries newest first by ID, filtered and paged.
func (*Store) ListExecutions ¶
func (*Store) ListJobUsage ¶
ListJobUsage returns recorded attempts, most recent first.
func (*Store) ListJobsByState ¶
func (m *Store) ListJobsByState(_ context.Context, state job.State, opts job.ListOpts) ([]*job.Job, error)
ListJobsByState returns jobs matching the given state.
func (*Store) ListNamespaces ¶
func (m *Store) ListNamespaces(ctx context.Context, r durable.NamespaceList) ([]durable.NamespaceRecord, error)
func (*Store) ListPurgeable ¶
func (s *Store) ListPurgeable(_ context.Context, grace time.Duration, limit int) ([]*artifact.Artifact, error)
ListPurgeable returns soft-deleted artifacts older than grace.
func (*Store) ListQueryRuntimes ¶
func (m *Store) ListQueryRuntimes(ctx context.Context, r durable.QueryRuntimeList) (durable.QueryRuntimePage, error)
func (*Store) ListRunsPage ¶
func (m *Store) ListRunsPage(_ context.Context, opts workflow.ListRunsPageOpts) (workflow.RunPage, error)
ListRunsPage returns workflow runs newest first by ID, filtered and paged.
func (*Store) ListWorkers ¶
ListWorkers returns all registered workers.
func (*Store) LookupLifecycleReceipt ¶
func (m *Store) LookupLifecycleReceipt(ctx context.Context, q durable.LifecycleReceiptLookup) (durable.LifecycleReceipt, error)
func (*Store) LookupQueryRemovalGuardReceipt ¶
func (m *Store) LookupQueryRemovalGuardReceipt(ctx context.Context, q durable.QueryRemovalGuardReceiptLookup) (durable.QueryRemovalGuardReceipt, error)
LookupQueryRemovalGuardReceipt recovers one immutable command before host probes.
func (*Store) LookupQueryRemovalRevalidation ¶
func (m *Store) LookupQueryRemovalRevalidation(ctx context.Context, q durable.QueryRemovalRevalidationLookup) (durable.QueryRemovalRevalidationMaterial, error)
LookupQueryRemovalRevalidation recovers authenticated material without renewal.
func (*Store) LookupReceipt ¶
func (m *Store) LookupReceipt(ctx context.Context, r durable.ReceiptRequest) (durable.Receipt, bool, error)
LookupReceipt returns the original result only for the exact accepted intent.
func (*Store) PublishEvent ¶
PublishEvent persists a new event.
func (*Store) PurgeArtifact ¶
PurgeArtifact hard-deletes an artifact and its links.
func (*Store) PurgeJobUsage ¶
PurgeJobUsage deletes records older than before, up to limit rows.
func (*Store) PushDLQ ¶
PushDLQ adds a failed job entry to the dead letter queue. An ID that is already there is refused with dispatch.ErrDLQAlreadyExists rather than overwritten, which would silently drop a replay claim.
func (*Store) ReadBuildFacts ¶
func (*Store) ReadDeliveryStatus ¶
func (m *Store) ReadDeliveryStatus(ctx context.Context, r durable.ScopedDeliveryStatus) (durable.DeliveryStatus, error)
func (*Store) ReadHistory ¶
func (m *Store) ReadHistory(ctx context.Context, key durable.Key, after int64, limit int) ([]durable.Event, error)
ReadHistory reads a bounded page after an exclusive sequence cursor.
func (*Store) ReapDeadWorkers ¶
func (m *Store) ReapDeadWorkers(_ context.Context, threshold time.Duration) ([]*cluster.Worker, error)
ReapDeadWorkers returns workers whose last-seen timestamp is older than the given threshold.
func (*Store) ReapStaleJobs ¶
ReapStaleJobs returns running jobs whose last heartbeat — or, for jobs whose worker died before the first heartbeat, whose start time — is older than the given threshold.
func (*Store) ReclaimExpiredLeases ¶
ReclaimExpiredLeases returns expired-lease jobs to pending, fencing their previous holders.
A non-positive limit claims nothing, matching DequeueOpts.Limit's behavior rather than reading zero or negative as unlimited.
func (*Store) RecordHeartbeat ¶
func (*Store) RecordJobUsage ¶
RecordJobUsage persists one attempt's measurements.
func (*Store) RecordQueryRuntimeVerification ¶
func (m *Store) RecordQueryRuntimeVerification(ctx context.Context, r durable.VerifyQueryRuntimeRequest) (durable.LifecycleReceipt, error)
func (*Store) RegisterBuild ¶
func (m *Store) RegisterBuild(ctx context.Context, r durable.RegisterBuildRequest) (durable.LifecycleReceipt, error)
func (*Store) RegisterCron ¶
RegisterCron persists a new cron entry. Returns an error if the name already exists.
func (*Store) RegisterNamespace ¶
func (m *Store) RegisterNamespace(ctx context.Context, c durable.NamespaceConfig) (durable.NamespaceRecord, error)
func (*Store) RegisterQueryRuntime ¶
func (m *Store) RegisterQueryRuntime(ctx context.Context, r durable.RegisterQueryRuntimeRequest) (durable.LifecycleReceipt, error)
func (*Store) RegisterWorker ¶
RegisterWorker adds a worker to the cluster registry, replacing any existing entry with the same ID.
func (*Store) ReleaseCronLock ¶
ReleaseCronLock releases the distributed lock for a cron entry.
func (*Store) ReleaseReplay ¶
ReleaseReplay undoes a claim, but only the one jobID made.
func (*Store) RenewDelivery ¶
func (*Store) RenewLeadership ¶
func (m *Store) RenewLeadership(_ context.Context, workerID id.WorkerID, ttl time.Duration) (bool, error)
RenewLeadership extends the leader's hold.
func (*Store) RenewLease ¶
func (m *Store) RenewLease( _ context.Context, jobID id.JobID, workerID id.WorkerID, epoch int, leaseUntil time.Time, ) error
RenewLease extends the lease only if the caller still holds it.
func (*Store) RenewTask ¶
func (m *Store) RenewTask(ctx context.Context, key durable.Key, token durable.TaskToken, ttl time.Duration) (time.Time, error)
RenewTask extends only a current, unexpired task lease.
func (*Store) ReopenRun ¶
ReopenRun moves a finished run back to running. The check and the write happen under one lock, so of two concurrent reopens exactly one wins.
func (*Store) RequestCancelExecution ¶
func (m *Store) RequestCancelExecution(ctx context.Context, r durable.CancelExecutionRequest) (durable.CancelExecutionReceipt, error)
func (*Store) RequestWorkerDrain ¶
func (m *Store) RequestWorkerDrain(ctx context.Context, r durable.WorkerDrainRequest) (durable.LifecycleReceipt, error)
func (*Store) ResolveExecution ¶
func (m *Store) ResolveExecution(ctx context.Context, r durable.ExecutionTarget) (durable.Execution, error)
ResolveExecution copies one execution snapshot under the store read lock.
func (*Store) RetryDelivery ¶
func (*Store) RevalidateQueryRuntimeRemoval ¶
func (m *Store) RevalidateQueryRuntimeRemoval(ctx context.Context, r durable.QueryRemovalRevalidationRequest) (durable.QueryRemovalRevalidationReceipt, error)
RevalidateQueryRuntimeRemoval atomically protects all selected associations.
func (*Store) SaveCheckpoint ¶
func (m *Store) SaveCheckpoint(_ context.Context, runID id.RunID, stepName string, data []byte) error
SaveCheckpoint persists checkpoint data for a workflow step.
func (*Store) SetCronEnabled ¶
func (m *Store) SetCronEnabled(_ context.Context, entryID id.CronID, enabled bool, nextRunAt *time.Time) error
SetCronEnabled sets enabled, and next_run_at when one is given.
func (*Store) SignalExecution ¶
func (m *Store) SignalExecution(ctx context.Context, r durable.SignalRequest) (durable.SignalReceipt, error)
func (*Store) SignalWithStart ¶
func (m *Store) SignalWithStart(ctx context.Context, r durable.SignalWithStartRequest) (durable.SignalReceipt, error)
func (*Store) SignalWithStartOutcome ¶
func (m *Store) SignalWithStartOutcome(ctx context.Context, r durable.SignalWithStartRequest) (durable.SignalStartOutcome, error)
SignalWithStartOutcome preserves acceptance provenance within the audited lock.
func (*Store) StartExecution ¶
func (*Store) SubscribeEvent ¶
func (m *Store) SubscribeEvent(ctx context.Context, name string, timeout time.Duration) (*event.Event, error)
SubscribeEvent waits for an unacked event matching the given name. Poll-based: loops with 10ms sleep until an event is available or timeout.
func (*Store) SweepEphemeral ¶
func (s *Store) SweepEphemeral(_ context.Context, opts artifact.SweepOpts) ([]*artifact.Artifact, error)
SweepEphemeral marks eligible ephemeral artifacts as deleted.
An artifact is eligible when every owner that links it is terminal and the retention window has elapsed since the last of them finished. The lifecycle guard is the first statement of the loop body and is written as a literal, mirroring the SQL backends.
func (*Store) SweepOrphans ¶
func (s *Store) SweepOrphans(_ context.Context, cutoff time.Time, limit int) ([]*artifact.Artifact, error)
SweepOrphans marks ephemeral artifacts with no links at all that were created before the cutoff.
func (*Store) UnresolvedLegacyAttempts ¶
func (m *Store) UnresolvedLegacyAttempts(ctx context.Context, r durable.LegacyAttemptList) ([]durable.LegacyAttempt, error)
func (*Store) UpdateArtifact ¶
UpdateArtifact persists changes to size, hash, content type, and expiry. Lifecycle is deliberately not updatable.
func (*Store) UpdateCronEntry ¶
UpdateCronEntry updates a cron entry (Enabled, NextRunAt, etc.).
func (*Store) UpdateCronLastRun ¶
UpdateCronLastRun records when a cron entry last fired.
func (*Store) UpdateCronNextRun ¶
UpdateCronNextRun sets next_run_at and nothing else the scheduler does not own.
func (*Store) UpdateLeasedJob ¶
func (m *Store) UpdateLeasedJob(_ context.Context, j *job.Job, workerID id.WorkerID, epoch int) error
UpdateLeasedJob persists j only while the caller still holds the lease — still running, still assigned to workerID, still at epoch. Otherwise it returns job.ErrLeaseLost and leaves the stored job untouched.
Only the business fields move. lease_epoch, lease_expires_at, worker_id, and heartbeat_at are copied from the CURRENTLY STORED job, never from j: j is the caller's stale snapshot, and every renewal since it was taken has pushed the real expiry forward. Overwriting that with j's copy would roll the winner's lease backwards even though the epoch check passed — see job.LeaseStore.UpdateLeasedJob.
Source Files
¶
- artifact.go
- artifact_record.go
- doc.go
- durable.go
- durable_build_lifecycle.go
- durable_cancellation.go
- durable_child_delivery.go
- durable_children.go
- durable_continuation.go
- durable_execution_target.go
- durable_execution_timeout.go
- durable_heartbeat.go
- durable_lifecycle.go
- durable_namespace.go
- durable_outbox.go
- durable_outbox_mutation.go
- durable_query_removal_revalidation.go
- durable_query_retention.go
- durable_read.go
- durable_receipt.go
- durable_signal.go
- durable_task_deferral.go
- durable_worker_drain.go
- lease.go
- legacy_audit.go
- list.go
- operator.go
- store.go
- usage.go