mesh/merge-gate head afd002a9004a merged into trunk 1a2c917abfdb — fail: builds adwaita, asus-zephyrus-g14, build-agent, ca-trust, clipmenu, docker, dunst,…
mesh/repo-check head afd002a9004a merged into trunk 1a2c917abfdb — pass: [release feat/57-config-and-provisioning, judged by its controller 6a6628a76961] T…
mesh/delivery superseded: a newer head of the same pull request
20 lines
1.1 KiB
TypeScript
20 lines
1.1 KiB
TypeScript
// showcase's provisioner — how a consumer is given an instance of what this module provides.
|
|
//
|
|
// **A provider ships the provisioner that creates instances of the resource it offers** (ADR
|
|
// 0040). The mesh asks; this adapts that request to whatever the software actually needs. The
|
|
// reconcile loop is the sdk's (`runProvisioner`); this writes only the per-service half.
|
|
import { runProvisioner, type Provision } from "@novox/mesh-sdk/provisioner";
|
|
|
|
runProvisioner("greeting", {
|
|
async create(p: Provision): Promise<void> {
|
|
// A real provider would create something here — a database, a vhost, an account. This one has
|
|
// nothing to create: what a consumer is told is the manifest's `serves` block, which the mesh
|
|
// fills for this consumer, seals and delivers (ADR 0048), so the consumer never sees this code.
|
|
console.log(`[showcase] greeting ready for ${p.consumer ?? p.as}`);
|
|
},
|
|
async remove(): Promise<void> {
|
|
// Removal is not optional. A provider that cannot take an instance back leaves the mesh unable
|
|
// to unassign a consumer without leaking whatever it was given. Nothing was made, so nothing goes.
|
|
},
|
|
});
|