Revert G's mesh-sdk merge (#189): G merged half, and today's validator refuses G's delivery parts
mesh/delivery merged: source.main moved to novox/mesh-sdk@27da949140c6
mesh/check being carried to 8afc3ebdf371 on 93e0a7b50d90 | from 27da949140c6
mesh/delivery merged: source.main moved to novox/mesh-sdk@27da949140c6
mesh/check being carried to 8afc3ebdf371 on 93e0a7b50d90 | from 27da949140c6
The group feat/47-G-join11 merged 3 of 17 members on 2026-11-13; G's mesh-sdk alone on main breaks 25 trunk
modules. The operator chose to put the order right: a reader release first, then G whole. This restores main
to 8fbba810 exactly.
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
@@ -1,78 +0,0 @@
|
||||
package stateobjects
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
stdio "git.novox.be/novox/mesh-sdk/go"
|
||||
"git.novox.be/novox/mesh-sdk/go/busstate"
|
||||
"git.novox.be/novox/mesh-sdk/go/catalogue"
|
||||
)
|
||||
|
||||
// ForState is a state of this module, kept through its runtime: the state by its local name, and its object store
|
||||
// `<state>-objects` (catalogue.StateObjectsName).
|
||||
func ForState(state string) Values {
|
||||
store := catalogue.StateObjectsName(state)
|
||||
return Values{KV: BundleKV{State: stdio.State(state)}, Objects: BundleObjects{Store: busstate.ObjectsOf(store)}, Store: store}
|
||||
}
|
||||
|
||||
// BundleKV is a state as a bundle reaches it.
|
||||
type BundleKV struct{ State stdio.KeptState }
|
||||
|
||||
func (b BundleKV) Get(key string) (*Entry, error) {
|
||||
e, err := b.State.Get(key)
|
||||
if err != nil || e == nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Entry{Value: e.Value, Revision: e.Revision}, nil
|
||||
}
|
||||
|
||||
func changed(err error) error {
|
||||
if errors.Is(err, stdio.ErrChanged) {
|
||||
return ErrChanged
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (b BundleKV) Create(key string, value []byte) error {
|
||||
_, err := b.State.Create(key, json.RawMessage(value))
|
||||
return changed(err)
|
||||
}
|
||||
|
||||
func (b BundleKV) Update(key string, value []byte, revision uint64) error {
|
||||
_, err := b.State.Update(key, json.RawMessage(value), revision)
|
||||
return changed(err)
|
||||
}
|
||||
|
||||
func (b BundleKV) Delete(key string) error { return b.State.Delete(key) }
|
||||
func (b BundleKV) Keys() ([]string, error) { return b.State.Keys() }
|
||||
|
||||
// BundleObjects is an object store as a bundle reaches it.
|
||||
type BundleObjects struct{ Store busstate.Objects }
|
||||
|
||||
// MostBytes is zero: a bundle's value of any size is put by a session of chunks, bounded by its store's cap, which the tool
|
||||
// runner refuses at the chunk that passes it (design 47 G §518).
|
||||
func (BundleObjects) MostBytes() int { return 0 }
|
||||
|
||||
func (b BundleObjects) Put(name string, data []byte) error {
|
||||
_, err := b.Store.Put(name, data, "a value kept beside its key")
|
||||
return err
|
||||
}
|
||||
|
||||
func (b BundleObjects) Get(name string) ([]byte, error) {
|
||||
d, err := b.Store.Get(name)
|
||||
return d.Data, err
|
||||
}
|
||||
|
||||
func (b BundleObjects) Delete(name string) error { return b.Store.Delete(name) }
|
||||
|
||||
func (b BundleObjects) List() ([]Object, error) {
|
||||
l, err := b.Store.List()
|
||||
out := make([]Object, 0, len(l))
|
||||
for _, o := range l {
|
||||
if !o.Deleted {
|
||||
out = append(out, Object{Name: o.Name, Size: int64(o.Size), Modified: o.Modified})
|
||||
}
|
||||
}
|
||||
return out, err
|
||||
}
|
||||
Reference in New Issue
Block a user