From 771471c83b32ddcb00a0d61db1e67c84e7eae044 Mon Sep 17 00:00:00 2001 From: jochen Date: Fri, 13 Nov 2026 11:44:20 +0100 Subject: [PATCH] D3 judge-objects-cap: a state may name objects-max-mib for its objects store MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The state template takes the option `objects-max-mib` (mesh-sdk S5's name and bounds): within the objects' bounds it is accepted, outside them refused; every other option of today keeps its verdict. Builds: design 47 G §513, §547, A-343 Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h --- modules/mesh-delivery-indexer/judge/busstate.go | 3 +++ modules/mesh-delivery-indexer/judge/busstate_test.go | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/modules/mesh-delivery-indexer/judge/busstate.go b/modules/mesh-delivery-indexer/judge/busstate.go index bd7c0cf6..5db56a78 100644 --- a/modules/mesh-delivery-indexer/judge/busstate.go +++ b/modules/mesh-delivery-indexer/judge/busstate.go @@ -49,6 +49,9 @@ var busTemplates = map[string]busTemplate{ catalogue.OptionTimeToLive: {kind: optionInt, least: 1, most: 315360000}, catalogue.OptionLifetimePerKey: {kind: optionFlag}, catalogue.OptionPerMachine: {kind: optionFlag}, + // The cap of the state's own objects store `-objects`, for a state needing more than the cap planned for it + // (design 47 G §513, §547). + catalogue.OptionObjectsCapMiB: {kind: optionInt, least: catalogue.ObjectsLeastMiB, most: catalogue.ObjectsMostMiB}, }, }, catalogue.TemplateEvents: { diff --git a/modules/mesh-delivery-indexer/judge/busstate_test.go b/modules/mesh-delivery-indexer/judge/busstate_test.go index 8f68a4b7..8c97ec71 100644 --- a/modules/mesh-delivery-indexer/judge/busstate_test.go +++ b/modules/mesh-delivery-indexer/judge/busstate_test.go @@ -52,6 +52,10 @@ func TestBusStateIsJudgedOnce(t *testing.T) { {"template on another storage type", manifest(`{"name":"x","storage":"stream","template":"state"}`), []string{"\"x\"", "template state is on the storage type key-value"}}, {"past values 0", manifest(`{"name":"x","storage":"key-value","template":"state","options":{"history":0}}`), []string{"\"x\"", "options \"history\" is 0", "0 is refused"}}, {"past values 65", manifest(`{"name":"x","storage":"key-value","template":"state","options":{"history":65}}`), []string{"\"x\"", "\"history\" is 65", "1 to 64"}}, + // Design 47 G §513, §547: a state needing more for its objects store names objects-max-mib, within the objects' bounds. + {"an objects cap on a state", manifest(`{"name":"x","storage":"key-value","template":"state","options":{"objects-max-mib":64}}`), nil}, + {"an objects cap of 0", manifest(`{"name":"x","storage":"key-value","template":"state","options":{"objects-max-mib":0}}`), []string{"\"x\"", "\"objects-max-mib\" is 0"}}, + {"an objects cap over 8192", manifest(`{"name":"x","storage":"key-value","template":"state","options":{"objects-max-mib":8193}}`), []string{"\"x\"", "\"objects-max-mib\" is 8193"}}, {"a lifetime that is no number", manifest(`{"name":"x","storage":"key-value","template":"state","options":{"ttl-seconds":"soon"}}`), []string{"\"x\"", "\"ttl-seconds\""}}, {"events age over 30 days", manifest(`{"name":"x","storage":"stream","template":"events","options":{"events":["seen"],"max-age-days":31}}`), []string{"\"x\"", "\"max-age-days\" is 31", "1 to 30"}}, {"events cap over 8192", manifest(`{"name":"x","storage":"stream","template":"events","options":{"events":["seen"],"max-mib":8193}}`), []string{"\"x\"", "\"max-mib\" is 8193"}},