Documentation
¶
Overview ¶
Package jobtype carries Atlas's engine-wide job-type table: the one mapping from a job type's name to the integer index a job on disk carries.
It exists because the compiler interns strings *per compiled process* (ADR-0004), while the activatable-job index is engine-wide. Two definitions therefore disagree about what a given index means — measured on the tree that found this, `send-email` in one process and `charge-card` in another were both index 16 — so a worker subscribing by job type would be handed the wrong work. ADR-0007 names this table as the correctness prerequisite for the type-keyed pull, and ADR-0157 as step 1 of moving side-effecting work onto workers.
The table has two halves. The **reserved** half is the built-in job types (DMN, user task, the Worker Types, the script languages): their indices are compile-time constants that every builder reserves in order, so the registry seeds itself from compiler.ReservedJobTypes and never persists them — a stored copy could only drift from the constants. The **dynamic** half is the model-authored types (a `<zeebe:taskDefinition type>`), assigned from compiler.FirstDynamicJobTypeIndex upward and persisted, because nothing in the code remembers them.
An index, once issued, is permanent: jobs already on disk carry it, so the registry never recycles one, not even after a record is removed by hand.
Like the design-time stores it sits beside, a Registry does no locking of its own — it is owned by the server's run-loop goroutine, the single writer of deploy-time state (invariant I3).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collision ¶
type Collision struct {
// Name is the model-authored job type that was issued this index.
Name string `json:"name"`
// Index is the index it holds on disk, and that its jobs still carry.
Index int32 `json:"index"`
// NowMeans is the built-in job type that index stands for in this build.
NowMeans string `json:"nowMeans"`
}
Collision is a stored assignment whose index the reserved range has since taken.
func Collisions ¶
Collisions reports the stored assignments in dir whose index is now reserved, without opening a full registry. A directory that was never written is clean, not an error: a fresh server has no table yet.
type Entry ¶
Entry is one persisted assignment: a model-authored job type and the engine-wide index it was given. Reserved types have no Entry.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is the engine-wide job-type table. Build one with NewRegistry.
func NewRegistry ¶
NewRegistry opens (creating if needed) the directory backing the table, seeds the reserved half from the compiler's constants, and loads whatever dynamic assignments are already on disk.
func (*Registry) All ¶
All returns every job type the engine knows, reserved and dynamic alike, in index order — the whole table, which is what the Workers view lists so an operator sees the kinds nobody is serving as well as the ones being worked.
func (*Registry) Dropped ¶
Dropped reports the assignments this registry could not load because the reserved range had grown over their indices. Empty for every healthy store.
A caller is expected to surface it — a server logs it at startup. The registry itself does not refuse, because refusing would take an instance down over a condition whose repair has not been decided yet, and a report that reaches an operator is what that decision needs.
func (*Registry) Index ¶
Index reports the engine-wide index a job type already holds, without assigning one. Use it to read the table; use Registry.Intern to extend it.
func (*Registry) Intern ¶
Intern returns the engine-wide index for a job type, assigning and persisting a new one the first time a name is seen. It is idempotent — the same name always comes back with the same index — which is what lets every deploy and every reload resolve their processes through it.
Its signature is the resolution seam compiler.CompiledProcess.ResolveJobTypes takes, so it can be passed there directly.