Files
mats 16655e8dbc feat(tracking): ship the shell rebuild — k8s replicas 3 + REDIS_ONLY + HPA, partitioned ingest live
- deploy/k8s/25-tracking-orders.yaml: SHELL-REBUILD gating removed (LIVE) —
  replicas 3 + RollingUpdate, actor-pool=tracking label + POD_IP/NAMESPACE,
  REDIS_ONLY=1, TRACKING_PARTITIONS=16, HPA 3..12
- deploy/k8s/00-namespace-config.yaml: tracking PVC note → rebuild live (mount
  vestigial, kept for rollback)
- deploy/docker-compose.yml: TRACKING_PARTITIONS=16 on the reader producer +
  tracking consumer (partitioned ingest in the dev stack too)
- deploy/k8s/build-push.sh: gocartactor named context for the tracking image
- platform: rabbit.PublishEventTo (caller routing key) + event.PartitionOf /
  PartitionRoutingKey (shared §8 fnv1a hash) + tests
- docs: plan-tracking-shell-rebuild.md (config write half, pod-watcher
  assignment, real-AOF tape gate, R6 re-measure), status.md, CONTEXT,
  event-sourcing-stance, platform-architecture-review, read-model-projections;
  scripts/load-test-coordinator.sh
- submodules: slask-tracking ecbf894 (shell rebuild), slask-finder 84f7ff7
  (§8 partition-routed producer)

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-08-17 14:41:17 +02:00

31 lines
1.1 KiB
Go

package event
import (
"hash/fnv"
"strconv"
)
// PartitionOf maps a stable key (sessionId / listId / sendID, stringified) to a
// partition index in [0, n) for the track.partition.{N} ingest scheme
// (slask-tracking shell-rebuild §8). fnv1a-64 over the key bytes, so producers
// (slask-finder's track.* publisher, slask-tracking's HTTP beacon edge) and
// consumers agree on the routing without sharing app code. n <= 1 is a single
// partition (index 0).
func PartitionOf(key string, n int) int {
if n <= 1 {
return 0
}
h := fnv.New64a()
_, _ = h.Write([]byte(key))
return int(h.Sum64() % uint64(n))
}
// PartitionRoutingKey is the queue AND routing key for partition i: the queue
// track.partition.{i} binds to the catalog exchange with the same key, so a
// producer routing to track.partition.{i} lands on exactly that queue. This is
// the shared name both the slask-finder producer and the slask-tracking
// consumer use, so the partition→queue→consumer map is observable and stable.
func PartitionRoutingKey(i int) string {
return "track.partition." + strconv.Itoa(i)
}