- Generic SnapshotWriter[T]/SnapshotReader[T] over a value-agnostic raw layer; SnapshotHolder[T] now RWMutex-guards munmap vs in-flight Get (race-free swap, TestSnapshotHolder_SwapRace) — the drain grace is now just close-batching. - ProjectionStore[T]: snapshot begin|chunk|end assembly → atomic swap, epoch-gated delta overlay, tombstones, atomic epoch sidecar (ordered before the swap), cold-start reopen, mandatory ProjectionTransform[T]. Future-epoch deltas are dropped by contract (recover via next snapshot), not buffered. - Shared bus-framing constants so producer + consumer agree. - Bump slask-finder / go-cart-actor / backoffice pointers; refresh status.md + catalog-projection.md to the finished state. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
29 lines
711 B
Go
29 lines
711 B
Go
// Local helpers for snapshot_test.go — production code does not see them.
|
|
package catalog
|
|
|
|
import (
|
|
"os"
|
|
)
|
|
|
|
func os2WriteFile(path string, data []byte, perm os.FileMode) error {
|
|
return os.WriteFile(path, data, perm)
|
|
}
|
|
|
|
func os2Stat(path string) (os.FileInfo, error) {
|
|
return os.Stat(path)
|
|
}
|
|
|
|
// appendP appends a Projection keyed by its own SKU — the producer/test pattern
|
|
// over the now-generic SnapshotWriter[Projection] (Append takes an explicit key).
|
|
func appendP(w *SnapshotWriter[Projection], p Projection) error {
|
|
return w.Append(p.SKU, p)
|
|
}
|
|
|
|
func repeat32(s string, n int) string {
|
|
out := make([]byte, 0, n*len(s))
|
|
for i := 0; i < n; i++ {
|
|
out = append(out, s...)
|
|
}
|
|
return string(out)
|
|
}
|