more platform

This commit is contained in:
mats committed 2026-06-29 12:35:32 +02:00
1 parent 8a71e32149
commit 2a66754f9e
27 files changed
+2435 -540

No files matched your search

+5 -5
View File
@@ -82,7 +82,7 @@ type TenantState struct {
mu sync.RWMutex
items map[string]catalog.Projection
holder *catalog.SnapshotHolder
holder *catalog.SnapshotHolder[catalog.Projection]
path string // <out-dir>/<tenant>.bin
rebuildCount atomic.Uint64
@@ -92,7 +92,7 @@ type TenantState struct {
// newTenantState wires a brand-new tenant. Caller is responsible for
// calling rebuild() (or Open via the initial state pipeline) before any Get.
func newTenantState(tenant string, sch catalog.Schema, holder *catalog.SnapshotHolder, path string) *TenantState {
func newTenantState(tenant string, sch catalog.Schema, holder *catalog.SnapshotHolder[catalog.Projection], path string) *TenantState {
return &TenantState{
tenant: tenant,
schema: sch,
@@ -148,9 +148,9 @@ func (ts *TenantState) rebuild(batch []catalog.ProjectionUpdate) error {
// writeSnapshot emits snapshot to disk (atomic temp+rename) and reloads
// the holder. Called WITHOUT holding ts.mu.
func (ts *TenantState) writeSnapshot(snap []catalog.Projection) error {
w := catalog.NewSnapshotWriter().WithTenant(ts.tenant)
w := catalog.NewSnapshotWriter[catalog.Projection]().WithTenant(ts.tenant)
for _, p := range snap {
if err := w.Append(p); err != nil {
if err := w.Append(p.SKU, p); err != nil {
return fmt.Errorf("append %s: %w", p.SKU, err)
}
}
@@ -260,7 +260,7 @@ func main() {
sch.Tenant = t
}
path := filepath.Join(*outDir, t+".bin")
holder := catalog.NewSnapshotHolder(*drainGrace)
holder := catalog.NewSnapshotHolder[catalog.Projection](*drainGrace)
states[t] = newTenantState(t, sch, holder, path)
}
// Register cleanup for both the defer path (graceful shutdown / SIGINT)