forked from mtusi2026/mtusi2026lab2
Lab 2
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
## Лабораторная 2
|
||||
|
||||
Автор / группа: Гуреев Дмитрий, БПИ2301
|
||||
Целевая оценка (3/4/5): **5**
|
||||
Трек 5, если заявлен: **Трек 1 — согласованность кэша (cache stampede / single-flight)**
|
||||
|
||||
### Что реализовано и что перенесено
|
||||
|
||||
**Из Lab1:** REST-контракт users/chats/messages, `X-Request-Id`, курсорная пагинация сообщений.
|
||||
|
||||
**Lab2:**
|
||||
- PostgreSQL + Flyway (users, chats, chat_members, messages, sessions)
|
||||
- Регистрация с BCrypt; вход Basic → opaque Bearer; expiry; logout; сессии в БД
|
||||
- Docker Compose: API + Postgres + Redis, named volumes; `scripts/restart.sh` без `down -v`
|
||||
- Redis — кэш сессий (`session:<hash> → userId`, TTL); источник истины — PostgreSQL
|
||||
- Keyset-пагинация сообщений + индекс `(chat_id, created_at DESC, id DESC)`; EXPLAIN на ≥10k
|
||||
- Гонка username → 409; createChat в одной транзакции
|
||||
- **Трек 1:** single-flight в `resolveUserByBearer`; замеры после FLUSHDB; read-after-write; restart Redis
|
||||
|
||||
Подробности, таблицы отказов и эксперимент — в **[REPORT.md](./REPORT.md)**.
|
||||
|
||||
### Команды запуска из чистого clone
|
||||
|
||||
```bash
|
||||
git clone https://gitea.privcloud.tech/Dmitry/mtusi2026lab2
|
||||
cd mtusi2026lab2/Lido
|
||||
docker compose up -d --build
|
||||
curl -sf http://localhost:8080/health/live || curl -sf http://localhost:8080/actuator/health
|
||||
cd ..
|
||||
make test BASE_URL=http://localhost:8080
|
||||
make test-persistence ACTION_SCRIPT=scripts/restart.sh
|
||||
@@ -0,0 +1,16 @@
|
||||
name: Skeleton contracts
|
||||
on: [push, pull_request]
|
||||
permissions:
|
||||
contents: read
|
||||
jobs:
|
||||
contracts:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.12'
|
||||
- run: python -m pip install -r requirements-dev.txt
|
||||
- run: make check validate PYTHON=python
|
||||
# This job validates the skeleton, not a student solution.
|
||||
# Add build, readiness and make test in a separate application job.
|
||||
Reference in New Issue
Block a user