005_ws.up.sql 1.6 KB

1234567891011121314151617181920212223242526272829303132333435
  1. -- 005_ws.up.sql
  2. -- M5: WebSocket ingest + per-IP concurrency cap (SPEC §22 layer 2).
  3. -- See SPEC §22 milestone rollout — M5 ships layer 2 "obvious once
  4. -- WS is in".
  5. --
  6. -- What lands in M5:
  7. -- sources.max_concurrent_connections — per-source override for
  8. -- the in-memory per-IP cap. Default 32 for
  9. -- WS, 64 for HTTP. The HTTP path's
  10. -- Server.ConnState callback increments /
  11. -- decrements the same counter, so the
  12. -- same column covers both transports.
  13. --
  14. -- Why per-source and not per-IP: the SPEC §22 cap is per-IP, but
  15. -- the config knob is per-source because a single source might be
  16. -- a multi-tenant gateway (one source_id, many egress IPs). M5
  17. -- keeps the per-IP default at the source's
  18. -- `max_concurrent_connections` value. M11 will replace this with
  19. -- a per-IP-and-per-source intersection in the in-memory map.
  20. --
  21. -- What's NOT in M5 (and not supposed to be):
  22. -- Tail events persistence (M5 is live-only)
  23. -- Tail auth beyond the static token (M11, security milestone)
  24. -- Quarantine and circuit breaker (M9)
  25. -- Per-company tail subscription (M9)
  26. ALTER TABLE sources
  27. ADD COLUMN IF NOT EXISTS max_concurrent_connections INTEGER NOT NULL DEFAULT 32;
  28. -- Same column on companies for the global default (any
  29. -- per-company sources inherit this if their own is unset; M0
  30. -- doesn't have a per-company override but the column is
  31. -- reserved for the M2 routing-rules upgrade).
  32. ALTER TABLE companies
  33. ADD COLUMN IF NOT EXISTS max_concurrent_connections INTEGER NOT NULL DEFAULT 64;