Реализовать лабораторную 3: две API-реплики за Nginx, Idempotency-Key, failover и эксперимент масштабирования

This commit is contained in:
alenchha
2026-10-28 17:28:48 +03:00
parent 0ab3a341aa
commit fbb8916fc8
97 changed files with 2838 additions and 21 deletions
+12
View File
@@ -0,0 +1,12 @@
CREATE TABLE idempotency_keys (
user_id uuid NOT NULL REFERENCES users (id) ON DELETE CASCADE,
chat_id uuid NOT NULL REFERENCES chats (id) ON DELETE CASCADE,
key text NOT NULL
CONSTRAINT idempotency_key_format CHECK (key ~ '^[A-Za-z0-9._:\-]{1,128}$'),
request_body_hash text NOT NULL,
response_json text NOT NULL,
created_at timestamptz NOT NULL,
PRIMARY KEY (user_id, chat_id, key)
);
CREATE INDEX idempotency_keys_created_idx ON idempotency_keys (created_at);