Module state is hq ADR 0202: 0201 landed first for a provider's derivations

This commit is contained in:
jochen
2026-10-04 03:44:50 +02:00
parent 17b8f14fe1
commit 78915f9f7a
12 changed files with 24 additions and 24 deletions
+1 -1
View File
@@ -320,7 +320,7 @@ func retentionOf(r Retention) nats.RetentionPolicy {
}
// EnsureBucket creates a module's bucket if it is absent and brings its options to match if it is
// present (novox/hq ADR 0201).
// present (novox/hq ADR 0202).
//
// **An update, never a delete and recreate**, for the reason a stream is updated: recreating
// discards what the bucket holds, and what a module's state holds is data. The mesh's caps are
+1 -1
View File
@@ -46,7 +46,7 @@ type Membership struct {
// it here rather than keeping a definition of its own.
Mesh []string `json:"mesh,omitempty"`
// State is every bucket this module's code may reach, by the name it uses for each, and whether
// it may write it (novox/hq ADR 0201): the runtime answers a bundle's state verbs from this list
// it may write it (novox/hq ADR 0202): the runtime answers a bundle's state verbs from this list
// and refuses, with the reason, what is not on it — the bus enforces only the union over every
// module on the machine.
State []StateIssued `json:"state,omitempty"`
+3 -3
View File
@@ -104,7 +104,7 @@ type Principal struct {
Invokes []string
// State is the local names of the state this principal's module keeps, and Reads the state of
// others it reads as `<module>.<name>` (novox/hq ADR 0201): a bucket each, kept by the owner's
// others it reads as `<module>.<name>` (novox/hq ADR 0202): a bucket each, kept by the owner's
// instances and read by whoever declares it.
State []string
Reads []string
@@ -427,7 +427,7 @@ func PermissionsFor(p Principal) (Permissions, error) {
}
}
// 5. Its state, and the state of others it reads (novox/hq ADR 0201): every one read and
// 5. Its state, and the state of others it reads (novox/hq ADR 0202): every one read and
// watched, its own written too.
pub = append(pub, stateGrants(p.Module, p.State, p.Reads)...)
@@ -497,7 +497,7 @@ func PermissionsFor(p Principal) (Permissions, error) {
"$JS.API.CONSUMER.MSG.NEXT."+stream+"."+durable,
"$JS.ACK."+stream+"."+durable+".>")
}
// **And it keeps and reads state for the modules it carries** (novox/hq ADR 0201): the union
// **And it keeps and reads state for the modules it carries** (novox/hq ADR 0202): the union
// of what each may do with a bucket — an owner's write, a reader's read. That one module's code
// does not write another's bucket through it is the runtime's to keep, from the membership
// each assignment is issued, as it keeps each module's events under that module's own name.
+4 -4
View File
@@ -6,7 +6,7 @@ import (
"strings"
)
// A module's state on the bus (novox/hq ADR 0201, design 32 §4, design 25 §3).
// A module's state on the bus (novox/hq ADR 0202, design 32 §4, design 25 §3).
//
// A module names the state it keeps (`state`) and the state of others it reads (`reads`), and each
// is a key-value bucket: the server's own last-per-subject stream with direct reads, delete markers
@@ -44,7 +44,7 @@ func (b Bucket) Bucket() string { return BucketName(b.Module, b.Name) }
// Why is carried into the server's description of the bucket, so somebody reading the server's
// own state finds whose it is and why it is kept.
func (b Bucket) Why() string {
return fmt.Sprintf("%s's state %q (novox/hq ADR 0201): its current value per key, written by %s, "+
return fmt.Sprintf("%s's state %q (novox/hq ADR 0202): its current value per key, written by %s, "+
"read by whatever declares it reads it; kept when %s is unassigned, because it is data",
b.Module, b.Name, b.Module, b.Module)
}
@@ -100,7 +100,7 @@ func stateGrants(module string, keeps []string, reads []string) []string {
}
// StateIssued is one bucket an assignment may reach, by the name its module uses for it: its own
// state by the local name, another's as `<module>.<name>` (novox/hq ADR 0201).
// state by the local name, another's as `<module>.<name>` (novox/hq ADR 0202).
type StateIssued struct {
Name string `json:"name"`
Bucket string `json:"bucket"`
@@ -142,7 +142,7 @@ type BucketAsserter interface {
// RaiseBuckets asserts every declared bucket and answers the buckets on the server that nothing
// declares any more.
//
// **Those are reported, never removed** (novox/hq ADR 0201, ADR 0030): what a module stored is
// **Those are reported, never removed** (novox/hq ADR 0202, ADR 0030): what a module stored is
// data, and a manifest edited, a module renamed or a catalogue entry dropped is an ordinary day's
// work that must not take data with it. Removing one is a person's act.
func RaiseBuckets(a BucketAsserter, buckets []Bucket) (undeclared []string, err error) {
+2 -2
View File
@@ -33,9 +33,9 @@ type Declared struct {
Watches []Seat
// Invokes are the tools it calls, `<module>.<tool>` or `*` (novox/hq ADR 0152).
Invokes []string
// State is the state it keeps, each a bucket its instances write (novox/hq ADR 0201).
// State is the state it keeps, each a bucket its instances write (novox/hq ADR 0202).
State []Bucket
// Reads are other modules' state it reads, each `<module>.<name>` (novox/hq ADR 0201).
// Reads are other modules' state it reads, each `<module>.<name>` (novox/hq ADR 0202).
Reads []string
}