Move Rhizome function declaration from server.h to rhizome.h and rename

This commit is contained in:
Andrew Bettison 2018-06-01 01:11:44 +09:30
parent 659d726687
commit b8ddad6ff2
4 changed files with 7 additions and 7 deletions

View File

@ -64,6 +64,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "keyring.h"
#include "socket.h"
#include "server.h"
#include "rhizome.h"
#include "route_link.h"
#include "debug.h"
@ -1620,7 +1621,7 @@ static void mdp_process_packet(struct socket_address *client, struct mdp_header
break;
case MDP_SYNC_RHIZOME:
DEBUGF(mdprequests, "Processing MDP_SYNC_RHIZOME from %s", alloca_socket_address(client));
server_rhizome_add_bundle(INT64_MAX);
rhizome_process_added_bundles(INT64_MAX);
mdp_reply_ok(client, header);
break;
case MDP_INTERFACE:

View File

@ -910,6 +910,7 @@ int rhizome_cache_close();
int rhizome_database_filehash_from_id(const rhizome_bid_t *bidp, uint64_t version, rhizome_filehash_t *hashp);
void rhizome_process_added_bundles(uint64_t up_to_rowid);
void rhizome_sync_status();
DECLARE_ALARM(rhizome_fetch_status);

View File

@ -1564,7 +1564,7 @@ enum rhizome_bundle_status rhizome_add_manifest_to_store(rhizome_manifest *m, rh
// due to potential race conditions, we have to do this here
// even though the CLI will try to send us a MDP_SYNC_RHIZOME message
if (m->rowid > max_rowid+1)
server_rhizome_add_bundle(m->rowid);
rhizome_process_added_bundles(m->rowid);
max_rowid = m->rowid;
CALL_TRIGGER(bundle_add, m);
}else{
@ -2028,14 +2028,14 @@ end:
return ret;
}
// Detect bundles added from the cmdline, and call trigger functions
void server_rhizome_add_bundle(uint64_t rowid){
// Detect bundles added from the cmdline, and call trigger functions.
void rhizome_process_added_bundles(uint64_t up_to_rowid) {
assert(serverMode);
sqlite_retry_state retry = SQLITE_RETRY_STATE_DEFAULT;
sqlite3_stmt *statement = sqlite_prepare_bind(&retry,
"SELECT id, manifest, version, inserttime, author, rowid FROM manifests WHERE rowid > ? AND rowid < ?"
"ORDER BY rowid",
INT64, max_rowid, INT64, rowid, END);
INT64, max_rowid, INT64, up_to_rowid, END);
while (sqlite_step_retry(&retry, statement) == SQLITE_ROW) {
rhizome_manifest *m = rhizome_new_manifest();
if (!m)

View File

@ -52,8 +52,6 @@ void server_loop(time_ms_t (*waiting)(time_ms_t, time_ms_t, time_ms_t), void (*w
int server_write_proc_state(const char *path, const char *fmt, ...);
int server_unlink_proc_state(const char *path);
void server_rhizome_add_bundle(uint64_t rowid);
DECLARE_TRIGGER(startup);
DECLARE_TRIGGER(shutdown);