|
ascii-chat 0.6.0
Real-time terminal-based video chat with ASCII art conversion
|
💾 SQLite persistence implementation More...
Go to the source code of this file.
Functions | |
| asciichat_error_t | database_init (const char *db_path, sqlite3 **db) |
| Initialize database and create schema. | |
| asciichat_error_t | database_load_sessions (sqlite3 *db, session_registry_t *registry) |
| Load active sessions from database into registry. | |
| asciichat_error_t | database_save_session (sqlite3 *db, const session_entry_t *session) |
| Save session to database. | |
| asciichat_error_t | database_delete_session (sqlite3 *db, const uint8_t session_id[16]) |
| Delete session from database. | |
| void | database_close (sqlite3 *db) |
| Close database. | |
💾 SQLite persistence implementation
Provides SQLite persistence for sessions, participants, and rate limiting. Sessions are saved on creation and loaded on startup for crash recovery.
RCU Integration:
Definition in file database.c.
| void database_close | ( | sqlite3 * | db | ) |
Close database.
| db | Database handle to close |
Definition at line 339 of file database.c.
References log_debug.
Referenced by acds_server_init(), and acds_server_shutdown().
| asciichat_error_t database_delete_session | ( | sqlite3 * | db, |
| const uint8_t | session_id[16] | ||
| ) |
Delete session from database.
| db | Database handle |
| session_id | Session UUID |
Definition at line 313 of file database.c.
References ASCIICHAT_OK, ERROR_CONFIG, ERROR_INVALID_PARAM, log_debug, session_id, and SET_ERRNO.
| asciichat_error_t database_init | ( | const char * | db_path, |
| sqlite3 ** | db | ||
| ) |
Initialize database and create schema.
| db_path | Path to SQLite database file |
| db | Output database handle |
Definition at line 58 of file database.c.
References ASCIICHAT_OK, ERROR_CONFIG, ERROR_INVALID_PARAM, log_error, log_info, log_warn, and SET_ERRNO.
Referenced by acds_server_init().
| asciichat_error_t database_load_sessions | ( | sqlite3 * | db, |
| session_registry_t * | registry | ||
| ) |
Load active sessions from database into registry.
| db | Database handle |
| registry | Session registry to populate |
Definition at line 106 of file database.c.
References ASCIICHAT_OK, session_entry::capabilities, session_entry::created_at, session_entry::current_participants, ERROR_CONFIG, ERROR_INVALID_PARAM, ERROR_MEMORY, session_entry::expires_at, session_entry::has_password, session_entry::hash_node, session_entry::host_pubkey, participant_t::identity_pubkey, participant_t::joined_at, log_info, log_warn, MAX_PARTICIPANTS, session_entry::max_participants, participant_t::participant_id, session_entry::participants, session_entry::password_hash, SAFE_FREE, SAFE_MALLOC, SAFE_STRNCPY, session_entry::session_id, session_entry::session_string, session_registry_t::sessions, and SET_ERRNO.
Referenced by acds_server_init().
| asciichat_error_t database_save_session | ( | sqlite3 * | db, |
| const session_entry_t * | session | ||
| ) |
Save session to database.
| db | Database handle |
| session | Session entry to save |
Definition at line 226 of file database.c.
References ASCIICHAT_OK, session_entry::capabilities, session_entry::created_at, ERROR_CONFIG, ERROR_INVALID_PARAM, session_entry::expires_at, session_entry::has_password, session_entry::host_pubkey, participant_t::identity_pubkey, participant_t::joined_at, log_debug, log_error, MAX_PARTICIPANTS, session_entry::max_participants, participant_t::participant_id, session_entry::participants, session_entry::password_hash, session_entry::session_id, session_entry::session_string, and SET_ERRNO.