spark-server/.cursor/skills/spark-im-v3/invariants.md
2026-09-18 14:50:41 +08:00

14 lines
627 B
Markdown

# V3 invariants (short)
| ID | Rule |
|----|------|
| C1 | MySQL + Snowflake MsgId. No ConversationSeq. |
| C2 | EventLoop ≠ MySQL. Fanout = Redis list + worker (`BRPOPLPUSH`). |
| C3 | TLS + thin Frame. No custom handshake crypto. |
| C4 | Public 443 / Nginx SNI. gnet/Gin bind loopback only. |
| C5 | ACK = COMMIT + enqueue. |
| C6 | PROXY RealIP for limit/audit. |
| C7 | Dialog list in Redis ZSET. Mailbox only for missed push + control events. |
P2P unique `(user_small, user_big)`. Same device kicks old conn. Sender device excluded from MESSAGE. `context.TODO()` banned on hot path. Push timeout does not close TCP.