Files
mesh-catalog/modules/artifact-store-tools/cmd/artifact-store-tools/gone.go
T
jschoubben e4ef67adcd MV1: move contracts and sdk under modules/, importers follow
The delivery repository's contracts and SDK live under modules/ as
mesh-delivery-contracts and mesh-delivery-sdk, their Go module paths
renamed to match the folders (the TypeScript names already did), and
every importer in mesh-delivery, mesh-catalog, mesh-host, mesh-tools
and mesh-sdk follows in the same group: a design as it should be, one
path per module, checked by the group's check building every importer.

Builds: design 47 G §427, §88

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:09:56 +01:00

40 lines
1.3 KiB
Go

package main
import (
"encoding/json"
"fmt"
"sort"
sweep "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshartifactsweep"
)
// The holders whose states this module reads, one constant each (a reader names its holder once; ADR 0634 §4).
const (
assignerModule = "mesh-delivery-assigner"
indexerModule = "mesh-delivery-indexer"
)
// The seat mesh-artifact-sweep types the answer of its verb held and the body of its event artifacts-gone; this module
// holds the seat, so it answers and says them in those types.
type (
// HeldAnswer is the answer of the seat's verb held.
HeldAnswer = sweep.HeldAnswer
// ArtifactsGone is the body of the seat's event artifacts-gone.
ArtifactsGone = sweep.ArtifactsGone
)
// GoneSubject is where the seat says artifacts-gone.
const GoneSubject = sweep.SubjectArtifactsGone
// EncodeArtifactsGone is the event's body, the references sorted; it refuses one naming no module, no fingerprint or no
// gone reference.
func EncodeArtifactsGone(e ArtifactsGone) ([]byte, error) {
e.Event = sweep.EventArtifactsGone
e.Gone = append([]string(nil), e.Gone...)
sort.Strings(e.Gone)
if e.Module == "" || e.Fingerprint == "" || len(e.Gone) == 0 {
return nil, fmt.Errorf("%s names a module, a fingerprint and at least one gone reference", sweep.EventArtifactsGone)
}
return json.Marshal(e)
}