Documentation
¶
Overview ¶
Package task is the module manifest: what the kernel needs to know about tasks that it cannot learn from a function call.
It is the shape every module follows: contracts/, internal/, and one exported function taking a struct of typed dependencies and returning a module.Module. The application constructs it in dependency order. Compilation checks the dependency types; composition tests exercise the values supplied.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Migrations = db.MigrationSource{ Owner: "task", Files: db.Sub(schema, "migrations"), Adopts: []db.Adoption{{Owner: "platformkit", Versions: []int64{4}}}, }
Migrations is this module's SQL as one source — the tasks table and its indexes — owned as "task". The manifest hands the kernel the same files and adoption, and a test composes the schema it needs beside the foundation: dbtest.Schema(t, task.Migrations).
The files keep the version numbers they had when the foundation applied them under its own name, so an installation migrated before this module owned its SQL is adopted by checksum rather than migrated again (see db.Adoption and docs/adr/0011). New files continue from the highest number.
Functions ¶
func NewService ¶ added in v1.1.0
NewService constructs task lifecycle commands for application composition. Pass the returned value through Deps.Service to share it with task routes.
Types ¶
type Deps ¶
type Deps struct {
// Service shares one lifecycle implementation with product callers. A
// policy-enabled composition supplies NewServiceWithPolicy here and hands
// the same service to its other modules.
Service contracts.Service
// Policy optionally refines assignment and resolution for the locked task.
// Existing route grants still apply. System SLA maintenance is independent.
// Supply either Policy or a preconfigured Service, never both.
Policy tenancy.Policy
// Tenants is how the SLA sweep reaches active tenants. The application
// supplies tenant/contracts.Active over its tenant service.
Tenants jobs.TenantLister
// SweepEvery is how often the sweep runs; zero means a minute. The promise
// this module keeps is measured in hours, so a minute of lag on noticing a
// breach is free and anything faster is a query per tenant per tick for
// nobody's benefit. A test sets it lower.
SweepEvery time.Duration
}
Deps is what this module cannot make for itself: a struct rather than a parameter list, so adding one is a named field at every call site rather than a fourth positional argument. Every module follows this, and an empty Deps is a module that needs nothing.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package contracts is everything another module, an app or a test may know about tasks: the entity, the events, the permissions and the Service interface.
|
Package contracts is everything another module, an app or a test may know about tasks: the entity, the events, the permissions and the Service interface. |
|
tasktest
Package tasktest is the conformance suite for contracts.Service, and a fake that passes it.
|
Package tasktest is the conformance suite for contracts.Service, and a fake that passes it. |
|
Package domain owns portable task decisions.
|
Package domain owns portable task decisions. |
|
Package internal is every implementation of the task module.
|
Package internal is every implementation of the task module. |