BM4: the bus module's keeper keeps an objects store's objects for its max-age-days

The objects template takes max-age-days (absent keeps an object for good): the
keeper plans it as the object store's max age, which the bus applies as the
store's TTL, so a build module's outputs objects go at their seven days.

Builds: design 47 H2 §820 (outputs: 7 days, the store's max-age), §791; H-A-434
This commit is contained in:
2026-11-22 01:32:03 +01:00
parent e335e859d5
commit 46990669de
2 changed files with 9 additions and 1 deletions
@@ -363,6 +363,9 @@ func TestEachTemplateIsPlannedUnderTheModulesNames(t *testing.T) {
{name: "objects", entry: entry("files", catalogue.StorageObjectStore, catalogue.TemplateObjects, map[string]string{"max-mib": "32"}),
objects: "object-store mesh-knowledge_files {32 MiB, age 0, history 0, new, size 0}",
binding: "objects mesh-knowledge_files"},
{name: "objects kept 7 days", entry: entry("outputs", catalogue.StorageObjectStore, catalogue.TemplateObjects, map[string]string{"max-mib": "1024", "max-age-days": "7"}),
objects: "object-store mesh-knowledge_outputs {1024 MiB, age 604800, history 0, new, size 0}",
binding: "objects mesh-knowledge_outputs"},
{name: "ledger", entry: ledger,
objects: "stream mesh-knowledge_records [mesh.ledger.mesh-knowledge.records.history.>] {16 MiB, age 0, history 0, new, size 262144}; " +
"key-value mesh-knowledge_records_state {64 MiB, age 0, history 1, new, size 262144}; " +
+6 -1
View File
@@ -211,8 +211,13 @@ func PlanOf(module string, e catalogue.BusStateEntry) (Plan, error) {
if capMiB <= 0 {
return Plan{}, fmt.Errorf("objects %q gives no %s, which the template objects requires", e.Name, catalogue.OptionCapMiB)
}
// An object is kept for good unless the objects name max-age-days (design 47 H2 H-A-434): the store's max age.
age, err := opts.int(catalogue.OptionAgeDays, 0)
if err != nil {
return Plan{}, err
}
p.Binding.ObjectStore = name
p.Objects = []Object{{Kind: KindObjects, Name: name, Settings: Settings{MaxBytes: capMiB * MiB, Discard: DiscardNew}}}
p.Objects = []Object{{Kind: KindObjects, Name: name, Settings: Settings{MaxBytes: capMiB * MiB, MaxAgeSeconds: days(age), Discard: DiscardNew}}}
case e.Storage == catalogue.StorageLedger && e.Template == catalogue.TemplateLedger:
history, err := logSettings(opts)
if err != nil {