|
|
|
@@ -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]
|
|
|
|
|