Grants: write withheld hearings in mesh-sdk's layout, so the self-check reads them by the sdk's names (issue 1955)
This commit is contained in:
@@ -3,7 +3,7 @@ module mesh-grants
|
||||
go 1.26.0
|
||||
|
||||
require (
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261029212112-2d2aa7ba9bbd
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261029225351-7bd0f6c2bdf2
|
||||
github.com/nats-io/nats.go v1.54.0
|
||||
)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261029212112-2d2aa7ba9bbd h1:WhqMEXFZ9Zc+fEfLsnf1jhhGkc4IqMwUpXXwZq+V3+E=
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261029212112-2d2aa7ba9bbd/go.mod h1:ouERNpZizzwZ0HLEtAypsY9FR20FyUgUYRni6J7kVCY=
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261029225351-7bd0f6c2bdf2 h1:LXFwlVh0fGcOTU41PNkZDknHF070F/mhVy8Te6wKr3Q=
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261029225351-7bd0f6c2bdf2/go.mod h1:ouERNpZizzwZ0HLEtAypsY9FR20FyUgUYRni6J7kVCY=
|
||||
github.com/antithesishq/antithesis-sdk-go v0.7.0-default-no-op h1:Z/MZK75wC/NSrkgqeNIa7jexam9uWzhLmFTSCPI/kn0=
|
||||
github.com/antithesishq/antithesis-sdk-go v0.7.0-default-no-op/go.mod h1:FQyySiasQQM8735Ddel3MRojmy4dA1IqCeyJ5jmPMbI=
|
||||
github.com/google/go-tpm v0.9.8 h1:slArAR9Ft+1ybZu0lBwpSmpwhRXaa85hWtMinMyRAWo=
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.novox.be/novox/mesh-sdk/go/buscompose"
|
||||
@@ -15,25 +14,15 @@ import (
|
||||
// the account every session there shares. The part writes each such hearing to its state `withheld`, on change only, so the
|
||||
// self-check's probe D-heard reads it from the bus in place of the controller's store.
|
||||
//
|
||||
// Layout: key `<module>.<stream, lower case>.<machine>` (the controller's condition id of it); value WithheldHearing.
|
||||
const StateWithheld = "withheld"
|
||||
// Layout (mesh-sdk buscompose): key `<module>.<stream, lower case>.<machine>` (the controller's condition id of it); value
|
||||
// buscompose.WithheldHearing; readers name buscompose.GrantsWithheldRead.
|
||||
const StateWithheld = buscompose.GrantsWithheldState
|
||||
|
||||
// WithheldHearing is one withheld hearing: the machine, the module, the restricted stream and its emitter, the plain
|
||||
// words of it and the remedy (buscompose.Withheld.Said), and when the part first wrote it as it stands.
|
||||
type WithheldHearing struct {
|
||||
V int `json:"v"`
|
||||
Node string `json:"node"`
|
||||
Module string `json:"module"`
|
||||
Stream string `json:"stream"`
|
||||
Emitter string `json:"emitter"`
|
||||
Said string `json:"said"`
|
||||
At time.Time `json:"at"`
|
||||
}
|
||||
// WithheldHearing is one withheld hearing, as mesh-sdk lays it (buscompose.WithheldHearing).
|
||||
type WithheldHearing = buscompose.WithheldHearing
|
||||
|
||||
// WithheldKey is a withheld hearing's key in StateWithheld.
|
||||
func WithheldKey(w buscompose.Withheld) string {
|
||||
return w.Module + "." + strings.ToLower(w.Stream) + "." + w.Node
|
||||
}
|
||||
// WithheldKey is a withheld hearing's key in StateWithheld (buscompose.WithheldKey).
|
||||
func WithheldKey(w buscompose.Withheld) string { return buscompose.WithheldKey(w) }
|
||||
|
||||
// WithheldWritten is what one pass did to StateWithheld.
|
||||
type WithheldWritten struct {
|
||||
@@ -52,7 +41,7 @@ func (p *Part) writeWithheld(res *Result, in Inputs, recs buscompose.Records) {
|
||||
res.Withheld = done
|
||||
want := map[string]WithheldHearing{}
|
||||
for _, w := range now {
|
||||
want[WithheldKey(w)] = WithheldHearing{V: 1, Node: w.Node, Module: w.Module, Stream: w.Stream, Emitter: w.Emitter, Said: w.Said()}
|
||||
want[WithheldKey(w)] = WithheldHearing{V: buscompose.WithheldVersion, Node: w.Node, Module: w.Module, Stream: w.Stream, Emitter: w.Emitter, Said: w.Said()}
|
||||
}
|
||||
for _, key := range sortedKeys(want) {
|
||||
h := want[key]
|
||||
|
||||
Reference in New Issue
Block a user