Documentation
¶
Overview ¶
Package process composes local request decisions with protected domain operations in one tenant transaction. It owns transaction coordination, not request policy or business invariants.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Coordinator ¶
type Coordinator struct {
// contains filtered or unexported fields
}
func NewCoordinator ¶
func NewCoordinator(requestService *requests.Service, engine *kernel.Kernel, registry *doctype.Registry, begin TenantTransaction, workflows map[string]WorkflowApproval) (*Coordinator, error)
func (*Coordinator) ApproveAndApply ¶
func (c *Coordinator) ApproveAndApply(ctx context.Context, exec policy.Execution, requestID contract.RequestID, command contract.RespondRequest) (contract.ResponseReceipt, error)
ApproveAndApply records an authorized approval response and applies its registered workflow transition atomically when that response resolves the request as approved or rejected. The request service performs current response authorization before Begin is called. A replay returns the original receipt without opening a transaction or rerunning the effect.
type TenantTransaction ¶
type TenantTransaction func(context.Context, contract.TenantID) (database *sql.DB, transaction *sql.Tx, release func(), err error)
TenantTransaction opens one tenant transaction and returns its release callback. Implementations acquire tenant active-work admission before opening SQL and release it only after commit or rollback.
func NewTenantTransactionOpener ¶
func NewTenantTransactionOpener(tenant contract.TenantID, database *sql.DB, admission *dbaccess.Admission) (TenantTransaction, error)
NewTenantTransactionOpener binds the coordinator to one stable tenant DB and the same bounded active-work admission used by its HTTP/request path. An existing request admission is reused; non-HTTP callers acquire a permit here and hold it until the coordinator commits or rolls back.
type WorkflowApproval ¶
WorkflowApproval maps a server-owned governed policy to a named document workflow action. Request bodies cannot choose this mapping or command.
type WorkflowLocalActionExecutor ¶
type WorkflowLocalActionExecutor struct {
// contains filtered or unexported fields
}
WorkflowLocalActionExecutor executes only registered domain operations and commits their idempotency receipt, outbox effects, and workflow progress in the same tenant transaction.
func NewWorkflowLocalActionExecutor ¶
func NewWorkflowLocalActionExecutor(engine *kernel.Kernel, registry *doctype.Registry, begin TenantTransaction, store WorkflowLocalStepStore, schemas workflow.PayloadSchemaRegistry, registrations []workflow.ActionRegistration, builders map[workflow.ActionKey]WorkflowOperationBuilder, leaseAdmission ...WorkflowCapabilityLeaseAdmission) (*WorkflowLocalActionExecutor, error)
func (*WorkflowLocalActionExecutor) ExecuteLocal ¶
func (e *WorkflowLocalActionExecutor) ExecuteLocal(ctx context.Context, claim workflow.Claim, action workflow.ActionContext, key workflow.ActionKey, input workflow.ActionInput, next contract.StepID) (workflow.ActionResult, error)
type WorkflowLocalStepStore ¶
type WorkflowLocalStepStore interface {
ValidateClaimInTx(context.Context, *sql.Tx, workflow.Claim) error
CommitStepInTx(context.Context, *sql.Tx, workflow.StepCommit) error
}
WorkflowLocalStepStore is implemented by the durable workflow SQL store. Both methods operate on the caller-owned transaction.
type WorkflowOperationBuilder ¶
type WorkflowOperationBuilder func(context.Context, workflow.ActionContext, workflow.ActionInput) (kernel.Operation, error)
WorkflowOperationBuilder is trusted assembly code registered for one immutable action key. It translates validated action input into a domain command; workflow JSON cannot select a Go function or command policy.