Rename the DB things.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3656 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2021-08-22 19:41:27 +00:00
parent e922af4c55
commit cfd5341a6b
9 changed files with 41 additions and 46 deletions

View File

@ -1,5 +1,7 @@
#include "ssb.h"
#include "ssb.db.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
@ -57,7 +59,7 @@ static void _count_messages_callback(JSValue row, void* user_data)
static int _ssb_test_count_messages(tf_ssb_t* ssb)
{
int count = 0;
tf_ssb_visit_query(ssb, "SELECT * FROM messages", JS_UNDEFINED, _count_messages_callback, &count);
tf_ssb_db_visit_query(ssb, "SELECT * FROM messages", JS_UNDEFINED, _count_messages_callback, &count);
return count;
}
@ -98,7 +100,7 @@ static void _tf_ssb_test_ssb()
char blob_id[k_id_base64_len] = { 0 };
const char* k_blob = "Hello, blob!";
b = tf_ssb_blob_store(ssb0, (const uint8_t*)k_blob, strlen(k_blob), blob_id, sizeof(blob_id));
b = tf_ssb_db_blob_store(ssb0, (const uint8_t*)k_blob, strlen(k_blob), blob_id, sizeof(blob_id));
assert(b);
tf_ssb_append_post(ssb0, "Hello, world!");
@ -116,8 +118,8 @@ static void _tf_ssb_test_ssb()
tf_ssb_append_message(ssb0, message);
JS_FreeValue(context, message);
assert(tf_ssb_blob_get(ssb0, blob_id, NULL, NULL));
assert(!tf_ssb_blob_get(ssb1, blob_id, NULL, NULL));
assert(tf_ssb_db_blob_get(ssb0, blob_id, NULL, NULL));
assert(!tf_ssb_db_blob_get(ssb1, blob_id, NULL, NULL));
tf_ssb_server_open(ssb0, 12347);
uint8_t id0bin[k_id_bin_len];
@ -135,7 +137,7 @@ static void _tf_ssb_test_ssb()
}
printf("waiting for blob\n");
while (!tf_ssb_blob_get(ssb1, blob_id, NULL, NULL)) {
while (!tf_ssb_db_blob_get(ssb1, blob_id, NULL, NULL)) {
uv_run(&loop, UV_RUN_ONCE);
}
printf("done\n");