diff --git a/go/seatdef/seatdef.go b/go/seatdef/seatdef.go index d283899..92537e5 100644 --- a/go/seatdef/seatdef.go +++ b/go/seatdef/seatdef.go @@ -221,6 +221,12 @@ type Verb struct { // NeedsApproval marks the verb for every holder: the operator approves a call of it first (design 46 *The approval // mark* §2). NeedsApproval bool `json:"needs-approval,omitempty"` + // ByCaller says the holder's process answers the verb itself and tells callers apart by the account the bus proved + // (design 47 G §554, §621, §697). + ByCaller bool `json:"by-caller,omitempty"` + // Chunks says the holder's process sends the answer's file in chunks, each acknowledged by the caller, on the + // subjects mesh.seat..chunk... and mesh.seat..ack... (design 47 G §681). + Chunks bool `json:"chunks,omitempty"` } // The streams an accepted kind may ride (design 47 G §415). @@ -402,6 +408,8 @@ type State struct { History int `json:"history,omitempty"` MaxAgeDays int `json:"max-age-days,omitempty"` Description string `json:"description,omitempty"` + // View is true when the seat offers the state as a view for a module to follow by `consumes` (design 47 G §699). + View bool `json:"view,omitempty"` } // KeyForm is one form a state's key takes: a pattern of named parts (`.`, a part between angle brackets, diff --git a/go/seatdef/seatdef_test.go b/go/seatdef/seatdef_test.go index abaa972..2678f76 100644 --- a/go/seatdef/seatdef_test.go +++ b/go/seatdef/seatdef_test.go @@ -84,6 +84,8 @@ func TestADefinitionIsReadStrictlyNamingWhatIsWrong(t *testing.T) { `"domain":"Core","decision":"ADR 1","records":[{"name":"asks"}],`, 1), "records: a field the format does not know"}, {"a state with a key form and a value", withState(whole, `{"name":"asks","template":"state","writer":"caller", "history":3,"key-forms":[{"key":".","value":{"type":"object"}}]}`), ""}, + {"a state offered as a view", withState(whole, `{"name":"asks","template":"state","view":true, + "key-forms":[{"key":"","value":{"type":"object"}}]}`), ""}, {"a stream state with an age", withState(whole, `{"name":"placement","template":"events","max-age-days":7, "key-forms":[{"key":"changed.","value":{"type":"object"}}]}`), ""}, {"a state of an unknown template", withState(whole, `{"name":"asks","template":"bucket", @@ -142,6 +144,8 @@ func TestADefinitionIsReadStrictlyNamingWhatIsWrong(t *testing.T) { {"an acting rule on another kind", strings.Replace(listGrain, `"verbs":`, `"acts":[{"step":"build","on":"kind:Image"}],"verbs":`, 1), "acts[0].on"}, {"a verb marked for approval", strings.Replace(whole, `"name":"list",`, `"name":"list","needs-approval":true,`, 1), ""}, {"a verb marked with a word that is no boolean", strings.Replace(whole, `"name":"list",`, `"name":"list","needs-approval":"yes",`, 1), "not a seat definition's JSON"}, + {"a verb answered by its caller's account, in chunks", strings.Replace(whole, `"name":"list",`, `"name":"list","by-caller":true,"chunks":true,`, 1), ""}, + {"a verb's by-caller that is no boolean", strings.Replace(whole, `"name":"list",`, `"name":"list","by-caller":"yes",`, 1), "not a seat definition's JSON"}, {"a bodies section", strings.Replace(whole, `"family":`, `"bodies":{"Finding":{"type":"object"}},"family":`, 1), ""}, {"one kind on two streams", strings.Replace(whole, `"events":`, `"accepts":[{"name":"step","body":{},"stream":"check"},{"name":"step","body":{},"stream":"delivery"}],"events":`, 1), ""},