forked from cory/tildefriends
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:
@ -1,5 +1,6 @@
|
||||
#include "ssb.rpc.h"
|
||||
|
||||
#include "ssb.db.h"
|
||||
#include "ssb.h"
|
||||
#include "trace.h"
|
||||
|
||||
@ -75,7 +76,7 @@ static void _tf_ssb_rpc_blob_get(tf_ssb_connection_t* connection, uint8_t flags,
|
||||
|
||||
uint8_t* blob = NULL;
|
||||
size_t blob_size = 0;
|
||||
if (tf_ssb_blob_get(ssb, blob_id, &blob, &blob_size)) {
|
||||
if (tf_ssb_db_blob_get(ssb, blob_id, &blob, &blob_size)) {
|
||||
static const size_t k_block_size = 64 * 1024;
|
||||
for (size_t offset = 0; offset < blob_size; offset += k_block_size) {
|
||||
size_t block_size = offset + k_block_size < blob_size ? k_block_size : (blob_size - offset);
|
||||
@ -121,7 +122,7 @@ static void _tf_ssb_connection_on_rpc_blobs_get_response(tf_ssb_connection_t* co
|
||||
snprintf(id, sizeof(id), "&%s.sha256", hash64);
|
||||
|
||||
if (strcmp(id, get->blob_id) == 0) {
|
||||
if (tf_ssb_blob_store(ssb, get->data, get->size, id, sizeof(id))) {
|
||||
if (tf_ssb_db_blob_store(ssb, get->data, get->size, id, sizeof(id))) {
|
||||
printf("stored blob %s\n", get->blob_id);
|
||||
} else {
|
||||
printf("failed to store %s\n", get->blob_id);
|
||||
@ -187,7 +188,7 @@ static void _tf_ssb_connection_on_rpc_blobs_createWants_response(tf_ssb_connecti
|
||||
tf_ssb_rpc_send_blobs_get(connection, blob_id, size);
|
||||
} else if (size < 0) {
|
||||
size_t blob_size = 0;
|
||||
if (tf_ssb_blob_get(ssb, blob_id, NULL, &blob_size)) {
|
||||
if (tf_ssb_db_blob_get(ssb, blob_id, NULL, &blob_size)) {
|
||||
JSValue size_response = JS_NewObject(context);
|
||||
JS_SetPropertyStr(context, size_response, blob_id, JS_NewInt64(context, blob_size));
|
||||
JSValue jsonval = JS_JSONStringify(context, size_response, JS_NULL, JS_NULL);
|
||||
@ -367,7 +368,7 @@ static void _tf_ssb_connection_on_rpc_createHistoryStream_response(tf_ssb_connec
|
||||
char id[crypto_hash_sha256_BYTES * 2 + 1];
|
||||
tf_ssb_calculate_message_id(context, val, id, sizeof(id));
|
||||
if (tf_ssb_verify_and_strip_signature(context, val, signature, sizeof(signature))) {
|
||||
tf_ssb_store_message(tf_ssb_connection_get_ssb(connection), context, id, val, signature);
|
||||
tf_ssb_db_store_message(tf_ssb_connection_get_ssb(connection), context, id, val, signature);
|
||||
} else {
|
||||
printf("failed to verify message\n");
|
||||
}
|
||||
@ -387,7 +388,7 @@ void tf_ssb_rpc_send_createHistoryStream(tf_ssb_connection_t* connection, const
|
||||
JS_SetPropertyStr(context, obj, "keys", JS_FALSE);
|
||||
int64_t sequence = 0;
|
||||
tf_ssb_t* ssb = tf_ssb_connection_get_ssb(connection);
|
||||
if (tf_ssb_get_latest_message_by_author(ssb, id, &sequence, NULL, 0)) {
|
||||
if (tf_ssb_db_get_latest_message_by_author(ssb, id, &sequence, NULL, 0)) {
|
||||
JS_SetPropertyStr(context, obj, "seq", JS_NewInt64(context, sequence));
|
||||
}
|
||||
JSValue argsval = JS_NewArray(context);
|
||||
|
Reference in New Issue
Block a user