From 20cb29c2f8c5c87bc590896854a20b1473ceb358 Mon Sep 17 00:00:00 2001 From: "info@mode42.com" Date: Sat, 8 Aug 2026 03:54:55 +0000 Subject: #2 --- src/core/storage_private.h | 81 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 src/core/storage_private.h (limited to 'src/core/storage_private.h') diff --git a/src/core/storage_private.h b/src/core/storage_private.h new file mode 100644 index 0000000..579250c --- /dev/null +++ b/src/core/storage_private.h @@ -0,0 +1,81 @@ +#ifndef HYBBX_STORAGE_PRIVATE_H +#define HYBBX_STORAGE_PRIVATE_H + +#include "hybbx/auth.h" +#include "hybbx/storage.h" + +#include + +struct hybbx_storage { + hybbx_storage_backend_kind_t backend; + char *path; + char guest_prefix[HYBBX_AUTH_GUEST_PREFIX_MAX]; + hybbx_storage_sql_config_t sql_cfg; + void *backend_data; +}; + +hybbx_result_t hybbx_storage_flatfile_open(hybbx_storage_t *storage); +void hybbx_storage_flatfile_close(hybbx_storage_t *storage); +hybbx_result_t hybbx_storage_flatfile_session_begin(hybbx_storage_t *storage, + const hybbx_user_record_t *user, + const char *transport, + hybbx_session_record_t *out); +hybbx_result_t hybbx_storage_flatfile_session_end(hybbx_storage_t *storage, + uint64_t session_id); +hybbx_result_t hybbx_storage_flatfile_find_user(hybbx_storage_t *storage, + const char *username, + hybbx_user_record_t *out); +hybbx_result_t hybbx_storage_flatfile_resolve_user(hybbx_storage_t *storage, + const char *name, + hybbx_user_record_t *out); +hybbx_result_t hybbx_storage_flatfile_count_level(hybbx_storage_t *storage, + hybbx_user_level_t level, + size_t *count); +hybbx_result_t hybbx_storage_flatfile_foreach_user( + hybbx_storage_t *storage, + hybbx_storage_user_fn fn, + void *ctx); +hybbx_result_t hybbx_storage_flatfile_register_user(hybbx_storage_t *storage, + const hybbx_user_registration_t *reg, + hybbx_user_record_t *out); +hybbx_result_t hybbx_storage_flatfile_update_user(hybbx_storage_t *storage, + const hybbx_user_record_t *user); +hybbx_result_t hybbx_storage_flatfile_delete_user(hybbx_storage_t *storage, + uint64_t user_id); + +hybbx_result_t hybbx_storage_sql_open(hybbx_storage_t *storage); +void hybbx_storage_sql_close(hybbx_storage_t *storage); +hybbx_result_t hybbx_storage_sql_register_user(hybbx_storage_t *storage, + const hybbx_user_registration_t *reg, + hybbx_user_record_t *out); +hybbx_result_t hybbx_storage_sql_find_user(hybbx_storage_t *storage, + const char *username, + hybbx_user_record_t *out); +hybbx_result_t hybbx_storage_sql_resolve_user(hybbx_storage_t *storage, + const char *name, + hybbx_user_record_t *out); +hybbx_result_t hybbx_storage_sql_count_level(hybbx_storage_t *storage, + hybbx_user_level_t level, + size_t *count); +hybbx_result_t hybbx_storage_sql_foreach_user(hybbx_storage_t *storage, + hybbx_storage_user_fn fn, + void *ctx); +hybbx_result_t hybbx_storage_sql_update_user(hybbx_storage_t *storage, + const hybbx_user_record_t *user); +hybbx_result_t hybbx_storage_sql_delete_user(hybbx_storage_t *storage, + uint64_t user_id); +hybbx_result_t hybbx_storage_sql_session_begin(hybbx_storage_t *storage, + const hybbx_user_record_t *user, + const char *transport, + hybbx_session_record_t *out); +hybbx_result_t hybbx_storage_sql_session_end(hybbx_storage_t *storage, + uint64_t session_id); +void hybbx_storage_sql_backup_files(const hybbx_storage_t *storage); +void hybbx_storage_sql_backup_tick(hybbx_storage_t *storage); + +#ifdef HYBBX_HAVE_SQLITE +struct sqlite3; +struct sqlite3 *hybbx_storage_sql_mail_db(hybbx_storage_t *storage); +#endif + +#endif /* HYBBX_STORAGE_PRIVATE_H */ -- cgit v1.3.1