Make storing messages async. Phew.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4355 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2023-07-20 01:02:50 +00:00
parent 6fcebd7a08
commit fb73fd0afc
7 changed files with 417 additions and 162 deletions

View File

@ -10,11 +10,13 @@ typedef struct _tf_ssb_t tf_ssb_t;
void tf_ssb_db_init(tf_ssb_t* ssb);
void tf_ssb_db_init_reader(sqlite3* db);
bool tf_ssb_db_store_message(tf_ssb_t* ssb, JSContext* context, const char* id, JSValue val, const char* signature, bool sequence_before_author);
bool tf_ssb_db_message_content_get(tf_ssb_t* ssb, const char* id, uint8_t** out_blob, size_t* out_size);
bool tf_ssb_db_blob_has(tf_ssb_t* ssb, const char* id);
bool tf_ssb_db_blob_get(tf_ssb_t* ssb, const char* id, uint8_t** out_blob, size_t* out_size);
typedef void (tf_ssb_db_store_message_callback_t)(const char* id, bool stored, void* user_data);
void tf_ssb_db_store_message(tf_ssb_t* ssb, JSContext* context, const char* id, JSValue val, const char* signature, bool sequence_before_author, tf_ssb_db_store_message_callback_t* callback, void* user_data);
typedef void (tf_ssb_db_blob_store_callback_t)(const char* id, bool is_new, void* user_data);
void tf_ssb_db_blob_store_async(tf_ssb_t* ssb, const uint8_t* blob, size_t size, tf_ssb_db_blob_store_callback_t* callback, void* user_data);
bool tf_ssb_db_blob_store(tf_ssb_t* ssb, const uint8_t* blob, size_t size, char* out_id, size_t out_id_size, bool* out_new);