mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-01-29 15:43:56 +00:00
Add clean command to verify all bundles
This commit is contained in:
parent
1178ce44ac
commit
b67516558e
@ -1560,6 +1560,9 @@ int app_rhizome_clean(const struct cli_parsed *parsed, void *context)
|
||||
{
|
||||
if (config.debug.verbose)
|
||||
DEBUG_cli_parsed(parsed);
|
||||
int verify = cli_arg(parsed, "verify", NULL, NULL, NULL) == 0;
|
||||
if (verify)
|
||||
verify_bundles();
|
||||
struct rhizome_cleanup_report report;
|
||||
if (rhizome_cleanup(&report) == -1)
|
||||
return -1;
|
||||
@ -2343,7 +2346,7 @@ struct cli_schema command_line_options[]={
|
||||
"Deliver all new content to the specified Rhizome Direct server. Return when done."},
|
||||
{app_rhizome_direct_sync,{"rhizome","direct","pull","[<url>]",NULL}, 0,
|
||||
"Fetch all new content from the specified Rhizome Direct server. Return when done."},
|
||||
{app_rhizome_clean,{"rhizome","clean",NULL}, 0,
|
||||
{app_rhizome_clean,{"rhizome","clean","[verify]",NULL}, 0,
|
||||
"Remove stale and orphaned content from the Rhizome store"},
|
||||
{app_keyring_create,{"keyring","create",NULL}, 0,
|
||||
"Create a new keyring file."},
|
||||
|
@ -200,6 +200,7 @@ extern sqlite3 *rhizome_db;
|
||||
|
||||
int rhizome_opendb();
|
||||
int rhizome_close_db();
|
||||
void verify_bundles();
|
||||
|
||||
struct rhizome_cleanup_report {
|
||||
int deleted_stale_incoming_files;
|
||||
|
@ -160,7 +160,7 @@ void sqlite_log(void *ignored, int result, const char *msg){
|
||||
WARNF("Sqlite: %d %s", result, msg);
|
||||
}
|
||||
|
||||
static void verify_bundles(){
|
||||
void verify_bundles(){
|
||||
// assume that only the manifest itself can be trusted
|
||||
// fetch all manifests and reinsert them.
|
||||
sqlite_retry_state retry = SQLITE_RETRY_STATE_DEFAULT;
|
||||
@ -187,7 +187,7 @@ static void verify_bundles(){
|
||||
}
|
||||
if (ret!=0){
|
||||
DEBUGF("Removing invalid manifest entry @%lld", rowid);
|
||||
//sqlite_exec_void_retry(&retry, "DELETE FROM MANIFESTS WHERE ROWID=%lld;", rowid);
|
||||
sqlite_exec_void_retry(&retry, "DELETE FROM MANIFESTS WHERE ROWID=%lld;", rowid);
|
||||
}
|
||||
rhizome_manifest_free(m);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user