feat(server): connection pool, session persistence, blob storage in SqlStore
- Replace Mutex<Connection> with Vec<Mutex<Connection>> pool (default 4) with try_lock fast-path and blocking fallback - Add SessionRecord struct and session CRUD to Store trait (default no-ops) - Implement session persistence in SqlStore (sessions table, migration 009) - Add blob upload/download with SHA-256 verified staging assembly (blobs + blob_staging tables, migration 010) - All 35 server tests pass, FileBackedStore unaffected
This commit is contained in:
8
crates/quicproquo-server/migrations/009_sessions.sql
Normal file
8
crates/quicproquo-server/migrations/009_sessions.sql
Normal file
@@ -0,0 +1,8 @@
|
||||
CREATE TABLE IF NOT EXISTS sessions (
|
||||
token BLOB PRIMARY KEY,
|
||||
username TEXT NOT NULL,
|
||||
identity_key BLOB NOT NULL,
|
||||
created_at INTEGER NOT NULL,
|
||||
expires_at INTEGER NOT NULL
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS idx_sessions_expires ON sessions(expires_at);
|
||||
15
crates/quicproquo-server/migrations/010_blobs.sql
Normal file
15
crates/quicproquo-server/migrations/010_blobs.sql
Normal file
@@ -0,0 +1,15 @@
|
||||
CREATE TABLE IF NOT EXISTS blobs (
|
||||
blob_id BLOB PRIMARY KEY,
|
||||
data BLOB NOT NULL,
|
||||
total_size INTEGER NOT NULL,
|
||||
mime_type TEXT NOT NULL DEFAULT '',
|
||||
uploaded_at INTEGER NOT NULL
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS blob_staging (
|
||||
blob_hash BLOB NOT NULL,
|
||||
offset INTEGER NOT NULL,
|
||||
chunk BLOB NOT NULL,
|
||||
total_size INTEGER NOT NULL,
|
||||
mime_type TEXT NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (blob_hash, offset)
|
||||
);
|
||||
Reference in New Issue
Block a user