Documentation
¶
Overview ¶
Package provenance provides a task dependency tracker for multi-agent workflows.
Provenance replaces Beads (bd) as the task dependency tracker for the Aura Protocol agent system. It tracks work products, their dependencies, and their provenance across multi-agent planning and implementation workflows.
The package exposes a Tracker interface with methods to create, retrieve, update, and delete tasks. It also supports edges (dependencies), comments, and labels on tasks.
All entity IDs follow the format {Namespace}--{UUIDv7} for scoping and global uniqueness.
DBOS durable-execution adapter (issue dayvidpham/provenance#6) ¶
NewDBOSAdapter runs a Provenance operation as a deterministic DBOS workflow whose single step is the atomic journal fold, binding the workflow/step guards and restart semantics to the SAME OperationID alternate key and journal contract (no parallel commit ledger). OpenBorrowedSQLite shares one physical SQLite database with a DBOS root.
Host obligations on the borrowed path ¶
A host that builds its own DBOS root (NewHostBoundGovernedAllocator, NewDBOSAdapter) owns two steps that Provenance cannot take for it:
- The binary must blank-import "github.com/dbos-inc/dbos-transact-golang/dbos/driver/sqlite". The DBOS runtime keeps no SQLite driver of its own and uses whichever driver that import registers, even for a caller-supplied handle.
- RequireSupportedDBOSSystemSchema must be called on the exact *sql.DB before the root is built, by either dbos.NewContext or dbos.NewClient (which builds a context of its own). Both migrate a superseded system database in place during construction, and this build supports no in-place upgrade, so no later moment can refuse one.
The factory-owned constructors (OpenBoundGovernedAllocator, OpenFusedGovernedAllocator) take both steps themselves.
OpenBorrowedSQLite uses the exact caller-owned database/sql pool for both DBOS and Provenance. Provenance never closes that pool; a Ping liveness sentinel makes post-shutdown access return StoreUnavailableError. See dbos_store.go for the borrowed-store lifecycle details.
Index ¶
- Constants
- Variables
- func DefaultModelRegistry() ptypes.ModelRegistry
- func EnsureSchemaInTx(ctx context.Context, tx *sql.Tx, models []ModelEntry) error
- func NewRegistry(entries []ModelEntry) ptypes.ModelRegistry
- func PauseForeignKeys(ctx context.Context, conn *sql.Conn) (func(error) error, error)
- func PublishIDFormatInTx(ctx context.Context, tx *sql.Tx) error
- func RegistryFromBestiary(models []bestiary.ModelInfo) ptypes.ModelRegistry
- func RequireSupportedDBOSSystemSchema(ctx context.Context, systemDB *sql.DB, origin string) error
- func VerifyIDConversionInTx(ctx context.Context, tx *sql.Tx) error
- type Activity
- type ActivityConflict
- type ActivityID
- type ActorID
- type ActorNamespaceClaim
- type ActorOwnershipIntegrityError
- type ActorOwnershipLimitError
- type ActorOwnershipQuery
- type ActorOwnershipQueryAPI
- type ActorOwnershipSnapshot
- type ActorOwnershipStage
- type ActorOwnershipWork
- type Agent
- type AgentID
- type AgentKind
- type AmbiguousApplyFailureError
- type AppendTaskEventInput
- type ApplyFailureKind
- type ApplyOption
- type ApplyWaitCanceledError
- type AssignmentActiveAssertion
- type AssignmentID
- type AssignmentSlotID
- type AssignmentStartCursor
- type AssignmentStartPage
- type AssignmentStartPageRequest
- type AssignmentStartQuery
- type AssignmentStartQueryAPI
- type AssignmentStartRow
- type AssignmentTransferRequest
- type AssignmentTransferResult
- type AssignmentTransition
- type AuthorityKind
- type BatchApplyError
- type BatchJournal
- type BatchRecordOutcome
- type BatchRecordResult
- type BatchResult
- type BoundGovernedAllocator
- func (a *BoundGovernedAllocator) Close(timeout time.Duration) error
- func (a *BoundGovernedAllocator) Launch() error
- func (a *BoundGovernedAllocator) RunAllocateComposed(ctx context.Context, workflowID string, authority JournalID, ...) (GovernedAllocationComposedResult, error)
- func (a *BoundGovernedAllocator) RunAllocateComposedBatch(ctx context.Context, workflowID string, authority JournalID, ...) (GovernedAllocationComposedResult, error)
- func (a *BoundGovernedAllocator) RunInitializeRoot(ctx context.Context, workflowID string, request RootGenesisRequest) (OperationClosure, error)
- func (a *BoundGovernedAllocator) Tracker() Tracker
- type CanonicalApplyFailure
- type CanonicalMutation
- type CanonicalMutationError
- type CanonicalMutationResult
- type CanonicalResultSlot
- type CheckpointDivergenceError
- type Comment
- type CommentID
- type CommittedResult
- type CommittedResultKind
- type Condition
- type ConditionFailure
- type ConditionFailureReason
- type ConditionKind
- type ConflictAxis
- type ContextJournal
- type DBOSAdapter
- type DBOSAdapterConfig
- type DBOSApplyInput
- type DBOSConfigError
- type DBOSContextFrameError
- type DBOSDiagnosticClass
- type DBOSDiagnosticError
- type DBOSDiagnosticField
- type DBOSDiagnosticStage
- type DBOSMutationBytes
- type DBOSOperationContextBytes
- type DBOSStepOptions
- type DBOSStepOutcome
- type DecisionKind
- type DecisionPage
- type DecisionQuery
- type DecisionRow
- type Edge
- type EdgeKind
- type Effect
- type EffectSort
- type EventContext
- type EventContextKind
- type EventKind
- type EvidenceKind
- type EvidencePage
- type EvidenceQuery
- type EvidenceRow
- type FactCursor
- type FactFilter
- type FactKind
- type FactPageRequest
- type FactQueryAPI
- type FactSelector
- type FactTaskScope
- type FactTaskScopeKind
- type FixedActorEntry
- type FixedSoftwareAgentRegistrarContext
- type FixedSoftwareAgentRegistration
- type FusedGovernedAllocator
- func (a *FusedGovernedAllocator) Close(timeout time.Duration) error
- func (a *FusedGovernedAllocator) ConfigName() string
- func (a *FusedGovernedAllocator) Launch() error
- func (a *FusedGovernedAllocator) RunAllocate(ctx context.Context, workflowID string, authority JournalID, ...) (OperationClosure, error)
- func (a *FusedGovernedAllocator) RunAllocateComposed(ctx context.Context, workflowID string, authority JournalID, ...) (GovernedAllocationComposedResult, error)
- func (a *FusedGovernedAllocator) RunAllocateComposedBatch(ctx context.Context, workflowID string, authority JournalID, ...) (GovernedAllocationComposedResult, error)
- func (a *FusedGovernedAllocator) RunInitializeRoot(ctx context.Context, workflowID string, request RootGenesisRequest) (OperationClosure, error)
- func (a *FusedGovernedAllocator) Tracker() Tracker
- type FusedGovernedAllocatorConfig
- type GitOID
- type GovernedAllocationComposedRequest
- type GovernedAllocationComposedResult
- type GovernedAllocationCompositionVersion
- type GovernedAllocationError
- type GovernedAllocationErrorKind
- type GovernedAllocationParticipant
- type GovernedAllocationReferenceScope
- type GovernedAllocationReferenceScopeKind
- type GovernedAllocationRequest
- type GovernedAllocationSQLResult
- type GovernedAllocationSQLRow
- type GovernedAllocationSQLRows
- type GovernedAllocationTransaction
- type GovernedChildBinding
- type GovernedChildSpec
- type GovernedProducedRow
- type GovernedRequestKind
- type HostBoundGovernedAllocator
- func (a *HostBoundGovernedAllocator) RunAllocateComposed(ctx context.Context, workflowID string, authority JournalID, ...) (GovernedAllocationComposedResult, error)
- func (a *HostBoundGovernedAllocator) RunAllocateComposedBatch(ctx context.Context, workflowID string, authority JournalID, ...) (GovernedAllocationComposedResult, error)
- func (a *HostBoundGovernedAllocator) RunInitializeRoot(ctx context.Context, workflowID string, request RootGenesisRequest) (OperationClosure, error)
- type HumanAgent
- type IDConversionOptions
- type IDConversionReport
- type IDFormat
- type IDFormatInspection
- type IDFormatReader
- type InvalidStatusTransition
- type Journal
- type JournalCursorV1
- type JournalID
- type JournalKind
- type JournalQueryV1
- type JournalTaskEventPageV1
- type Label
- type LegacyTaskRow
- type ListFilter
- type MLAgent
- type MLModel
- type MigrationInput
- type MigrationOwnerUnmappableError
- type MigrationResult
- type ModelEntry
- type ModelID
- type ModelRegistry
- type MutationEncodingVersion
- type NamespaceCodec
- type Operation
- func (o *Operation) Add(e Effect) *Operation
- func (o *Operation) CreateTask(id TaskID, title, description string, taskType TaskType, priority Priority, ...) *Operation
- func (o *Operation) Emit(id TaskID, kind EventKind, payload json.RawMessage) *Operation
- func (o *Operation) EndEpisode(assignment AssignmentID, task TaskID) *Operation
- func (o *Operation) StartEpisode(assignment AssignmentID, task TaskID, occupant ActorID) *Operation
- type OperationAuthorityID
- type OperationClosure
- type OperationConflict
- type OperationID
- type OperationInput
- type Option
- type OrderDimension
- type OwnedEvidenceRow
- type OwnedMaterialRow
- type OwnedTaskRow
- type OwnerProjectionMismatchError
- type Phase
- type Priority
- type ProjectionDivergenceError
- type Provider
- type ReplayResult
- type ResultSlotBinding
- type ResultSlotID
- type Role
- type RootGenesisRequest
- type Row
- type SchemaPreflightError
- type Session
- func (s *Session) AddComment(id TaskID, authorID AgentID, body string) (Comment, error)
- func (s *Session) AddEdge(sourceID TaskID, targetID string, kind EdgeKind) error
- func (s *Session) AddLabel(id TaskID, label string) error
- func (s *Session) AllocateGoverned(ctx context.Context, request GovernedAllocationRequest) (OperationClosure, error)
- func (s *Session) AllocateGovernedComposed(ctx context.Context, request GovernedAllocationComposedRequest) (GovernedAllocationComposedResult, error)
- func (s *Session) AllocateGovernedComposedBatch(ctx context.Context, request GovernedAllocationComposedRequest) (GovernedAllocationComposedResult, error)
- func (s *Session) Atomic(build func(op *Operation), opts ...ApplyOption) (CommittedResult, error)
- func (s *Session) CloseTask(id TaskID, reason string, opts ...ApplyOption) (Task, error)
- func (s *Session) Create(namespace, title, description string, taskType TaskType, priority Priority, ...) (Task, error)
- func (s *Session) RemoveEdge(sourceID TaskID, targetID string, kind EdgeKind) error
- func (s *Session) RemoveLabel(id TaskID, label string) error
- func (s *Session) Reopen(id TaskID, opts ...ApplyOption) (Task, error)
- func (s *Session) Start(id TaskID, opts ...ApplyOption) (Task, error)
- func (s *Session) Stop(id TaskID, opts ...ApplyOption) (Task, error)
- func (s *Session) TransferAssignment(request AssignmentTransferRequest, opts ...ApplyOption) (AssignmentTransferResult, error)
- func (s *Session) Update(id TaskID, fields UpdateFields, opts ...ApplyOption) (Task, error)
- type SoftwareAgent
- type SoftwareAgentRegistrarContext
- type Stage
- type Status
- type StoreUnavailableError
- type StoredOperationIdentity
- type Task
- type TaskAttribution
- type TaskEventRow
- type TaskID
- type TaskProjection
- type TaskStatus
- type TaskType
- type Tracker
- type TransactionEvidenceReader
- type UUIDRange
- type UpdateFields
Constants ¶
const ( ActorOwnershipStageOwnedTasks = journal.ActorOwnershipStageOwnedTasks ActorOwnershipStageMaterials = journal.ActorOwnershipStageMaterials ActorOwnershipStageEvidence = journal.ActorOwnershipStageEvidence MaxActorOwnershipResultBytes = journal.MaxActorOwnershipResultBytes )
const ( IDFormatEmpty = sqlite.IDFormatEmpty IDFormatRetired = sqlite.IDFormatRetired IDFormatSlash = sqlite.IDFormatSlash )
const ( JournalKindOperation = journal.JournalKindOperation JournalKindTaskEvent = journal.JournalKindTaskEvent JournalKindAuthority = journal.JournalKindAuthority JournalKindDecision = journal.JournalKindDecision JournalKindEvidence = journal.JournalKindEvidence JournalKindActivity = journal.JournalKindActivity // OrderByRecordedAt is the non-causal readable-timeline display order and the // default for display-facing listings; OrderByJournalID is the canonical order. OrderByRecordedAt = journal.OrderByRecordedAt OrderByJournalID = journal.OrderByJournalID EventContextKindTask = journal.EventContextKindTask EventContextKindActivity = journal.EventContextKindActivity EventContextKindActor = journal.EventContextKindActor EventContextKindGit = journal.EventContextKindGit OrdinalV1CodecName = journal.OrdinalV1CodecName MutationEncodingV1 = journal.MutationEncodingV1 MutationEncodingV2 = journal.MutationEncodingV2 MaxCanonicalEffects = journal.MaxCanonicalEffects MaxCanonicalContextsPerEffect = journal.MaxCanonicalContextsPerEffect MaxCanonicalFieldBytes = journal.MaxCanonicalFieldBytes MaxCanonicalMutationBytes = journal.MaxCanonicalMutationBytes MaxCanonicalConditions = journal.MaxCanonicalConditions MaxFactFilterValues = journal.MaxFactFilterValues MaxFactQueryKinds = journal.MaxFactQueryKinds MaxFactPageSize = journal.MaxFactPageSize MaxCanonicalResultSlots = journal.MaxCanonicalResultSlots FactTaskAny = journal.FactTaskAny FactTaskUnscoped = journal.FactTaskUnscoped FactTaskExact = journal.FactTaskExact FactDecision = journal.FactDecision FactEvidence = journal.FactEvidence ConditionExactFact = journal.ConditionExactFact ConditionAssignmentActive = journal.ConditionAssignmentActive ConditionAssignmentInactive = journal.ConditionAssignmentInactive ConditionCurrentFact = journal.ConditionCurrentFact ConditionFactMissing = journal.ConditionFactMissing ConditionFactMismatch = journal.ConditionFactMismatch ConditionCurrentMismatch = journal.ConditionCurrentMismatch // Authority-kind and assignment-lifecycle closed enums (§4). AuthorityKindBootstrap = journal.AuthorityKindBootstrap AuthorityKindAssignment = journal.AuthorityKindAssignment SlotOwnerResponsibility = journal.SlotOwnerResponsibility TransitionStarted = journal.TransitionStarted TransitionEnded = journal.TransitionEnded // Effect sorts (§9.3). EffectTaskEvent = journal.EffectTaskEvent EffectBootstrapAuthority = journal.EffectBootstrapAuthority EffectAssignmentStart = journal.EffectAssignmentStart EffectAssignmentEnd = journal.EffectAssignmentEnd EffectDecision = journal.EffectDecision EffectEvidence = journal.EffectEvidence EffectTaskCreate = journal.EffectTaskCreate EffectTaskCreateAllocated = journal.EffectTaskCreateAllocated // EffectActivityCreate is the closed effect sort for activity birth (§Activity). // Codec and normalization are complete in this vertical; SQLite fold in .1.2. EffectActivityCreate = journal.EffectActivityCreate // Conflict axes: five broad discriminators on OperationConflict (§11). ConflictActor = journal.ConflictActor ConflictAuthority = journal.ConflictAuthority ConflictCommand = journal.ConflictCommand ConflictCondition = journal.ConflictCondition ConflictEffect = journal.ConflictEffect // Journaled relationship / annotation mutation-family effect sorts (§6 amendment). EffectEdgeAdd = journal.EffectEdgeAdd EffectEdgeRemove = journal.EffectEdgeRemove EffectLabelAdd = journal.EffectLabelAdd EffectLabelRemove = journal.EffectLabelRemove EffectCommentAdd = journal.EffectCommentAdd // Committed-result variants (§3.2, §9.4). CommittedAbsent = journal.CommittedAbsent CommittedExact = journal.CommittedExact CommittedConflict = journal.CommittedConflict // Per-record batch outcomes (§9). BatchRecordCommitted = journal.BatchRecordCommitted BatchRecordShortCircuited = journal.BatchRecordShortCircuited BatchRecordConflict = journal.BatchRecordConflict BatchRecordFailed = journal.BatchRecordFailed BatchRecordNotRecorded = journal.BatchRecordNotRecorded MaxBatchRecords = journal.MaxBatchRecords // Task-status projection (§8.1). TaskStatusOpen = journal.TaskStatusOpen TaskStatusInProgress = journal.TaskStatusInProgress TaskStatusClosed = journal.TaskStatusClosed // Provenance lifecycle task-event kinds the reducer projects (§8.1, §13). EventKindTaskCreated = journal.EventKindTaskCreated EventKindTaskStarted = journal.EventKindTaskStarted EventKindTaskStopped = journal.EventKindTaskStopped EventKindTaskClosed = journal.EventKindTaskClosed EventKindTaskReopened = journal.EventKindTaskReopened EventKindTaskMigrated = journal.EventKindTaskMigrated // EventKindTaskUpdated records a materialized-metadata mutation; it is NOT a // status-changing lifecycle kind (§8.1). EventKindTaskUpdated = journal.EventKindTaskUpdated // Journaled relationship / annotation mutation-family kinds (§6 amendment). EventKindEdgeAdded = journal.EventKindEdgeAdded EventKindEdgeRemoved = journal.EventKindEdgeRemoved EventKindLabelAdded = journal.EventKindLabelAdded EventKindLabelRemoved = journal.EventKindLabelRemoved EventKindCommentAdded = journal.EventKindCommentAdded )
Closed enum values.
const ( StatusOpen = ptypes.StatusOpen StatusInProgress = ptypes.StatusInProgress StatusClosed = ptypes.StatusClosed )
Status constants
const ( PriorityCritical = ptypes.PriorityCritical PriorityHigh = ptypes.PriorityHigh PriorityMedium = ptypes.PriorityMedium PriorityLow = ptypes.PriorityLow PriorityBacklog = ptypes.PriorityBacklog )
Priority constants
const ( TaskTypeBug = ptypes.TaskTypeBug TaskTypeFeature = ptypes.TaskTypeFeature TaskTypeTask = ptypes.TaskTypeTask TaskTypeEpic = ptypes.TaskTypeEpic TaskTypeChore = ptypes.TaskTypeChore )
TaskType constants
const ( EdgeBlockedBy = ptypes.EdgeBlockedBy EdgeDerivedFrom = ptypes.EdgeDerivedFrom EdgeSupersedes = ptypes.EdgeSupersedes EdgeDiscoveredFrom = ptypes.EdgeDiscoveredFrom EdgeGeneratedBy = ptypes.EdgeGeneratedBy EdgeAttributedTo = ptypes.EdgeAttributedTo )
EdgeKind constants
const ( AgentKindHuman = ptypes.AgentKindHuman AgentKindMachineLearning = ptypes.AgentKindMachineLearning AgentKindSoftware = ptypes.AgentKindSoftware )
AgentKind constants
const ( ProviderAnthropic = ptypes.ProviderAnthropic ProviderGoogle = ptypes.ProviderGoogle ProviderOpenAI = ptypes.ProviderOpenAI ProviderLocal = ptypes.ProviderLocal )
Provider constants
const ( RoleHuman = ptypes.RoleHuman RoleArchitect = ptypes.RoleArchitect RoleSupervisor = ptypes.RoleSupervisor RoleWorker = ptypes.RoleWorker RoleReviewer = ptypes.RoleReviewer )
Role constants
const ( PhaseRequest = ptypes.PhaseRequest PhaseElicit = ptypes.PhaseElicit PhasePropose = ptypes.PhasePropose PhaseReview = ptypes.PhaseReview PhasePlanUAT = ptypes.PhasePlanUAT PhaseRatify = ptypes.PhaseRatify PhaseHandoff = ptypes.PhaseHandoff PhaseImplPlan = ptypes.PhaseImplPlan PhaseWorkerSlices = ptypes.PhaseWorkerSlices PhaseCodeReview = ptypes.PhaseCodeReview PhaseImplUAT = ptypes.PhaseImplUAT PhaseLanding = ptypes.PhaseLanding PhaseUnscoped = ptypes.PhaseUnscoped )
Phase constants
const ( StageNotStarted = ptypes.StageNotStarted StageInProgress = ptypes.StageInProgress StageBlocked = ptypes.StageBlocked StageComplete = ptypes.StageComplete )
Stage constants
const ( MaxGovernedAllocationChildren = allocation.MaxChildren GovernedAllocationCompositionV1 = allocation.CompositionV1 GovernedAllocationReferenceDescendants = allocation.ReferenceScopeDescendants GovernedRequestGenesis = allocation.RequestKindGenesis GovernedRequestAllocation = allocation.RequestKindAllocation GovernedAllocationValidation = allocation.ErrorValidation GovernedAllocationConflict = allocation.ErrorConflict GovernedAllocationAuthority = allocation.ErrorAuthority GovernedAllocationRevoked = allocation.ErrorRevoked GovernedAllocationCollision = allocation.ErrorCollision GovernedAllocationGenesis = allocation.ErrorGenesis GovernedAllocationCorruption = allocation.ErrorCorruption )
Governed allocation bounds and closed enum values.
const MaxAssignmentStartSlotFilters = journal.MaxAssignmentStartSlotFilters
Variables ¶
var ( TaskContext = journal.TaskContext ActivityContext = journal.ActivityContext ActorContext = journal.ActorContext GitContext = journal.GitContext CanonicalEventContexts = journal.CanonicalEventContexts ValidateEventKind = journal.ValidateEventKind ValidateOperationID = journal.ValidateOperationID OrdinalUUID = journal.OrdinalUUID BigEndianUUID = journal.BigEndianUUID LookupCodec = journal.LookupCodec // Deterministic migration identity + lifecycle-status projection (§8.1, §13). MigrationBaselineOperationID = journal.MigrationBaselineOperationID MigrationBaselineAssignmentID = journal.MigrationBaselineAssignmentID StatusForEventKind = journal.StatusForEventKind // Static status FSM surface (§8.1, §16). ValidateStatusTransition = journal.ValidateStatusTransition IsTransitionLifecycleKind = journal.IsTransitionLifecycleKind TransitionLifecycleKinds = journal.TransitionLifecycleKinds EncodeForcedTransitionPayload = journal.EncodeForcedTransitionPayload DecodeForcedTransition = journal.DecodeForcedTransition // Journaled relationship / annotation mutation-family surface (§6 amendment). IsMutationFamilyKind = journal.IsMutationFamilyKind MutationFamilyKinds = journal.MutationFamilyKinds MutationFamilyKindForSort = journal.MutationFamilyKindForSort DecodeEdgeMutationPayload = journal.DecodeEdgeMutationPayload DecodeLabelMutationPayload = journal.DecodeLabelMutationPayload DecodeCommentMutationPayload = journal.DecodeCommentMutationPayload // Canonicalize is the sole public preparation boundary. Canonicalize = journal.Canonicalize DecodeCanonicalMutation = journal.DecodeCanonicalMutation ValidateResultSlotBinding = journal.ValidateResultSlotBinding // ConflictAxes returns the closed five-axis set. All axes are nonzero. ConflictAxes = journal.ConflictAxes FactTaskScopeKinds = journal.FactTaskScopeKinds ConditionKinds = journal.ConditionKinds ConditionFailureReasons = journal.ConditionFailureReasons AssignmentActiveCondition = journal.AssignmentActiveCondition )
Typed context and validation constructors.
var ( ErrUnsupportedOrderDimension = journal.ErrUnsupportedOrderDimension ErrInvalidQuery = journal.ErrInvalidQuery ErrSubtypeIntegrity = journal.ErrSubtypeIntegrity ErrActorPlacement = journal.ErrActorPlacement ErrNamespaceRange = journal.ErrNamespaceRange ErrEntryOutOfRange = journal.ErrEntryOutOfRange ErrNamespaceClaim = journal.ErrNamespaceClaim // Operations/authority sentinel errors (§4, §9, §14). ErrOperationConflict = journal.ErrOperationConflict ErrConditionFailed = journal.ErrConditionFailed ErrActivityConflict = journal.ErrActivityConflict ErrGenesis = journal.ErrGenesis ErrAuthorityScope = journal.ErrAuthorityScope ErrAssignmentLifecycle = journal.ErrAssignmentLifecycle ErrOrphanedEvidence = journal.ErrOrphanedEvidence ErrStaleEpisode = journal.ErrStaleEpisode ErrResultSlotIntegrity = journal.ErrResultSlotIntegrity ErrCloseWithoutEnding = journal.ErrCloseWithoutEnding ErrParentCitation = journal.ErrParentCitation ErrCorruptParentChain = journal.ErrCorruptParentChain // Shared-reducer replay, migration, and preflight sentinels (§9, §13, §15). ErrMigrationOwnerUnmappable = journal.ErrMigrationOwnerUnmappable ErrSchemaPreflight = journal.ErrSchemaPreflight ErrProjectionDivergence = journal.ErrProjectionDivergence ErrStatusTransition = journal.ErrStatusTransition ErrMigrationFault = journal.ErrMigrationFault ErrInjectedFault = journal.ErrInjectedFault ErrDishonestMigrationTimestamp = journal.ErrDishonestMigrationTimestamp ErrCanonicalMutation = journal.ErrCanonicalMutation // Batched-apply sentinels (§9). ErrBatchApply = journal.ErrBatchApply ErrBatchEmpty = journal.ErrBatchEmpty ErrBatchTooLarge = journal.ErrBatchTooLarge )
Journal sentinel errors, re-exported for errors.Is at call sites.
var ( ErrNotFound = ptypes.ErrNotFound ErrCycleDetected = ptypes.ErrCycleDetected ErrAlreadyClosed = ptypes.ErrAlreadyClosed ErrInvalidID = ptypes.ErrInvalidID ErrAgentKindMismatch = ptypes.ErrAgentKindMismatch ErrAgentAlreadyExists = ptypes.ErrAgentAlreadyExists )
var DefaultNamespace = namespace.DefaultNamespace
DefaultNamespace derives a namespace URI from the current git repo's remote URL, falling back to a file:// URI of the working directory. See namespace.DefaultNamespace for full documentation.
var ErrActorOwnershipLimit = journal.ErrActorOwnershipLimit
ErrActorOwnershipLimit marks unsupported stored result size, not capacity.
var ErrDBOSContextFrame = errors.New("provenance: invalid DBOS context frame")
var ErrGenesisRequired = errors.New("provenance: journal has no genesis authority")
ErrGenesisRequired is returned by a journaled Session verb invoked against a journal that holds no rows at all: no genesis bootstrap authority has been established and no legacy baseline migrated, so there is no authority any operation could execute under (§4.6, §13). errors.Is recovers it from the wrapped, actionable error.
var ErrIDFormat = sqlite.ErrIDFormat
var ErrNoRemote = namespace.ErrNoRemote
ErrNoRemote is returned by FromGitRemote when the remote URL is empty. See namespace.ErrNoRemote for full documentation.
var ErrSupersededDBOSSystemSchema = dbossys.ErrSupersededSystemSchema
ErrSupersededDBOSSystemSchema marks a refusal of a DBOS system database that a superseded DBOS runtime created. Match it with errors.Is.
var FromDirectory = namespace.FromDirectory
FromDirectory returns a file:// URI for the given directory path. See namespace.FromDirectory for full documentation.
var FromGitRemote = namespace.FromGitRemote
FromGitRemote normalizes a git remote URL to a canonical HTTPS URI. See namespace.FromGitRemote for full documentation.
Functions ¶
func DefaultModelRegistry ¶
func DefaultModelRegistry() ptypes.ModelRegistry
DefaultModelRegistry returns the model registry backed by bestiary. It uses bestiary.Models() as the single source of truth.
func EnsureSchemaInTx ¶ added in v0.7.0
EnsureSchemaInTx brings the store schema up to this build's full shape inside the caller-owned transaction, without beginning, committing, rolling back, or publishing the identity-format marker. The offline cutover calls it after BEGIN IMMEDIATE and before ConvertIDsInTx so a legacy store has the governed_allocation_operations and journal_operations relations conversion and verification read. It is idempotent and does nothing on a current store.
func NewRegistry ¶
func NewRegistry(entries []ModelEntry) ptypes.ModelRegistry
NewRegistry creates a ModelRegistry from the given entries. Use this for custom or test registries.
func PauseForeignKeys ¶ added in v0.7.0
PauseForeignKeys disables connection-local foreign-key enforcement on the caller's pinned connection and returns a restore that re-enables and verifies it. SQLite ignores PRAGMA foreign_keys while a transaction is open, so the caller pauses enforcement before BEGIN IMMEDIATE and restores it after COMMIT/ROLLBACK; an in-transaction PRAGMA foreign_keys=OFF is a silent no-op, and the schema rebuilds (journal producing-operation FK completion) need enforcement off. The restore takes the caller's own error and returns the error the caller should return, so a failed restore is never dropped.
Usage requires a named error return:
restoreFK, err := PauseForeignKeys(ctx, conn)
if err != nil {
return err
}
defer func() { err = restoreFK(err) }()
func PublishIDFormatInTx ¶ added in v0.6.0
PublishIDFormatInTx is called LAST, after external owners have verified their projections and the full raw-evidence inventory. It owns no transaction end.
func RegistryFromBestiary ¶
func RegistryFromBestiary(models []bestiary.ModelInfo) ptypes.ModelRegistry
RegistryFromBestiary converts bestiary model data into a provenance ModelRegistry. Only Provider, Name (as ModelID), DisplayName, and Family are extracted.
func RequireSupportedDBOSSystemSchema ¶ added in v0.0.7
RequireSupportedDBOSSystemSchema refuses a DBOS system database that a superseded DBOS runtime created. origin names the database for the operator, normally its path or DSN.
There is no supported in-place upgrade of such a database. The DBOS runtime would migrate it silently while it builds its context, so a host that creates its own context must call this gate on the exact *sql.DB it is about to pass as dbos.Config.SQLiteSystemDB, BEFORE it creates that context. The gate only reads: on refusal the file is unchanged and nothing was opened or launched.
dbos.NewClient is the same moment under another name: it builds a context of its own from ClientConfig.SQLiteSystemDB and therefore migrates in place too. Call this gate before that constructor as well.
A database with no DBOS system schema is fresh and is accepted; the runtime creates the schema on its first launch.
Types ¶
type ActivityConflict ¶ added in v0.0.4
type ActivityConflict = journal.ActivityConflict
ActivityConflict is the typed conflict for ActivityCreate folds (later vertical).
type ActivityID ¶
type ActivityID = ptypes.ActivityID
ID types
func ParseActivityID ¶
func ParseActivityID(s string) (ActivityID, error)
ParseActivityID parses "namespace/uuid" into an ActivityID. See ptypes.ParseActivityID for full documentation.
type ActorID ¶ added in v0.0.3
ID types
func ParseActorID ¶ added in v0.0.3
ParseActorID parses "namespace/uuid" into the sole ActorID identity domain. Canonical UUID shape is required; nil and non-v7 UUIDs are accepted.
type ActorNamespaceClaim ¶ added in v0.0.3
type ActorNamespaceClaim = journal.ActorNamespaceClaim
Journal identity and discriminator types.
type ActorOwnershipIntegrityError ¶ added in v0.3.0
type ActorOwnershipIntegrityError = journal.ActorOwnershipIntegrityError
type ActorOwnershipLimitError ¶ added in v0.3.0
type ActorOwnershipLimitError = journal.ActorOwnershipLimitError
type ActorOwnershipQuery ¶ added in v0.3.0
type ActorOwnershipQuery = journal.ActorOwnershipQuery
type ActorOwnershipQueryAPI ¶ added in v0.3.0
type ActorOwnershipQueryAPI = journal.ActorOwnershipQueryAPI
Actor-ownership queries are optional on Journal. SQLite and borrowed SQLite support this interface; see docs/actor-ownership-queries.md.
type ActorOwnershipSnapshot ¶ added in v0.3.0
type ActorOwnershipSnapshot = journal.ActorOwnershipSnapshot
type ActorOwnershipStage ¶ added in v0.3.0
type ActorOwnershipStage = journal.ActorOwnershipStage
type ActorOwnershipWork ¶ added in v0.3.0
type ActorOwnershipWork = journal.ActorOwnershipWork
type AgentID ¶
AgentID is the deprecated source-compatibility spelling for ActorID.
func ParseAgentID
deprecated
type AmbiguousApplyFailureError ¶ added in v0.0.3
type AmbiguousApplyFailureError struct {
Class DBOSDiagnosticClass
Field DBOSDiagnosticField
Stage DBOSDiagnosticStage
Reason string
Impact string
Fix string
// contains filtered or unexported fields
}
AmbiguousApplyFailureError reports an invalid error graph that matches more than one closed domain descriptor. It remains on DBOS's Go-error channel.
func (*AmbiguousApplyFailureError) Error ¶ added in v0.0.3
func (e *AmbiguousApplyFailureError) Error() string
func (*AmbiguousApplyFailureError) MatchedKinds ¶ added in v0.0.3
func (e *AmbiguousApplyFailureError) MatchedKinds() []ApplyFailureKind
MatchedKinds returns stable contract-order evidence without exposing mutable internal storage.
func (*AmbiguousApplyFailureError) Unwrap ¶ added in v0.0.3
func (e *AmbiguousApplyFailureError) Unwrap() error
type AppendTaskEventInput ¶ added in v0.0.3
type AppendTaskEventInput = journal.AppendTaskEventInput
Journal identity and discriminator types.
type ApplyFailureKind ¶ added in v0.0.3
type ApplyFailureKind string
ApplyFailureKind is the closed, string-backed wire discriminator over every public journal failure the reducer can return. It is what lets a checkpointed domain failure reconstruct an errors.Is-matchable typed error after DBOS has erased the original Go error's type. String backing provides stable, self- describing JSON wire values (Proposal 54).
There is no "unexpected" catch-all: an error matching zero or multiple descriptors is NOT a durable domain failure and remains on the Go-error channel.
const ( FailureOperationConflict ApplyFailureKind = "operation_conflict" FailureConditionFailed ApplyFailureKind = "condition_failed" FailureActivityConflict ApplyFailureKind = "activity_conflict" FailureGenesis ApplyFailureKind = "genesis" FailureAuthorityScope ApplyFailureKind = "authority_scope" FailureAssignmentLifecycle ApplyFailureKind = "assignment_lifecycle" FailureOrphanedEvidence ApplyFailureKind = "orphaned_evidence" FailureStaleEpisode ApplyFailureKind = "stale_episode" FailureResultSlotIntegrity ApplyFailureKind = "result_slot_integrity" FailureCloseWithoutEnding ApplyFailureKind = "close_without_ending" FailureParentCitation ApplyFailureKind = "parent_citation" FailureCorruptParentChain ApplyFailureKind = "corrupt_parent_chain" FailureInvalidID ApplyFailureKind = "invalid_id" FailureNotFound ApplyFailureKind = "not_found" FailureAlreadyClosed ApplyFailureKind = "already_closed" FailureGenesisRequired ApplyFailureKind = "genesis_required" )
type ApplyOption ¶ added in v0.0.3
type ApplyOption func(*applyConfig)
ApplyOption customizes one journaled Session operation.
func WithCommandDigest ¶ added in v0.0.3
func WithCommandDigest(d []byte) ApplyOption
WithCommandDigest overrides the operation's command digest (§3.1). By default the Session derives a deterministic digest from the verb and its arguments, so a pinned same-argument retry matches and a changed-argument reuse conflicts; override only to supply a caller-computed provenance digest.
func WithForce ¶ added in v0.0.3
func WithForce() ApplyOption
WithForce marks a lifecycle transition verb (Start/Stop/CloseTask/Reopen) as a FORCED coercion: the reducer records a forced marker in the journal row and skips the static status FSM (§8.1) for that one transition, so an out-of-FSM status change is committed, journal-reproducible, and audit-visible. Force is the deliberate escape hatch (the CLI `--force`); it NEVER bypasses authorization (§9.3), only the FSM, and it is ignored by the metadata-only Update. A forced transition digests differently from an unforced one, so a forced retry never collides with an unforced attempt (§9.4).
func WithMutationDigest ¶ added in v0.0.3
func WithMutationDigest(d []byte) ApplyOption
WithMutationDigest preserves the legacy opaque-digest option for source compatibility and retries of explicit legacy operation rows. Canonical new writes always derive the persisted mutation digest from their canonical effects; this value cannot override or forge that identity.
func WithOperationID ¶ added in v0.0.3
func WithOperationID(id OperationID) ApplyOption
WithOperationID pins the operation's caller-defined, nonempty, control-free OperationID instead of minting a fresh UUIDv7-backed key. Reuse the SAME id verbatim on a retry to make the mutation idempotent: an exact same-identity replay short-circuits to the original result (§9.4); a reused id with different arguments is a typed conflict (§11). See the package retry caveat.
type ApplyWaitCanceledError ¶ added in v0.0.3
type ApplyWaitCanceledError struct {
Operation OperationID
Stage DBOSDiagnosticStage
Impact string
Fix string
Cause error
}
ApplyWaitCanceledError is returned when the CALLER context is cancelled while the adapter awaits a durable workflow result. The durable work is never cancelled; re-issuing the same operation retrieves its eventual outcome.
func (*ApplyWaitCanceledError) Error ¶ added in v0.0.3
func (e *ApplyWaitCanceledError) Error() string
func (*ApplyWaitCanceledError) Unwrap ¶ added in v0.0.3
func (e *ApplyWaitCanceledError) Unwrap() error
type AssignmentActiveAssertion ¶ added in v0.2.0
type AssignmentActiveAssertion = journal.AssignmentActiveAssertion
Journal identity and discriminator types.
type AssignmentID ¶ added in v0.0.3
type AssignmentID = journal.AssignmentID
Journal identity and discriminator types.
type AssignmentSlotID ¶ added in v0.0.3
type AssignmentSlotID = journal.AssignmentSlotID
Journal identity and discriminator types.
type AssignmentStartCursor ¶ added in v0.1.0
type AssignmentStartCursor = journal.AssignmentStartCursor
type AssignmentStartPage ¶ added in v0.1.0
type AssignmentStartPage = journal.AssignmentStartPage
type AssignmentStartPageRequest ¶ added in v0.1.0
type AssignmentStartPageRequest = journal.AssignmentStartPageRequest
type AssignmentStartQuery ¶ added in v0.1.0
type AssignmentStartQuery = journal.AssignmentStartQuery
type AssignmentStartQueryAPI ¶ added in v0.1.0
type AssignmentStartQueryAPI = journal.AssignmentStartQueryAPI
Assignment-start queries are optional on Journal; SQLite and borrowed SQLite support this interface. See docs/assignment-start-queries.md for paging and integrity boundaries.
type AssignmentStartRow ¶ added in v0.1.0
type AssignmentStartRow = journal.AssignmentStartRow
type AssignmentTransferRequest ¶ added in v0.0.4
type AssignmentTransferRequest struct {
TaskID TaskID
SlotID AssignmentSlotID
PreviousAssignmentID AssignmentID
NextAssignmentID AssignmentID
NextOccupant ActorID
}
AssignmentTransferRequest identifies one assignment episode to consume and its exact successor. The governing authority and operation identity remain bound to the Session and Apply options, respectively.
type AssignmentTransferResult ¶ added in v0.0.4
type AssignmentTransferResult struct {
TaskID TaskID
SlotID AssignmentSlotID
PreviousAssignmentID AssignmentID
NextAssignmentID AssignmentID
NextOccupant ActorID
Replayed bool
}
AssignmentTransferResult is the semantic result of TransferAssignment. It intentionally omits journal/storage identities; Replayed reports whether an exact pinned retry returned the already-committed transfer.
type AssignmentTransition ¶ added in v0.0.3
type AssignmentTransition = journal.AssignmentTransition
Journal identity and discriminator types.
type AuthorityKind ¶ added in v0.0.3
type AuthorityKind = journal.AuthorityKind
Journal identity and discriminator types.
type BatchApplyError ¶ added in v0.9.0
type BatchApplyError = journal.BatchApplyError
Journal identity and discriminator types.
type BatchJournal ¶ added in v0.9.0
type BatchJournal interface {
ContextJournal
ApplyBatchContext(ctx context.Context, inputs []OperationInput) (BatchResult, error)
}
BatchJournal is the optional batched-write extension to ContextJournal. ApplyBatchContext commits a bounded batch of operations in ONE SQLite transaction and reports a per-record outcome for every input, preserving the §9.4 idempotent-replay short-circuit, the §11 conflict classification, and the per-record error taxonomy. The two store-wide integrity gates run once over the transaction's final state — the transaction is their natural scope — while every per-record check is unchanged. Journal and ContextJournal remain unchanged so existing external implementations continue to compile; a caller that needs batching type-asserts to BatchJournal, exactly as the deadline-aware caller type-asserts to ContextJournal.
type BatchRecordOutcome ¶ added in v0.9.0
type BatchRecordOutcome = journal.BatchRecordOutcome
Batched apply surface (§9): one transaction, per-record outcomes.
type BatchRecordResult ¶ added in v0.9.0
type BatchRecordResult = journal.BatchRecordResult
Journal identity and discriminator types.
type BatchResult ¶ added in v0.9.0
type BatchResult = journal.BatchResult
Journal identity and discriminator types.
type BoundGovernedAllocator ¶ added in v0.0.4
type BoundGovernedAllocator struct {
// contains filtered or unexported fields
}
BoundGovernedAllocator is the factory-certified host-owned allocation capability. Its narrow API owns lifecycle and setup without exposing DBOS, SQL, or transaction handles.
func OpenBoundGovernedAllocator ¶ added in v0.0.4
func OpenBoundGovernedAllocator(ctx context.Context, config FusedGovernedAllocatorConfig) (*BoundGovernedAllocator, error)
OpenBoundGovernedAllocator constructs the host-facing, task-level capability without accepting or exposing DBOS or SQL handles. The returned capability owns its root lifecycle and certifies exact-handle fused durability by construction.
func (*BoundGovernedAllocator) Close ¶ added in v0.0.4
func (a *BoundGovernedAllocator) Close(timeout time.Duration) error
Close releases the factory-owned certified binding.
func (*BoundGovernedAllocator) Launch ¶ added in v0.0.4
func (a *BoundGovernedAllocator) Launch() error
Launch starts the factory-owned DBOS root after all Provenance workflows have been registered.
func (*BoundGovernedAllocator) RunAllocateComposed ¶ added in v0.0.4
func (a *BoundGovernedAllocator) RunAllocateComposed(ctx context.Context, workflowID string, authority JournalID, request GovernedAllocationComposedRequest) (GovernedAllocationComposedResult, error)
RunAllocateComposed executes a composed allocation that must carry exactly one child. It is the narrow entry point; RunAllocateComposedBatch accepts the same request type with 1..128 ordered children.
func (*BoundGovernedAllocator) RunAllocateComposedBatch ¶ added in v0.0.4
func (a *BoundGovernedAllocator) RunAllocateComposedBatch(ctx context.Context, workflowID string, authority JournalID, request GovernedAllocationComposedRequest) (GovernedAllocationComposedResult, error)
RunAllocateComposedBatch executes an ordered multi-child composition through the allocator bound to the host's exact DBOS/SQLite system handle.
func (*BoundGovernedAllocator) RunInitializeRoot ¶ added in v0.0.4
func (a *BoundGovernedAllocator) RunInitializeRoot(ctx context.Context, workflowID string, request RootGenesisRequest) (OperationClosure, error)
RunInitializeRoot initializes the certified binding's governed authority.
func (*BoundGovernedAllocator) Tracker ¶ added in v0.0.4
func (a *BoundGovernedAllocator) Tracker() Tracker
Tracker exposes setup and read access without exposing the certified SQL or DBOS handles.
type CanonicalApplyFailure ¶ added in v0.0.3
type CanonicalApplyFailure struct {
Kind ApplyFailureKind `json:"kind"`
Message string `json:"message"`
// ConflictAxis and ConflictIndex are set on FailureOperationConflict.
// Index is -1 for scalar axes (Actor/Authority/Command) or collection-length mismatch.
ConflictAxis *journal.ConflictAxis `json:"conflict_axis,omitempty"`
ConflictIndex *int `json:"conflict_index,omitempty"`
// Condition fields are set only on FailureConditionFailed. Pointers make
// omitted metadata distinguishable from its valid zero values on decode.
ConditionIndex *int `json:"condition_index,omitempty"`
ConditionKind *journal.ConditionKind `json:"condition_kind,omitempty"`
ConditionReason *journal.ConditionFailureReason `json:"condition_reason,omitempty"`
AssertedJournalID *int64 `json:"asserted_journal_id,omitempty"`
ActualJournalID *int64 `json:"actual_journal_id,omitempty"`
// Activity fields are set only on FailureActivityConflict.
ActivityID string `json:"activity_id,omitempty"`
ExistingJournalID *int64 `json:"existing_journal_id,omitempty"`
OperationID string `json:"operation_id,omitempty"`
}
CanonicalApplyFailure is the closed encoding of one checkpointed domain failure. Message is the original actionable text; Kind selects the sentinel a decoded failure wraps so callers recover the typed error with errors.Is. OperationID must equal the outer DBOSStepOutcome.OperationID (validated on decode).
type CanonicalMutation ¶ added in v0.0.3
type CanonicalMutation = journal.CanonicalMutation
Journal identity and discriminator types.
type CanonicalMutationError ¶ added in v0.0.3
type CanonicalMutationError = journal.CanonicalMutationError
Journal identity and discriminator types.
type CanonicalMutationResult ¶ added in v0.0.3
type CanonicalMutationResult struct {
AnchorJournalID int64 `json:"anchor_journal_id"`
EmittedEvents []int64 `json:"emitted_events"`
ResultSlots []CanonicalResultSlot `json:"result_slots"`
}
CanonicalMutationResult is the journal-anchored canonical result of one committed operation. EmittedEvents is the task_event closure in ascending JournalID order; ResultSlots is slot-sorted and slot-unique. Every field here is canonical, journal-anchored state, so its natural equality (== / reflect.DeepEqual, and canonicalResultsEqual) is honest -- the per-call §9.4 replay flag deliberately does NOT live here (see DBOSStepOutcome.ShortCircuited).
type CanonicalResultSlot ¶ added in v0.0.3
type CanonicalResultSlot struct {
Slot string `json:"slot"`
ProducedJournalID int64 `json:"produced_journal_id"`
Kind int `json:"kind"`
TaskID string `json:"task_id,omitempty"`
ActivityID string `json:"activity_id,omitempty"`
}
CanonicalResultSlot is one slot->produced-row binding in the canonical result. TaskEvent carries only TaskID, Activity carries only ActivityID, and the Authority/Decision/Evidence kinds carry neither entity arm.
type CheckpointDivergenceError ¶ added in v0.0.3
type CheckpointDivergenceError struct {
Operation OperationID
Stage DBOSDiagnosticStage
Impact string
Fix string
Cause error
}
CheckpointDivergenceError is returned when a checkpointed success does not match the journal-anchored committed operation (missing, conflicting, or result mismatch). The adapter writes nothing and never repairs state from a checkpoint.
func (*CheckpointDivergenceError) Error ¶ added in v0.0.3
func (e *CheckpointDivergenceError) Error() string
func (*CheckpointDivergenceError) Unwrap ¶ added in v0.0.3
func (e *CheckpointDivergenceError) Unwrap() error
type CommentID ¶
ID types
func ParseCommentID ¶
ParseCommentID parses "namespace/uuid" into a CommentID. See ptypes.ParseCommentID for full documentation.
type CommittedResult ¶ added in v0.0.3
type CommittedResult = journal.CommittedResult
Journal identity and discriminator types.
type CommittedResultKind ¶ added in v0.0.3
type CommittedResultKind = journal.CommittedResultKind
Journal identity and discriminator types.
type ConditionFailure ¶ added in v0.0.4
type ConditionFailure = journal.ConditionFailure
Journal identity and discriminator types.
type ConditionFailureReason ¶ added in v0.0.4
type ConditionFailureReason = journal.ConditionFailureReason
Journal identity and discriminator types.
type ConditionKind ¶ added in v0.0.4
type ConditionKind = journal.ConditionKind
Journal identity and discriminator types.
type ConflictAxis ¶ added in v0.0.4
type ConflictAxis = journal.ConflictAxis
ConflictAxis is the broad discriminator on OperationConflict (five axes).
type ContextJournal ¶ added in v0.0.4
type ContextJournal interface {
Journal
ApplyContext(ctx context.Context, in OperationInput) (CommittedResult, error)
}
ContextJournal is the optional deadline-aware extension to Journal. ApplyContext uses the caller context while waiting for SQLite write ownership. Journal remains unchanged so existing external implementations continue to compile.
type DBOSAdapter ¶ added in v0.0.3
type DBOSAdapter struct {
// contains filtered or unexported fields
}
DBOSAdapter runs Provenance operations as durable DBOS workflows over a shared journal contract. The adapter captures its contract snapshot once at construction; no paths rebuild or mutate the identity after registration.
func NewDBOSAdapter ¶ added in v0.0.3
func NewDBOSAdapter(root dbos.Context, tracker Tracker, config DBOSAdapterConfig) (*DBOSAdapter, error)
NewDBOSAdapter validates the root and tracker, resolves step options (applying defaults for zero fields and validating nonzero overrides), derives the actual application version from the DBOS root, rejects a non-empty mismatched expectation, captures the unversioned DBOS contract snapshot, and registers the workflow on the not-yet-launched root.
All validation occurs before registration so partial registration is impossible.
func (*DBOSAdapter) Apply ¶ added in v0.0.3
func (a *DBOSAdapter) Apply(ctx context.Context, in journal.OperationInput) (CommittedResult, error)
Apply runs one operation as a durable workflow and returns its journal-anchored committed result. It requires the adapter root to be launched but accepts an ordinary context.Context: the caller context controls pre/post work and cancellation reporting only, while the durable workflow runs on the adapter root. An already-cancelled context starts no workflow.
func (*DBOSAdapter) TransferAssignment ¶ added in v0.0.4
func (a *DBOSAdapter) TransferAssignment(ctx context.Context, session *Session, request AssignmentTransferRequest, opts ...ApplyOption) (AssignmentTransferResult, error)
TransferAssignment runs Session.TransferAssignment through the adapter's durable DBOS workflow path. The Session remains the authority capability and the request remains the public transfer contract; DBOS supplies retry and recovery only, never an alternate transfer rule or result ledger.
type DBOSAdapterConfig ¶ added in v0.0.3
type DBOSAdapterConfig struct {
// ExpectedApplicationVersion, when non-empty, is asserted equal to the DBOS
// root's actual application version at construction; a mismatch rejects before
// the workflow is registered or anything is written.
ExpectedApplicationVersion string
// StepOptions configures retry behaviour for the DBOS step wrapping each
// atomic domain fold. Zero fields use package defaults (3 retries, 50 ms,
// factor 2). Nonzero fields are validated and copied before registration.
StepOptions DBOSStepOptions
// ResultPollingInterval controls how often a waiting Apply checks DBOS for a
// workflow result. Zero uses 50 ms. Valid nonzero range: 10 ms through 5 s.
ResultPollingInterval time.Duration
}
DBOSAdapterConfig configures a DBOSAdapter. It is the only public configuration surface; no functional options, raw DBOS options, second constructor, setters, exported resolver, recovery API, or mutable runtime config exists.
type DBOSApplyInput ¶ added in v0.0.3
type DBOSApplyInput struct {
Schema string `json:"schema"`
Kind dbosOperationKind `json:"kind,omitempty"`
Context DBOSOperationContextBytes `json:"context"`
Mutation DBOSMutationBytes `json:"mutation"`
}
DBOSApplyInput is the closed durable workflow input.
func (*DBOSApplyInput) UnmarshalJSON ¶ added in v0.0.4
func (in *DBOSApplyInput) UnmarshalJSON(raw []byte) error
UnmarshalJSON keeps DBOS's callback boundary closed as well as the explicit decodeApplyInput boundary. The pinned DBOS release otherwise ignores unknown fields and accepts duplicate JSON object keys before invoking a registered callback.
type DBOSConfigError ¶ added in v0.0.3
type DBOSConfigError = DBOSDiagnosticError
DBOSConfigError remains a source-compatible name for construction diagnostics; it is the same consumed runtime type, not a second error authority.
type DBOSContextFrameError ¶ added in v0.0.3
type DBOSContextFrameError = DBOSDiagnosticError
DBOSContextFrameError is a typed, errors.Is-matchable error for any validation failure in the DBOS context encode/decode path. Field, Reason, and Fix provide the actionable detail required by [C-actionable-errors].
type DBOSDiagnosticClass ¶ added in v0.0.3
type DBOSDiagnosticClass string
DBOSDiagnosticClass identifies which subsystem produced a diagnostic.
const ( // DBOSDiagClassConfig identifies adapter construction/config validation failures. DBOSDiagClassConfig DBOSDiagnosticClass = "config" // DBOSDiagClassContextFrame identifies DBOS context codec failures. DBOSDiagClassContextFrame DBOSDiagnosticClass = "context-frame" // DBOSDiagClassOutcomeDecode identifies DBOS step-outcome decode failures. DBOSDiagClassOutcomeDecode DBOSDiagnosticClass = "outcome-decode" // DBOSDiagClassClassify identifies domain-failure classification failures. DBOSDiagClassClassify DBOSDiagnosticClass = "classify" // DBOSDiagClassStepRetry identifies DBOS step retry exhaustion. DBOSDiagClassStepRetry DBOSDiagnosticClass = "step-retry" // DBOSDiagClassTerminalRetrieval identifies terminal workflow retrieval failures. DBOSDiagClassTerminalRetrieval DBOSDiagnosticClass = "terminal-retrieval" // DBOSDiagClassCanonicalMutation identifies the nested journal mutation codec // when a DBOS input reaches that independently versioned boundary. DBOSDiagClassCanonicalMutation DBOSDiagnosticClass = "canonical-mutation" )
type DBOSDiagnosticError ¶ added in v0.0.3
type DBOSDiagnosticError struct {
Class DBOSDiagnosticClass
Field DBOSDiagnosticField
Stage DBOSDiagnosticStage
Operation OperationID
Workflow string
Value string
Position *int
Reason string
Impact string
Fix string
Cause error
}
DBOSDiagnosticError is the shared closed diagnostic returned by all DBOS adapter boundaries. It satisfies the [C-actionable-errors] constraint: (1) what went wrong, (2) why it happened, (3) where (field), (4) when (stage), (5) impact for the caller, (6) how to fix it.
func (*DBOSDiagnosticError) Error ¶ added in v0.0.3
func (e *DBOSDiagnosticError) Error() string
func (*DBOSDiagnosticError) Unwrap ¶ added in v0.0.3
func (e *DBOSDiagnosticError) Unwrap() error
type DBOSDiagnosticField ¶ added in v0.0.3
type DBOSDiagnosticField string
DBOSDiagnosticField identifies the specific field that caused a rejection.
const ( DBOSDiagFieldMaxRetries DBOSDiagnosticField = "MaxRetries" DBOSDiagFieldBaseInterval DBOSDiagnosticField = "BaseInterval" DBOSDiagFieldBackoffFactor DBOSDiagnosticField = "BackoffFactor" DBOSDiagFieldResultPollingInterval DBOSDiagnosticField = "ResultPollingInterval" DBOSDiagFieldOperation DBOSDiagnosticField = "operation" DBOSDiagFieldContextVersion DBOSDiagnosticField = "context_version" DBOSDiagFieldActor DBOSDiagnosticField = "actor" DBOSDiagFieldCommand DBOSDiagnosticField = "command" DBOSDiagFieldAuthority DBOSDiagnosticField = "authority" DBOSDiagFieldSchema DBOSDiagnosticField = "schema" DBOSDiagFieldTrailing DBOSDiagnosticField = "trailing" DBOSDiagFieldKind DBOSDiagnosticField = "kind" DBOSDiagFieldNestedOpID DBOSDiagnosticField = "nested_operation_id" DBOSDiagFieldSuccessFailure DBOSDiagnosticField = "success_failure" DBOSDiagFieldMessage DBOSDiagnosticField = "message" DBOSDiagFieldConflictAxis DBOSDiagnosticField = "conflict_axis" DBOSDiagFieldConflictIndex DBOSDiagnosticField = "conflict_index" DBOSDiagFieldConditionIndex DBOSDiagnosticField = "condition_index" DBOSDiagFieldConditionKind DBOSDiagnosticField = "condition_kind" DBOSDiagFieldConditionReason DBOSDiagnosticField = "condition_reason" DBOSDiagFieldAssertedJournalID DBOSDiagnosticField = "asserted_journal_id" DBOSDiagFieldActualJournalID DBOSDiagnosticField = "actual_journal_id" DBOSDiagFieldActivityID DBOSDiagnosticField = "activity_id" DBOSDiagFieldExistingJournalID DBOSDiagnosticField = "existing_journal_id" DBOSDiagFieldDescriptorMatch DBOSDiagnosticField = "descriptor_match" DBOSDiagFieldWorkflow DBOSDiagnosticField = "workflow" DBOSDiagFieldContext DBOSDiagnosticField = "context" DBOSDiagFieldRecordedAt DBOSDiagnosticField = "recorded_at" )
type DBOSDiagnosticStage ¶ added in v0.0.3
type DBOSDiagnosticStage string
DBOSDiagnosticStage identifies the step/operation during which a failure occurred.
const ( DBOSDiagStageAdapterConstruction DBOSDiagnosticStage = "adapter-construction" DBOSDiagStageContextEncode DBOSDiagnosticStage = "context-encode" DBOSDiagStageContextDecode DBOSDiagnosticStage = "context-decode" DBOSDiagStageOutcomeEncode DBOSDiagnosticStage = "outcome-encode" DBOSDiagStageOutcomeDecode DBOSDiagnosticStage = "outcome-decode" DBOSDiagStageDomainFoldClassify DBOSDiagnosticStage = "domain-fold-classify" DBOSDiagStageStepCheckpoint DBOSDiagnosticStage = "step-checkpoint" DBOSDiagStageWorkflowTerminalLookup DBOSDiagnosticStage = "workflow-terminal-lookup" DBOSDiagStageApplyPreStart DBOSDiagnosticStage = "apply-pre-start" DBOSDiagStageWorkflowRetrieve DBOSDiagnosticStage = "workflow-retrieve" DBOSDiagStageWorkflowAwait DBOSDiagnosticStage = "workflow-await" DBOSDiagStageCheckpointValidation DBOSDiagnosticStage = "checkpoint-validation" )
type DBOSMutationBytes ¶ added in v0.0.3
type DBOSMutationBytes []byte
DBOSMutationBytes carries the canonical mutation. Its digest is always derived.
type DBOSOperationContextBytes ¶ added in v0.0.3
type DBOSOperationContextBytes []byte
DBOSOperationContextBytes carries operation identity and audit context.
type DBOSStepOptions ¶ added in v0.0.3
type DBOSStepOptions struct {
// MaxRetries is the number of retries after the initial attempt.
// 0 means default (3). Valid nonzero range: 1–12.
MaxRetries int
// BaseInterval is the base exponential back-off interval.
// 0 means default (50 ms). Valid nonzero range: >0 and ≤5 s.
BaseInterval time.Duration
// BackoffFactor is the exponential multiplier applied between retries.
// 0 means default (2). Valid nonzero constraint: finite and ≥1.
BackoffFactor float64
}
DBOSStepOptions configures the retry behaviour of the DBOS step that wraps each atomic domain fold. Zero fields are replaced by package defaults at adapter construction; valid nonzero overrides are copied and validated before registration.
These options map internally and exclusively to the pinned DBOS options:
- MaxRetries → dbos.WithStepMaxRetries
- BaseInterval → dbos.WithStepBaseInterval
- BackoffFactor → dbos.WithStepBackoffFactor
StepName is contract-owned and cannot be overridden by callers.
type DBOSStepOutcome ¶ added in v0.0.3
type DBOSStepOutcome struct {
Schema string `json:"schema"`
OperationID string `json:"operation_id"`
MutationDigest []byte `json:"mutation_digest"`
Success *CanonicalMutationResult `json:"success,omitempty"`
Failure *CanonicalApplyFailure `json:"failure,omitempty"`
// ShortCircuited is a PER-CALL §9.4 replay flag, not journal-anchored canonical
// state (LookupCommitted, a pure read, never short-circuits anything), so it lives
// BESIDE the canonical result rather than inside CanonicalMutationResult -- keeping
// that struct's equality honest for any future == / reflect.DeepEqual user. It is
// informational (audit) only; post-validation compares canonical results, never it.
ShortCircuited bool `json:"short_circuited,omitempty"`
}
DBOSStepOutcome is the closed step checkpoint: exactly one of Success or Failure is non-nil. OperationID and MutationDigest bind the outcome to its operation so post-validation can reject an outcome that drifted from its input.
func (*DBOSStepOutcome) UnmarshalJSON ¶ added in v0.0.4
func (o *DBOSStepOutcome) UnmarshalJSON(raw []byte) error
UnmarshalJSON rejects unknown and duplicate fields before a recovered outcome can reach post-validation. The semantic one-of and typed metadata checks stay in decodeDBOSStepOutcome so direct and recovered delivery share one authority.
type DecisionKind ¶ added in v0.0.3
type DecisionKind = journal.DecisionKind
Journal identity and discriminator types.
type DecisionPage ¶ added in v0.0.4
type DecisionPage = journal.DecisionPage
Journal identity and discriminator types.
type DecisionQuery ¶ added in v0.0.4
type DecisionQuery = journal.DecisionQuery
Journal identity and discriminator types.
type DecisionRow ¶ added in v0.0.4
type DecisionRow = journal.DecisionRow
Journal identity and discriminator types.
type EffectSort ¶ added in v0.0.3
type EffectSort = journal.EffectSort
Journal identity and discriminator types.
type EventContext ¶ added in v0.0.3
type EventContext = journal.EventContext
Journal identity and discriminator types.
type EventContextKind ¶ added in v0.0.3
type EventContextKind = journal.EventContextKind
Journal identity and discriminator types.
type EvidenceKind ¶ added in v0.0.3
type EvidenceKind = journal.EvidenceKind
Journal identity and discriminator types.
type EvidencePage ¶ added in v0.0.4
type EvidencePage = journal.EvidencePage
Journal identity and discriminator types.
type EvidenceQuery ¶ added in v0.0.4
type EvidenceQuery = journal.EvidenceQuery
Journal identity and discriminator types.
type EvidenceRow ¶ added in v0.0.4
type EvidenceRow = journal.EvidenceRow
Journal identity and discriminator types.
type FactCursor ¶ added in v0.0.4
type FactCursor = journal.FactCursor
Journal identity and discriminator types.
type FactFilter ¶ added in v0.0.4
type FactFilter = journal.FactFilter
Journal identity and discriminator types.
type FactPageRequest ¶ added in v0.0.4
type FactPageRequest = journal.FactPageRequest
Journal identity and discriminator types.
type FactQueryAPI ¶ added in v0.0.4
type FactQueryAPI = journal.FactQueryAPI
Journal identity and discriminator types.
type FactSelector ¶ added in v0.0.4
type FactSelector = journal.FactSelector
Journal identity and discriminator types.
type FactTaskScope ¶ added in v0.0.4
type FactTaskScope = journal.FactTaskScope
Journal identity and discriminator types.
type FactTaskScopeKind ¶ added in v0.0.4
type FactTaskScopeKind = journal.FactTaskScopeKind
Condition types (§9.5 pre-conditions).
type FixedActorEntry ¶ added in v0.0.3
type FixedActorEntry = journal.FixedActorEntry
Journal identity and discriminator types.
type FixedSoftwareAgentRegistrarContext ¶ added in v0.10.2
type FixedSoftwareAgentRegistrarContext interface {
RegisterFixedSoftwareAgentContext(ctx context.Context, reg FixedSoftwareAgentRegistration) (SoftwareAgent, error)
}
FixedSoftwareAgentRegistrarContext is an optional capability for atomic fixed software-agent registration using a caller's context. Tracker remains unchanged; trackers from OpenMemory, OpenSQLite and OpenBorrowedSQLite (including its context variant) implement this interface. The legacy registration method uses the same algorithm with context.Background.
A nil or already-canceled context is refused before registration. The caller's context governs borrowed-handle preflight, connection leasing and operation SQL; registration makes one BEGIN attempt rather than retrying. Cancellation does not establish the result of a commit already in flight: the call waits for the transaction and connection cleanup to settle and returns their actual outcome. A successful commit can survive cancellation; a cleanup failure can leave the durable outcome uncertain and retires the connection. No registration continues after the method returns. Cleanup may extend the caller's cancellation deadline.
In borrowed mode, connection creation and initialization belong to the pool's owner. Callers requiring bounded first-use setup must supply a connector that honors its Connect context; this capability does not change pool setup policy.
type FixedSoftwareAgentRegistration ¶ added in v0.0.3
type FixedSoftwareAgentRegistration = journal.FixedSoftwareAgentRegistration
Journal identity and discriminator types.
type FusedGovernedAllocator ¶ added in v0.0.4
type FusedGovernedAllocator struct {
// contains filtered or unexported fields
}
FusedGovernedAllocator owns the DBOS root, exact SQLite system handle, and matching Provenance tracker as one capability. Close shuts down the owned DBOS root; it never closes caller-owned resources because callers supply neither a root nor a database handle.
func OpenFusedGovernedAllocator ¶ added in v0.0.4
func OpenFusedGovernedAllocator(ctx context.Context, config FusedGovernedAllocatorConfig) (*FusedGovernedAllocator, error)
OpenFusedGovernedAllocator creates the only public fused governed-allocation construction path. The exact DBOS system handle remains opaque, preventing a caller from pairing an existing root with a distinct same-file SQLite handle.
func (*FusedGovernedAllocator) Close ¶ added in v0.0.4
func (a *FusedGovernedAllocator) Close(timeout time.Duration) error
Close releases the factory-owned DBOS root and then invalidates only the local borrowed tracker wrapper. It is safe to call repeatedly.
func (*FusedGovernedAllocator) ConfigName ¶ added in v0.0.4
func (a *FusedGovernedAllocator) ConfigName() string
ConfigName makes the allocator's three registered DBOS method workflows (initializeRootWorkflow, allocateWorkflow, allocateComposedWorkflow) stable within its owned root. A root owns exactly one allocator capability.
func (*FusedGovernedAllocator) Launch ¶ added in v0.0.4
func (a *FusedGovernedAllocator) Launch() error
Launch starts the DBOS root created by OpenFusedGovernedAllocator.
func (*FusedGovernedAllocator) RunAllocate ¶ added in v0.0.4
func (a *FusedGovernedAllocator) RunAllocate(ctx context.Context, workflowID string, authority JournalID, request GovernedAllocationRequest) (OperationClosure, error)
RunAllocate executes an allocation under its explicit exact parent start authority. It has no zero-authority overload; fused and standalone paths both reach ReduceAllocation with a mandatory authority value.
func (*FusedGovernedAllocator) RunAllocateComposed ¶ added in v0.0.4
func (a *FusedGovernedAllocator) RunAllocateComposed(ctx context.Context, workflowID string, authority JournalID, request GovernedAllocationComposedRequest) (GovernedAllocationComposedResult, error)
RunAllocateComposed executes allocation plus the closed supplemental journal effect set in one DBOS-owned SQLite transaction. Its workflow identity is the complete canonical composition receipt, so a same workflow ID cannot attach to a changed effect order, payload, or result-slot binding.
func (*FusedGovernedAllocator) RunAllocateComposedBatch ¶ added in v0.0.4
func (a *FusedGovernedAllocator) RunAllocateComposedBatch(ctx context.Context, workflowID string, authority JournalID, request GovernedAllocationComposedRequest) (GovernedAllocationComposedResult, error)
RunAllocateComposedBatch allocates the complete ordered child list and folds its shared supplements in one DBOS-owned SQLite transaction.
func (*FusedGovernedAllocator) RunInitializeRoot ¶ added in v0.0.4
func (a *FusedGovernedAllocator) RunInitializeRoot(ctx context.Context, workflowID string, request RootGenesisRequest) (OperationClosure, error)
RunInitializeRoot executes genesis through the capability's registered DBOS workflow. A caller-supplied workflow ID is additionally bound to the exact canonical fused input before an existing workflow result can be attached.
func (*FusedGovernedAllocator) Tracker ¶ added in v0.0.4
func (a *FusedGovernedAllocator) Tracker() Tracker
Tracker exposes normal Provenance reads and setup registration over the same owned system database. Tracker has no AllocateGoverned method: standalone governed allocation is available only through Session.AllocateGoverned.
type FusedGovernedAllocatorConfig ¶ added in v0.0.4
type FusedGovernedAllocatorConfig struct {
SQLiteDSN string
AppName string
ApplicationVersion string
Logger *slog.Logger
// Participant optionally writes an integration-owned audit or projection
// record in the exact transaction that commits a fused allocation. It is
// intentionally unavailable to the standalone Session path.
Participant GovernedAllocationParticipant
}
FusedGovernedAllocatorConfig is the closed configuration for the one public governed DBOS capability. It deliberately accepts a DSN, not a DBOS context or *sql.DB: the capability opens one owned system handle, gives that exact handle to DBOS, and constructs the fused data source before exposing work.
type GovernedAllocationComposedRequest ¶ added in v0.0.4
type GovernedAllocationComposedRequest = allocation.ComposedRequest
GovernedAllocationComposedRequest is the one composed-allocation contract. It carries 1..MaxGovernedAllocationChildren ordered children, and its SupplementalEffects apply to the complete ordered allocation closure rather than to one child independently. Both the one-child and the multi-child entry points take this exact type; there is no separate batch contract.
type GovernedAllocationComposedResult ¶ added in v0.0.4
type GovernedAllocationComposedResult = allocation.ComposedResult
Supporting types
type GovernedAllocationCompositionVersion ¶ added in v0.0.4
type GovernedAllocationCompositionVersion = allocation.CompositionVersion
Supporting types
type GovernedAllocationError ¶ added in v0.0.4
type GovernedAllocationError = allocation.Error
Supporting types
type GovernedAllocationErrorKind ¶ added in v0.0.4
type GovernedAllocationErrorKind = allocation.ErrorKind
Supporting types
type GovernedAllocationParticipant ¶ added in v0.0.4
type GovernedAllocationParticipant func(context.Context, GovernedAllocationTransaction, GovernedAllocationRequest, OperationClosure) error
GovernedAllocationParticipant writes one integration-owned projection or audit record after a governed allocation has reduced to a successful closure. A nil participant is disabled. Standalone Session.AllocateGoverned does not invoke participants.
Request and closure are defensive copies. A participant can safely inspect them but cannot alter the caller's request, the reducer's persisted result, or a later replayed closure.
DBOS exact workflow replay (the same workflow ID and canonical input) returns its durable output without re-entering this callback. A distinct workflow ID for an already committed OperationID does enter the reducer's reconstruction path and can invoke this callback again. DBOS does not expose a reliable newly-committed versus reconstructed signal at this boundary. Participants must therefore deduplicate by OperationID and validate immutable audit data such as the closure anchor and child row identities before treating a repeat as successful.
A non-nil error is an infrastructure failure, not a typed domain rejection: DBOS rolls back the reducer's domain writes, participant writes, and a successful operation_outputs checkpoint together. DBOS may retain a failed checkpoint for its workflow error outcome.
type GovernedAllocationReferenceScope ¶ added in v0.0.4
type GovernedAllocationReferenceScope = allocation.ReferenceScope
Supporting types
type GovernedAllocationReferenceScopeKind ¶ added in v0.0.4
type GovernedAllocationReferenceScopeKind = allocation.ReferenceScopeKind
Supporting types
type GovernedAllocationRequest ¶ added in v0.0.4
type GovernedAllocationRequest = allocation.GovernedAllocationRequest
Governed allocation is the closed first-class primitive for creating a caller-identified child task and assignment under one exact parent.
type GovernedAllocationSQLResult ¶ added in v0.0.4
GovernedAllocationSQLResult reports the effect of a participant SQL write. It is intentionally independent of database/sql and DBOS driver types.
type GovernedAllocationSQLRow ¶ added in v0.0.4
GovernedAllocationSQLRow is one row returned by a participant query.
type GovernedAllocationSQLRows ¶ added in v0.0.4
type GovernedAllocationSQLRows interface {
Next() bool
Scan(dest ...any) error
Err() error
Close() error
}
GovernedAllocationSQLRows is an iterated participant query result. A participant must close it after use.
type GovernedAllocationTransaction ¶ added in v0.0.4
type GovernedAllocationTransaction interface {
Exec(context.Context, string, ...any) (GovernedAllocationSQLResult, error)
Query(context.Context, string, ...any) (GovernedAllocationSQLRows, error)
QueryRow(context.Context, string, ...any) GovernedAllocationSQLRow
}
GovernedAllocationTransaction is the narrow SQL capability supplied to a GovernedAllocationParticipant. It is the exact DBOS transaction that also contains the governed reducer and its operation_outputs checkpoint.
It deliberately omits database handles, transaction lifecycle operations, and DBOS APIs. DBOS exclusively owns transaction begin, commit, rollback, retry, and durable checkpointing.
type GovernedChildBinding ¶ added in v0.0.4
type GovernedChildBinding = allocation.ChildBinding
Supporting types
type GovernedChildSpec ¶ added in v0.0.4
type GovernedChildSpec = allocation.ChildSpec
Supporting types
type GovernedProducedRow ¶ added in v0.0.4
type GovernedProducedRow = allocation.ProducedRow
Supporting types
type GovernedRequestKind ¶ added in v0.0.4
type GovernedRequestKind = allocation.RequestKind
Supporting types
type HostBoundGovernedAllocator ¶ added in v0.0.4
type HostBoundGovernedAllocator struct {
// contains filtered or unexported fields
}
HostBoundGovernedAllocator is a construction-time-only borrowed runner for a host that already owns the DBOS application root. It registers Provenance's composed workflows on that root and runs them through the caller-supplied SQL handle, but deliberately has no Launch, Close, Tracker, DBOS, or SQL accessor. The host remains the sole lifecycle owner.
func NewHostBoundGovernedAllocator ¶ added in v0.0.4
func NewHostBoundGovernedAllocator(ctx context.Context, root dbos.Context, systemDB *sql.DB, participant GovernedAllocationParticipant) (*HostBoundGovernedAllocator, error)
NewHostBoundGovernedAllocator borrows the two exact local variables used by a host while constructing its engine root: root and the *sql.DB assigned to dbos.Config.SQLiteSystemDB. The DBOS runtime provides no supported pointer inspector, so this constructor does not claim to certify independently assembled pairs; callers must pass the same variables at the one engine construction site. Registration must occur before the host launches root.
The host owns two obligations that this constructor cannot discharge for it, because both happen before the root exists:
- Blank-import "github.com/dbos-inc/dbos-transact-golang/dbos/driver/sqlite" in the binary. The DBOS runtime keeps no SQLite driver of its own and uses whichever driver that import registers, even for a caller-supplied handle. Without it every context construction over SQLite fails at run time, and the runtime loses the error-code extractor it needs to tell a busy or locked database apart from a permanent failure.
- Call RequireSupportedDBOSSystemSchema on the exact *sql.DB, BEFORE the call that builds the root -- dbos.NewContext, or dbos.NewClient, which builds a context of its own. Either call migrates a superseded system database in place while it constructs, and this build supports no such upgrade, so the preflight has no later moment to run in.
func (*HostBoundGovernedAllocator) RunAllocateComposed ¶ added in v0.0.4
func (a *HostBoundGovernedAllocator) RunAllocateComposed(ctx context.Context, workflowID string, authority JournalID, request GovernedAllocationComposedRequest) (GovernedAllocationComposedResult, error)
func (*HostBoundGovernedAllocator) RunAllocateComposedBatch ¶ added in v0.0.4
func (a *HostBoundGovernedAllocator) RunAllocateComposedBatch(ctx context.Context, workflowID string, authority JournalID, request GovernedAllocationComposedRequest) (GovernedAllocationComposedResult, error)
func (*HostBoundGovernedAllocator) RunInitializeRoot ¶ added in v0.0.4
func (a *HostBoundGovernedAllocator) RunInitializeRoot(ctx context.Context, workflowID string, request RootGenesisRequest) (OperationClosure, error)
type IDConversionOptions ¶ added in v0.6.0
type IDConversionOptions struct {
RewriteEffect func(Effect) (Effect, error)
// RewriteContext translates extension-kind SQL context rows. For contexts
// backed by a canonical effect, RewriteEffect must translate the identical
// context too. Canonical condition extension contexts have no rewrite hook:
// they must remain identity-equivalent, otherwise verification fails closed.
RewriteContext func(string, string) (string, error)
}
IDConversionOptions lets external typed owners translate their declared fields. Callbacks must not begin/commit transactions, read a second connection, rewrite prose, or guess digests. Native host bindings remain opaque evidence.
type IDConversionReport ¶ added in v0.6.0
type IDConversionReport = sqlite.IDConversionReport
func ConvertIDsInTx ¶ added in v0.6.0
func ConvertIDsInTx(ctx context.Context, tx *sql.Tx, options IDConversionOptions) (IDConversionReport, error)
type IDFormatInspection ¶ added in v0.6.0
type IDFormatInspection = sqlite.IDFormatInspection
func InspectIDFormat ¶ added in v0.6.0
func InspectIDFormat(ctx context.Context, reader IDFormatReader) (IDFormatInspection, error)
type IDFormatReader ¶ added in v0.6.0
type IDFormatReader interface {
QueryContext(context.Context, string, ...any) (*sql.Rows, error)
QueryRowContext(context.Context, string, ...any) *sql.Row
}
IDFormatReader may be a database or caller-owned SQL transaction. Inspection never activates schema, begins a transaction, or writes a marker.
type InvalidStatusTransition ¶ added in v0.0.3
type InvalidStatusTransition = journal.InvalidStatusTransition
Status-FSM typed error + sentinel (§8.1).
type Journal ¶ added in v0.0.4
type Journal interface {
Facts() FactQueryAPI
QueryTaskEvents(q JournalQueryV1) (JournalTaskEventPageV1, error)
TaskAttributions(taskID TaskID) ([]TaskAttribution, error)
VerifyIntegrity() error
RegisterNamespaceClaim(claim ActorNamespaceClaim) error
RegisterFixedActorEntry(entry FixedActorEntry) error
NamespaceClaims() ([]ActorNamespaceClaim, error)
Apply(in OperationInput) (CommittedResult, error)
LookupCommitted(op OperationID) (CommittedResult, error)
AuthorityGovernsTaskAt(authJID JournalID, task TaskID, beforeJID JournalID) (bool, error)
PreflightSchema() error
ReplayProjections() (ReplayResult, error)
MigrateLegacyBaseline(in MigrationInput) (MigrationResult, error)
}
Journal is the ordered global-journal surface.
type JournalCursorV1 ¶ added in v0.0.3
type JournalCursorV1 = journal.JournalCursorV1
Journal identity and discriminator types.
type JournalKind ¶ added in v0.0.3
type JournalKind = journal.JournalKind
Journal identity and discriminator types.
type JournalQueryV1 ¶ added in v0.0.3
type JournalQueryV1 = journal.JournalQueryV1
Journal identity and discriminator types.
type JournalTaskEventPageV1 ¶ added in v0.0.3
type JournalTaskEventPageV1 = journal.JournalTaskEventPageV1
Journal identity and discriminator types.
type LegacyTaskRow ¶ added in v0.0.3
type LegacyTaskRow = journal.LegacyTaskRow
Journal identity and discriminator types.
type MigrationInput ¶ added in v0.0.3
type MigrationInput = journal.MigrationInput
Journal identity and discriminator types.
type MigrationOwnerUnmappableError ¶ added in v0.0.3
type MigrationOwnerUnmappableError = journal.MigrationOwnerUnmappableError
Journal identity and discriminator types.
type MigrationResult ¶ added in v0.0.3
type MigrationResult = journal.MigrationResult
Journal identity and discriminator types.
type MutationEncodingVersion ¶ added in v0.0.3
type MutationEncodingVersion = journal.MutationEncodingVersion
Journal identity and discriminator types.
type NamespaceCodec ¶ added in v0.0.3
type NamespaceCodec = journal.NamespaceCodec
Journal identity and discriminator types.
type Operation ¶ added in v0.0.3
type Operation struct {
// contains filtered or unexported fields
}
Operation accumulates the ordered effects of one logical operation for Session.Atomic. Effects fold in the order they are added (§9.3.1) — e.g. start an owner-responsibility episode and immediately consume it under the same operation.
func (*Operation) Add ¶ added in v0.0.3
Add appends an already-built effect, the escape hatch for effect shapes without a named helper. Returns the builder for chaining.
func (*Operation) CreateTask ¶ added in v0.0.3
func (o *Operation) CreateTask(id TaskID, title, description string, taskType TaskType, priority Priority, phase Phase) *Operation
CreateTask appends an EffectTaskCreate for a caller-supplied id.
func (*Operation) EndEpisode ¶ added in v0.0.3
func (o *Operation) EndEpisode(assignment AssignmentID, task TaskID) *Operation
EndEpisode appends an owner-responsibility episode end (§14).
func (*Operation) StartEpisode ¶ added in v0.0.3
func (o *Operation) StartEpisode(assignment AssignmentID, task TaskID, occupant ActorID) *Operation
StartEpisode appends an owner-responsibility episode start (§14): the started transition's authority can then govern later effects in the same operation.
type OperationAuthorityID ¶ added in v0.0.3
type OperationAuthorityID = journal.OperationAuthorityID
Operations, effects, results, and authority-lifecycle surface (§2-§4, §9).
type OperationClosure ¶ added in v0.0.4
type OperationClosure = allocation.OperationClosure
Supporting types
type OperationConflict ¶ added in v0.0.3
type OperationConflict = journal.OperationConflict
Journal identity and discriminator types.
type OperationID ¶ added in v0.0.3
type OperationID = journal.OperationID
Journal identity and discriminator types.
func GovernedAllocationSupplementOperationID ¶ added in v0.0.4
func GovernedAllocationSupplementOperationID(external OperationID) OperationID
GovernedAllocationSupplementOperationID returns the stable producer identity used by composed supplemental effects. This pure correlation helper grants no capability to create or execute reserved operations, bind DBOS, or access SQL.
type OperationInput ¶ added in v0.0.3
type OperationInput = journal.OperationInput
Journal identity and discriminator types.
type Option ¶
type Option func(*options)
Option configures a Tracker at creation time.
func WithBorrowedActivationBusyTimeout ¶ added in v0.4.0
WithBorrowedActivationBusyTimeout sets the borrowed schema activation tier only. It does not change ordinary leases, standalone opens, or the 30s retry ceiling. OpenBorrowedSQLiteContext rejects values below one millisecond.
func WithModelRegistry ¶
func WithModelRegistry(r ptypes.ModelRegistry) Option
WithModelRegistry overrides the default model registry used to seed the ml_models table and validate model names at registration time. A nil registry is ignored (the default is preserved).
type OrderDimension ¶ added in v0.0.3
type OrderDimension = journal.OrderDimension
Journal identity and discriminator types.
type OwnedEvidenceRow ¶ added in v0.3.0
type OwnedEvidenceRow = journal.OwnedEvidenceRow
type OwnedMaterialRow ¶ added in v0.3.0
type OwnedMaterialRow = journal.OwnedMaterialRow
type OwnedTaskRow ¶ added in v0.3.0
type OwnedTaskRow = journal.OwnedTaskRow
type OwnerProjectionMismatchError ¶ added in v0.3.0
type OwnerProjectionMismatchError = journal.OwnerProjectionMismatchError
type ProjectionDivergenceError ¶ added in v0.0.3
type ProjectionDivergenceError = journal.ProjectionDivergenceError
Journal identity and discriminator types.
type ReplayResult ¶ added in v0.0.3
type ReplayResult = journal.ReplayResult
Journal identity and discriminator types.
type ResultSlotBinding ¶ added in v0.0.3
type ResultSlotBinding = journal.ResultSlotBinding
Journal identity and discriminator types.
type ResultSlotID ¶ added in v0.0.3
type ResultSlotID = journal.ResultSlotID
Journal identity and discriminator types.
type RootGenesisRequest ¶ added in v0.0.4
type RootGenesisRequest = allocation.RootGenesisRequest
Supporting types
type SchemaPreflightError ¶ added in v0.0.3
type SchemaPreflightError = journal.SchemaPreflightError
Journal identity and discriminator types.
type Session ¶ added in v0.0.3
type Session struct {
// contains filtered or unexported fields
}
Session is the mutation SDK bound to one committing actor and one governing authority (Tracker.As). It is a thin value; obtain a fresh one per (actor, authority) pair. Its verbs are safe for concurrent use to the same extent as the underlying Tracker (the journal write path serializes operations, §9.5).
func (*Session) AddComment ¶ added in v0.0.3
AddComment journals a comment on a task authored by authorID (§6). A UUIDv7 CommentID is minted and carried in the journal payload so a from-empty replay reproduces the SAME comment. The committing actor (this Session's actor) is the who-provenance witness; the authored-by actor may differ and is recorded on the comment.
func (*Session) AddEdge ¶ added in v0.0.3
AddEdge journals a typed edge from sourceID to targetID (§6). For EdgeBlockedBy, the fold enforces cycle detection (ErrCycleDetected). Adding an edge that already exists is a journal-honest re-assertion whose projection is idempotent.
func (*Session) AddLabel ¶ added in v0.0.3
AddLabel journals attaching a label to a task (§6). Idempotent.
func (*Session) AllocateGoverned ¶ added in v0.0.4
func (s *Session) AllocateGoverned(ctx context.Context, request GovernedAllocationRequest) (OperationClosure, error)
AllocateGoverned creates a governed child batch under this Session's exact bound assignment authority. The request repeats ActorID deliberately so its canonical operation identity is self-contained; it must match the Session actor before the transaction begins.
func (*Session) AllocateGovernedComposed ¶ added in v0.0.4
func (s *Session) AllocateGovernedComposed(ctx context.Context, request GovernedAllocationComposedRequest) (GovernedAllocationComposedResult, error)
AllocateGovernedComposed is the one-child entry point over AllocateGovernedComposedBatch, which takes the same request type with 1..MaxGovernedAllocationChildren ordered children.
The liveness gate runs before the child-count check so that every Session verb reports the same failure on a store whose handle has been closed. The other order would answer a dead store with a validation complaint about the request, sending the caller to fix an argument that was never the problem.
func (*Session) AllocateGovernedComposedBatch ¶ added in v0.0.4
func (s *Session) AllocateGovernedComposedBatch(ctx context.Context, request GovernedAllocationComposedRequest) (GovernedAllocationComposedResult, error)
AllocateGovernedComposedBatch creates 1..128 ordered governed children and reduces the shared ordered supplemental closure in the same SQLite transaction. Supplements are authenticated against the complete child list.
func (*Session) Atomic ¶ added in v0.0.3
func (s *Session) Atomic(build func(op *Operation), opts ...ApplyOption) (CommittedResult, error)
Atomic commits the effects the build function accumulates as ONE journaled operation under this Session's actor and authority (§9.5), folding them in builder order with per-effect authorization (§9.3). It returns the committed result (anchor, emitted-event closure, and result-slot bindings). An empty operation is rejected.
func (*Session) CloseTask ¶ added in v0.0.3
CloseTask transitions an existing task {open,in_progress} → closed as ONE journaled operation, committing a provenance.task.closed lifecycle event that also materializes the close reason. Closing an already-closed task is rejected by the static FSM (§8.1) with ErrStatusTransition unless WithForce is passed. Returns ErrNotFound if the task does not exist, ErrGenesisRequired if no genesis authority exists yet.
func (*Session) Create ¶ added in v0.0.3
func (s *Session) Create(namespace, title, description string, taskType TaskType, priority Priority, phase Phase, opts ...ApplyOption) (Task, error)
Create journals the birth of a new task (§8.1): it mints a UUIDv7 TaskID in the given namespace and commits one EffectTaskCreate, so the task is born through the journal (status Open, a non-NULL watermark, creator attribution) rather than a direct write. Returns ErrInvalidID for an empty namespace, ErrGenesisRequired if no genesis authority exists yet.
func (*Session) RemoveEdge ¶ added in v0.0.3
RemoveEdge journals the removal of the edge from sourceID to targetID (§6). Idempotent: removing an absent edge journals the intent and projects a no-op.
func (*Session) RemoveLabel ¶ added in v0.0.3
RemoveLabel journals detaching a label from a task (§6). Idempotent.
func (*Session) Reopen ¶ added in v0.0.3
func (s *Session) Reopen(id TaskID, opts ...ApplyOption) (Task, error)
Reopen transitions an existing task closed → open as ONE journaled operation, committing a provenance.task.reopened lifecycle event. The static FSM rejects a Reopen from any non-closed status (§8.1) with ErrStatusTransition unless WithForce is passed.
func (*Session) Start ¶ added in v0.0.3
func (s *Session) Start(id TaskID, opts ...ApplyOption) (Task, error)
Start transitions an existing task open → in_progress as ONE journaled operation, committing a provenance.task.started lifecycle event. The static FSM rejects a Start from any non-open status (§8.1) with ErrStatusTransition unless WithForce is passed.
func (*Session) Stop ¶ added in v0.0.3
func (s *Session) Stop(id TaskID, opts ...ApplyOption) (Task, error)
Stop transitions an existing task in_progress → open as ONE journaled operation, committing a provenance.task.stopped lifecycle event — halting active work without closing the task. The static FSM rejects a Stop from any non-in_progress status (§8.1) with ErrStatusTransition unless WithForce is passed.
func (*Session) TransferAssignment ¶ added in v0.0.4
func (s *Session) TransferAssignment(request AssignmentTransferRequest, opts ...ApplyOption) (AssignmentTransferResult, error)
TransferAssignment atomically consumes this Session's exact active predecessor assignment authority, ends that predecessor, and starts one exact successor on the same task and slot. Generic Session.Atomic and Journal.Apply retain their ordinary per-effect authorization behavior.
func (*Session) Update ¶ added in v0.0.3
func (s *Session) Update(id TaskID, fields UpdateFields, opts ...ApplyOption) (Task, error)
Update applies a partial METADATA UpdateFields to an existing task as ONE journaled operation (§8.1, §16). It is metadata-only: any of Title/Description/Priority/Phase/Notes emit a single provenance.task.updated event materializing those columns. Status is NOT a metadata field — the lifecycle is governed by the dedicated verbs Start/Stop/CloseTask/ Reopen under the static FSM (§8.1), so a status change never rides an Update. Owner is likewise not settable — owner is reducer-exclusive, moved only through assignment episodes — so a non-nil Owner is rejected with an actionable error. When no field changes anything nothing is committed and the current task is returned. Returns ErrNotFound if the task does not exist, ErrGenesisRequired if no genesis authority exists yet.
type SoftwareAgentRegistrarContext ¶ added in v0.5.0
type SoftwareAgentRegistrarContext interface {
// RegisterSoftwareAgentContext registers a fresh UUIDv7 software agent. ctx
// controls pool acquisition and the single registration transaction. A canceled
// waiter stops within the connection's busy tier, without retrying registration.
// The tracker does not retain ctx. Connection setup remains pool-owner policy.
RegisterSoftwareAgentContext(ctx context.Context, namespace, name, version, source string) (SoftwareAgent, error)
}
SoftwareAgentRegistrarContext is an additive capability implemented by trackers returned by OpenSQLite, OpenMemory, and OpenBorrowedSQLite. Tracker is unchanged so existing implementations remain source-compatible. Callers can assert this interface when registration must honor cancellation.
type StoreUnavailableError ¶ added in v0.0.3
type StoreUnavailableError struct {
}
StoreUnavailableError is returned by every borrowed-tracker read or write once the borrowed SQLite handle's owning DBOS root has shut down (or the caller has otherwise closed the handle). Its six fields are actionable and it is errors.As-discoverable with the underlying driver cause wrapped.
func AsStoreUnavailable ¶ added in v0.0.3
func AsStoreUnavailable(err error) (*StoreUnavailableError, bool)
AsStoreUnavailable extracts a *StoreUnavailableError from err if present, so callers can branch on borrowed-store shutdown without string matching.
func (*StoreUnavailableError) Error ¶ added in v0.0.3
func (e *StoreUnavailableError) Error() string
func (*StoreUnavailableError) Unwrap ¶ added in v0.0.3
func (e *StoreUnavailableError) Unwrap() error
type StoredOperationIdentity ¶ added in v0.0.3
type StoredOperationIdentity = journal.StoredOperationIdentity
Journal identity and discriminator types.
type TaskAttribution ¶ added in v0.0.3
type TaskAttribution = journal.TaskAttribution
Journal identity and discriminator types.
type TaskEventRow ¶ added in v0.0.3
type TaskEventRow = journal.TaskEventRow
Journal identity and discriminator types.
type TaskID ¶
ID types
func ParseTaskID ¶
ParseTaskID parses "namespace/uuid" into a TaskID, splitting on the last slash. See ptypes.ParseTaskID for full documentation.
type TaskProjection ¶ added in v0.0.3
type TaskProjection = journal.TaskProjection
Journal identity and discriminator types.
type TaskStatus ¶ added in v0.0.3
type TaskStatus = journal.TaskStatus
Shared-reducer replay, migration, and preflight surface (§9, §13, §15).
type Tracker ¶
type Tracker interface {
// Close releases all resources held by the tracker.
// It is safe to call Close multiple times.
Close() error
// Journal returns the ordered global-journal surface
// (docs/journal-relational-contract.md): task-event append, JournalID-ordered
// queries, the cumulative attribution projection, subtype-integrity
// verification, and the actor-namespace reservation registry.
Journal() Journal
// As binds a committing actor and a governing authority (a bootstrap or
// assignment authority's JournalID, obtained from a genesis operation or a
// started assignment episode) and returns a Session: the mutation SDK over the
// journal. Every Session mutation is a journaled operation: task lifecycle,
// relationship, and annotation verbs all commit typed effects through Apply
// (docs/journal-relational-contract.md §6 and §9). See Session.
As(actor ActorID, authority JournalID) *Session
// InitializeGovernedRoot creates exactly one root task and root assignment.
// A nil authority is accepted only by this explicit genesis entrypoint.
InitializeGovernedRoot(context.Context, RootGenesisRequest) (OperationClosure, error)
// Show retrieves a task by ID.
// Returns ErrNotFound if no task with that ID exists.
Show(id TaskID) (Task, error)
// List returns tasks matching the filter. An empty ListFilter returns all
// tasks ordered by creation time (ascending).
List(filter ListFilter) ([]Task, error)
// Edges returns all edges originating from id.
// If kind is non-nil, only edges of that kind are returned.
Edges(id TaskID, kind *EdgeKind) ([]Edge, error)
// Blocked returns tasks that are not closed and have at least one open blocker.
Blocked() ([]Task, error)
// Ready returns tasks that are not closed and have no open blockers.
Ready() ([]Task, error)
// DepTree returns all blocked-by edges reachable from id via depth-first
// traversal. The result is in DFS order.
DepTree(id TaskID) ([]Edge, error)
// Ancestors returns all tasks that transitively block the given task.
// In the blocked-by graph, A→B means "A is blocked by B". Ancestors of A
// are B and everything B transitively waits for.
// The given task itself is never included. Returns empty slice if none.
Ancestors(id TaskID) ([]Task, error)
// Descendants returns all tasks that are transitively waiting for the given
// task to complete.
// In the blocked-by graph, A→B means "A is blocked by B". Descendants of B
// are A and everything that transitively depends on A.
// The given task itself is never included. Returns empty slice if none.
Descendants(id TaskID) ([]Task, error)
// Labels returns all labels attached to a task.
Labels(id TaskID) ([]string, error)
// Comments returns all comments on a task in chronological order.
Comments(id TaskID) ([]Comment, error)
// RegisterHumanAgent registers a new human agent with a UUIDv7 ID.
RegisterHumanAgent(namespace, name, contact string) (HumanAgent, error)
// RegisterMLAgent registers a new ML agent. The (provider, modelName) pair
// must exist in the ml_models seed table; returns ErrNotFound if unknown.
RegisterMLAgent(namespace string, role Role, provider Provider, modelName ModelID) (MLAgent, error)
// RegisterSoftwareAgent registers a new software agent with a UUIDv7 ID.
RegisterSoftwareAgent(namespace, name, version, source string) (SoftwareAgent, error)
// RegisterFixedSoftwareAgent atomically registers a namespace claim, fixed
// software agent, and manifest entry under one SQLite transaction and lock.
// Exact retries are inert; missing rows under an exact claim are repaired;
// conflicting existing rows fail before mutation.
RegisterFixedSoftwareAgent(reg FixedSoftwareAgentRegistration) (SoftwareAgent, error)
// Agent returns the base agent (kind only) by ID.
// Returns ErrNotFound if the agent does not exist.
Agent(id AgentID) (Agent, error)
// HumanAgent returns the human agent by ID.
// Returns ErrNotFound if not found; ErrAgentKindMismatch if the agent is
// a different kind.
HumanAgent(id AgentID) (HumanAgent, error)
// MLAgent returns the ML agent by ID.
// Returns ErrNotFound if not found; ErrAgentKindMismatch if the agent is
// a different kind.
MLAgent(id AgentID) (MLAgent, error)
// SoftwareAgent returns the software agent by ID.
// Returns ErrNotFound if not found; ErrAgentKindMismatch if the agent is
// a different kind.
SoftwareAgent(id AgentID) (SoftwareAgent, error)
// StartActivity records the start of an activity for the given agent.
// A UUIDv7 ActivityID is assigned automatically.
StartActivity(agentID AgentID, phase Phase, stage Stage, notes string) (Activity, error)
// StartActivityWithID records the start of an activity using a
// caller-supplied ActivityID, idempotently: a second call with the same id
// is a no-op (INSERT ... ON CONFLICT(id) DO NOTHING) returning the existing
// row. Use a deterministic id (e.g. a name-based UUIDv5 over the caller's
// logical identity) to make activity emission safe to replay, e.g. across
// durable-workflow recovery. Returns the canonical persisted activity.
StartActivityWithID(id ActivityID, agentID AgentID, phase Phase, stage Stage, notes string) (Activity, error)
// EndActivity records the end time of an activity.
// Returns ErrNotFound if the activity does not exist.
EndActivity(id ActivityID) (Activity, error)
// Activities returns all activities, optionally filtered by agent.
// Pass nil to return activities for all agents.
Activities(agentID *AgentID) ([]Activity, error)
}
Tracker is the central API for Provenance task management. All methods are safe for concurrent use. Use OpenSQLite or OpenMemory to obtain an implementation.
func OpenBorrowedSQLite ¶ added in v0.0.3
OpenBorrowedSQLite opens a Tracker that shares the borrowed *sql.DB's physical database via that exact handle. The borrowed handle is never closed by Provenance and is the sole lifecycle token: after it (or its owning DBOS root) closes, every borrowed-tracker operation returns a StoreUnavailableError.
It rejects a nil handle, a handle that cannot be pinged, and an in-memory, temp, or pathless database (a same-file bridge is impossible there), naming OpenMemory as the standalone alternative. Provenance accepts the caller-owned pool limits as supplied and neither validates nor mutates them.
func OpenBorrowedSQLiteContext ¶ added in v0.4.0
func OpenBorrowedSQLiteContext(ctx context.Context, db *sql.DB, opts ...Option) (tracker Tracker, err error)
OpenBorrowedSQLiteContext activates on the caller-owned pool using ctx for every open-time wait. The returned tracker does not retain this context. Cancellation refuses the open; it never closes the caller's pool.
func OpenMemory ¶
OpenMemory creates a Tracker backed by an in-memory SQLite database. Useful for tests and ephemeral sessions. The database is destroyed when the Tracker is closed.
func OpenSQLite ¶
OpenSQLite creates a Tracker backed by a SQLite database at dbPath. The database file and parent directories are created if they do not exist. The schema is applied on every open (idempotent).
Use WithModelRegistry to override the default model registry:
tr, err := provenance.OpenSQLite(path, provenance.WithModelRegistry(provenance.RegistryFromBestiary(bestiary.Models())))
type TransactionEvidenceReader ¶ added in v0.6.0
type TransactionEvidenceReader = sqlite.TransactionEvidenceReader
TransactionEvidenceReader provides QueryEvidence and LookupCommitted bound to the same caller-supplied SQL transaction, including its uncommitted changes. It never leases another connection or commits/rolls back the transaction. Its lifetime ends with that transaction; the caller serializes its use. Evidence page watermarks do not restrict LookupCommitted's transaction view.
func NewTransactionEvidenceReader ¶ added in v0.6.0
func NewTransactionEvidenceReader(ctx context.Context, tx *sql.Tx) (*TransactionEvidenceReader, error)
NewTransactionEvidenceReader binds evidence and committed-result reads to tx. The caller retains transaction ownership and supplies the read context.
Source Files
¶
- actor_ownership.go
- adapter.go
- assignment_starts.go
- assignment_transfer.go
- dbos_adapter.go
- dbos_assignment_transfer.go
- dbos_contract.go
- dbos_outcome.go
- dbos_store.go
- dbos_system_schema.go
- dbos_wire.go
- doc.go
- fixed_software_agent_context.go
- governed_allocation_fused.go
- governed_allocation_participant.go
- governed_allocation_participant_internal.go
- id_conversion.go
- id_format.go
- journal_api.go
- models.go
- options.go
- provenance.go
- reexports.go
- session.go
- software_agent_context.go
- tracker.go
- transaction_evidence.go
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
demo
command
Command demo exercises the full provenance + bestiary integration stack.
|
Command demo exercises the full provenance + bestiary integration stack. |
|
Package compilefail holds external negative fixtures that MUST NOT compile, proving at the type level that adapter callers cannot pass raw DBOS options or override the durable identity.
|
Package compilefail holds external negative fixtures that MUST NOT compile, proving at the type level that adapter callers cannot pass raw DBOS options or override the durable identity. |
|
internal
|
|
|
allocation
Package allocation defines the closed model and codec for governed task allocation.
|
Package allocation defines the closed model and codec for governed task allocation. |
|
dbosfixture
Package dbosfixture owns the immutable DBOS system-database fixtures and the digests that pin them.
|
Package dbosfixture owns the immutable DBOS system-database fixtures and the digests that pin them. |
|
dbossys
Package dbossys owns the DBOS system-database preflight that Provenance runs before it hands a SQLite handle to the DBOS runtime, and the classification of the failures that construction can return.
|
Package dbossys owns the DBOS system-database preflight that Provenance runs before it hands a SQLite handle to the DBOS runtime, and the classification of the failures that construction can return. |
|
fusedtx
Package fusedtx provides the narrow application-SQL boundary used by DBOS fused transactions.
|
Package fusedtx provides the narrow application-SQL boundary used by DBOS fused transactions. |
|
graph
Package graph provides the dominikbraun/graph.Store adapter backed by the Provenance SQLite database.
|
Package graph provides the dominikbraun/graph.Store adapter backed by the Provenance SQLite database. |
|
helpers
Package helpers provides graph traversal utilities for the Provenance blocked-by dependency graph.
|
Package helpers provides graph traversal utilities for the Provenance blocked-by dependency graph. |
|
sqlite
cutover.go owns the two in-transaction primitives the offline identity-format cutover needs but activation's normal open path does not expose:
|
cutover.go owns the two in-transaction primitives the offline identity-format cutover needs but activation's normal open path does not expose: |
|
testcorpus
Package testcorpus provides a pure, typed contract for YAML-backed test corpora.
|
Package testcorpus provides a pure, typed contract for YAML-backed test corpora. |
|
testcorpus/assert
Package assert is the testing-only assertion seam for testcorpus.
|
Package assert is the testing-only assertion seam for testcorpus. |
|
testutil
Package testutil provides shared test fixtures and helpers for Provenance internal packages.
|
Package testutil provides shared test fixtures and helpers for Provenance internal packages. |
|
pkg
|
|
|
namespace
Package namespace derives PROV-O namespace URIs from git repository metadata.
|
Package namespace derives PROV-O namespace URIs from git repository metadata. |
|
ptypes
Package ptypes provides the public type definitions for the Provenance task dependency tracker.
|
Package ptypes provides the public type definitions for the Provenance task dependency tracker. |