I13 state-cap-64: a state's max-mib is at most 64
Builds: design 47 H2 H-A-678, H-A-694
This commit is contained in:
@@ -40,6 +40,9 @@ type busTemplate struct {
|
||||
fixed string
|
||||
}
|
||||
|
||||
// stateMostMiB is the most a state entry's bucket holds, ADR 0690 §1 (design 47 H2 H-A-678, H-A-694).
|
||||
const stateMostMiB = 64
|
||||
|
||||
// busTemplates are the six templates of design 25 § 12.1 and the bounds of its table.
|
||||
var busTemplates = map[string]busTemplate{
|
||||
catalogue.TemplateState: {
|
||||
@@ -50,8 +53,9 @@ var busTemplates = map[string]busTemplate{
|
||||
catalogue.OptionTimeToLive: {kind: optionInt, least: 1, most: 315360000},
|
||||
catalogue.OptionLifetimePerKey: {kind: optionFlag},
|
||||
catalogue.OptionPerMachine: {kind: optionFlag},
|
||||
// A-277: a state's cap is an option of its template, read as the old state section reads it.
|
||||
catalogue.OptionCapMiB: {kind: optionInt, least: catalogue.ObjectsLeastMiB, most: catalogue.ObjectsMostMiB},
|
||||
// A-277: a state's cap is an option of its template, read as the old state section reads it; ADR 0690 §1 keeps
|
||||
// its bucket at 64 MiB at most (design 47 H2 H-A-678, H-A-694).
|
||||
catalogue.OptionCapMiB: {kind: optionInt, least: catalogue.ObjectsLeastMiB, most: stateMostMiB},
|
||||
// A-314: the cap of the state's own objects store `<state>-objects`, an integer above zero.
|
||||
catalogue.OptionObjectsCapMiB: {kind: optionInt, least: catalogue.ObjectsLeastMiB, most: catalogue.ObjectsMostMiB},
|
||||
},
|
||||
|
||||
@@ -64,7 +64,8 @@ func TestBusStateIsJudgedOnce(t *testing.T) {
|
||||
{"objects without a cap", manifest(`{"name":"x","storage":"object-store","template":"objects"}`), []string{"\"x\"", "\"max-mib\" is missing"}},
|
||||
{"when full given as an option", manifest(`{"name":"x","storage":"stream","template":"log","options":{"when-full":"drop-oldest"}}`), []string{"\"x\"", "\"when-full\"", "fixed"}},
|
||||
// A-277: a state's max-mib is an option of its template; an approvals state is §677's (key-ttl, 48 hours, at most 64 MiB).
|
||||
{"a state capped at 256 MiB", manifest(`{"name":"x","storage":"key-value","template":"state","options":{"max-mib":256}}`), nil},
|
||||
{"a state capped at 64 MiB (H-A-678)", manifest(`{"name":"x","storage":"key-value","template":"state","options":{"max-mib":64}}`), nil},
|
||||
{"a state capped at 65 MiB (H-A-678, H-A-694)", manifest(`{"name":"x","storage":"key-value","template":"state","options":{"max-mib":65}}`), []string{"\"x\"", "\"max-mib\" is 65"}},
|
||||
{"a state cap over 8192", manifest(`{"name":"x","storage":"key-value","template":"state","options":{"max-mib":8193}}`), []string{"\"x\"", "\"max-mib\" is 8193"}},
|
||||
{"an approvals state as §677 declares it", manifest(`{"name":"approvals","storage":"key-value","template":"state","options":{"key-ttl":true,"ttl-seconds":172800,"max-mib":64}}`), nil},
|
||||
{"an approvals state with the default cap", manifest(`{"name":"approvals","storage":"key-value","template":"state","options":{"key-ttl":true,"ttl-seconds":172800}}`), nil},
|
||||
|
||||
Reference in New Issue
Block a user