Node-engine: the have, the node's facts, the record, the health report and the data items are the seat's contract types, written through the node-engine client; the interim bridge is gone (Have group, ADR 0634 §1, §4; issue 1966)
Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
This commit is contained in:
@@ -4,13 +4,15 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient"
|
||||
"git.novox.be/novox/mesh-contracts/go/seats/nodeengine"
|
||||
"github.com/novox/mesh-host/internal/buckets"
|
||||
engcomp "github.com/novox/mesh-host/internal/compositions"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.novox.be/novox/mesh-sdk/go/catalogue"
|
||||
"git.novox.be/novox/mesh-sdk/go/delivery"
|
||||
"github.com/novox/mesh-host/internal/compose"
|
||||
"github.com/novox/mesh-host/internal/compose/frombus"
|
||||
)
|
||||
@@ -62,7 +64,7 @@ func (c *Composer) publishData(ctx context.Context) {
|
||||
items, unplaced, held, err := dataItemsOf(ctx, itemsReader{reader{c: c}}, c.env.Mesh, scope)
|
||||
if err != nil {
|
||||
c.sayData("the data items of this node's modules cannot be worked out, and what the engine's state " +
|
||||
delivery.EngineDataBucket + " holds stands; " + c.oweData() + ": " + err.Error())
|
||||
buckets.Data + " holds stands; " + c.oweData() + ": " + err.Error())
|
||||
return
|
||||
}
|
||||
// A module held for a refused manifest declares nothing this pass can read: it is named, its other modules' items
|
||||
@@ -83,7 +85,7 @@ func (c *Composer) publishData(ctx context.Context) {
|
||||
c.mu.Unlock()
|
||||
wrote, removed, err := c.writeData(ctx, items, digests, held)
|
||||
if err != nil {
|
||||
c.sayData("the data items of this node's modules are not all kept in " + delivery.EngineDataBucket +
|
||||
c.sayData("the data items of this node's modules are not all kept in " + buckets.Data +
|
||||
"; " + c.oweData() + ": " + err.Error())
|
||||
return
|
||||
}
|
||||
@@ -93,7 +95,7 @@ func (c *Composer) publishData(ctx context.Context) {
|
||||
c.sayData("")
|
||||
if wrote+removed > 0 {
|
||||
c.env.Say(fmt.Sprintf("the data items of this node's modules: %d key(s) of %s written, %d deleted",
|
||||
wrote, delivery.EngineDataBucket, removed))
|
||||
wrote, buckets.Data, removed))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,7 +147,7 @@ func (c *Composer) digestsByModule() map[string]string {
|
||||
func (c *Composer) writeData(ctx context.Context, items map[string][]catalogue.PlacedDataItem, digests map[string]string, held map[string]string) (wrote, removed int, err error) {
|
||||
store := c.env.Data
|
||||
if c.dataKept == nil {
|
||||
pattern, err := delivery.EngineDataNodeKeys(c.env.Node)
|
||||
pattern, err := nodeengineclient.DataNodeKeys(c.env.Node)
|
||||
if err != nil {
|
||||
return 0, 0, err
|
||||
}
|
||||
@@ -176,7 +178,7 @@ func (c *Composer) writeData(ctx context.Context, items map[string][]catalogue.P
|
||||
if len(items[module]) == 0 {
|
||||
continue
|
||||
}
|
||||
key, err := delivery.EngineDataKey(c.env.Node, module)
|
||||
key, err := nodeengineclient.DataKey(c.env.Node, module)
|
||||
if err != nil {
|
||||
failed = append(failed, err.Error())
|
||||
continue
|
||||
@@ -185,7 +187,7 @@ func (c *Composer) writeData(ctx context.Context, items map[string][]catalogue.P
|
||||
if !ok {
|
||||
digest = digests[""] // run inside the node's own composition
|
||||
}
|
||||
raw, err := delivery.EncodeEngineData(delivery.EngineData{Node: c.env.Node, Module: module, Digest: digest, Items: items[module]})
|
||||
raw, err := nodeengineclient.EncodeData(nodeengine.DataByNodeModuleValue{Node: c.env.Node, Module: module, Digest: digest, Items: placedItems(items[module])})
|
||||
if err != nil {
|
||||
failed = append(failed, err.Error())
|
||||
continue
|
||||
@@ -232,9 +234,19 @@ func (c *Composer) writeData(ctx context.Context, items map[string][]catalogue.P
|
||||
// heldKey is whether key is the key of a module held for a refused manifest, which stands as it was.
|
||||
func heldKey(node, key string, held map[string]string) bool {
|
||||
for module := range held {
|
||||
if k, err := delivery.EngineDataKey(node, module); err == nil && k == key {
|
||||
if k, err := nodeengineclient.DataKey(node, module); err == nil && k == key {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// placedItems are a module's data items as the state data carries them.
|
||||
func placedItems(in []catalogue.PlacedDataItem) []nodeengine.PlacedDataItem {
|
||||
out := make([]nodeengine.PlacedDataItem, 0, len(in))
|
||||
for _, i := range in {
|
||||
out = append(out, nodeengine.PlacedDataItem{Module: i.Module, Item: i.ID, Class: i.Class, Path: i.Path,
|
||||
CoveredBy: i.CoveredBy, Protection: i.Protection, Measure: i.Measure})
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user