Initial commit: RehearsalHub POC
Full-stack self-hosted band rehearsal platform: Backend (FastAPI + SQLAlchemy 2.0 async): - Auth with JWT (register, login, /me, settings) - Band management with Nextcloud folder integration - Song management with audio version tracking - Nextcloud scan to auto-import audio files - Band membership with link-based invite system - Song comments - Audio analysis worker (BPM, key, loudness, waveform) - Nextcloud activity watcher for auto-import - WebSocket support for real-time annotation updates - Alembic migrations (0001–0003) - Repository pattern, Ruff + mypy configured Frontend (React 18 + Vite + TypeScript strict): - Login/register page with post-login redirect - Home page with band list and creation form - Band page with member panel, invite link, song list, NC scan - Song page with waveform player, annotations, comment thread - Settings page for per-user Nextcloud credentials - Invite acceptance page (/invite/:token) - ESLint v9 flat config + TypeScript strict mode Infrastructure: - Docker Compose: PostgreSQL, Redis, API, worker, watcher, nginx - nginx reverse proxy for static files + /api/ proxy - make check runs all linters before docker compose build Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
28
api/src/rehearsalhub/queue/protocol.py
Normal file
28
api/src/rehearsalhub/queue/protocol.py
Normal file
@@ -0,0 +1,28 @@
|
||||
"""Job queue abstraction. Swap Redis for any other backend by implementing this Protocol."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import uuid
|
||||
from typing import Any, Protocol
|
||||
|
||||
|
||||
class JobQueue(Protocol):
|
||||
async def enqueue(self, job_type: str, payload: dict[str, Any]) -> uuid.UUID:
|
||||
"""Persist job to DB + push UUID onto queue. Returns the job UUID."""
|
||||
...
|
||||
|
||||
async def dequeue(self, timeout: int = 5) -> tuple[uuid.UUID, str, dict[str, Any]] | None:
|
||||
"""Block up to `timeout` seconds for a job. Returns (id, type, payload) or None."""
|
||||
...
|
||||
|
||||
async def mark_running(self, job_id: uuid.UUID) -> None:
|
||||
"""Mark a job as running. Called by the worker when it picks up the job."""
|
||||
...
|
||||
|
||||
async def mark_done(self, job_id: uuid.UUID) -> None:
|
||||
"""Mark a job as successfully completed."""
|
||||
...
|
||||
|
||||
async def mark_failed(self, job_id: uuid.UUID, error: str) -> None:
|
||||
"""Mark a job as failed with an error message. Increments attempt counter."""
|
||||
...
|
||||
Reference in New Issue
Block a user