Slon/Modules/Db: Add @slon_db_save_status_to_disk() to save an individual account's statuses
This commit is contained in:
parent
aded79c192
commit
74455c59ab
4 changed files with 12 additions and 3 deletions
|
@ -137,7 +137,7 @@ U0 @slon_api_v1_statuses_delete(SlonHttpSession* session)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@slon_db_save_statuses_to_disk;
|
@slon_db_save_status_to_disk(status);
|
||||||
@slon_db_instance_decrement_status_count;
|
@slon_db_instance_decrement_status_count;
|
||||||
@slon_db_save_instance_to_disk;
|
@slon_db_save_instance_to_disk;
|
||||||
if (@slon_api_status_delete_fedi) {
|
if (@slon_api_status_delete_fedi) {
|
||||||
|
|
|
@ -896,7 +896,7 @@ U0 @slon_activitypub_users_inbox(SlonHttpSession* session, U8* user)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@slon_db_save_statuses_to_disk;
|
@slon_db_save_status_to_disk(status);
|
||||||
request_object = Json.Clone(request_json);
|
request_object = Json.Clone(request_json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -357,7 +357,7 @@ U0 @slon_api_create_status(JsonObject* status, U8* account_id, U8* to_ap_user =
|
||||||
db->o("statuses")->set(account_id, Json.CreateArray(), JSON_ARRAY);
|
db->o("statuses")->set(account_id, Json.CreateArray(), JSON_ARRAY);
|
||||||
}
|
}
|
||||||
db->o("statuses")->a(account_id)->append(Json.CreateItem(status, JSON_OBJECT));
|
db->o("statuses")->a(account_id)->append(Json.CreateItem(status, JSON_OBJECT));
|
||||||
@slon_db_save_statuses_to_disk;
|
@slon_db_save_status_to_disk(status);
|
||||||
@slon_db_instance_increment_status_count;
|
@slon_db_instance_increment_status_count;
|
||||||
@slon_db_save_instance_to_disk;
|
@slon_db_save_instance_to_disk;
|
||||||
|
|
||||||
|
|
|
@ -267,8 +267,17 @@ U0 @slon_db_save_settings_to_disk()
|
||||||
Json.DumpToFile(scratch_buffer, db->o("settings"));
|
Json.DumpToFile(scratch_buffer, db->o("settings"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
U0 @slon_db_save_status_to_disk(JsonObject* status)
|
||||||
|
{
|
||||||
|
// NOTE: This will commit all statuses to disk for the account specified in the status.
|
||||||
|
U8 scratch_buffer[256];
|
||||||
|
StrPrint(scratch_buffer, "%s/statuses/%s.json", SLON_DB_PATH, status->o("account")->@("id"));
|
||||||
|
Json.DumpToFile(scratch_buffer, db->o("statuses")->a(status->o("account")->@("id")));
|
||||||
|
}
|
||||||
|
|
||||||
U0 @slon_db_save_statuses_to_disk()
|
U0 @slon_db_save_statuses_to_disk()
|
||||||
{
|
{
|
||||||
|
// NOTE: This will commit all statuses to disk for every known account.
|
||||||
U8 scratch_buffer[256];
|
U8 scratch_buffer[256];
|
||||||
JsonKey* key = db->o("statuses")->keys;
|
JsonKey* key = db->o("statuses")->keys;
|
||||||
while (key) {
|
while (key) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue