mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-22 13:05:51 +03:00
Add a journal testing mode to the client.
This commit is contained in:
parent
ad67b21062
commit
4fb4ff84a8
3 changed files with 28 additions and 3 deletions
|
@ -40,12 +40,14 @@ static char args_doc[] = "SOURCE DESTINATION";
|
|||
static struct argp_option options[] = {
|
||||
{"update", 'u', 0, 0, "Run only the update detection", 0},
|
||||
{"reconcile",'r', 0, 0, "Run update detection and recoincilation", 0},
|
||||
{"journal", 'j', 0, 0, "Testing only", 0},
|
||||
{NULL, 0, 0, 0, NULL, 0}
|
||||
};
|
||||
|
||||
/* Used by main to communicate with parse_opt. */
|
||||
struct argument_s {
|
||||
char *args[2]; /* SOURCE and DESTINATION */
|
||||
int journal;
|
||||
int update;
|
||||
int reconcile;
|
||||
int propagate;
|
||||
|
@ -59,11 +61,21 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state) {
|
|||
struct argument_s *arguments = state->input;
|
||||
|
||||
switch (key) {
|
||||
case 'j':
|
||||
arguments->journal = 1;
|
||||
arguments->update = 1;
|
||||
arguments->reconcile = 0;
|
||||
arguments->propagate = 0;
|
||||
case 'u':
|
||||
arguments->journal = 0;
|
||||
arguments->update = 1;
|
||||
arguments->reconcile = 0;
|
||||
arguments->propagate = 0;
|
||||
break;
|
||||
case 'r':
|
||||
arguments->journal = 0;
|
||||
arguments->update = 1;
|
||||
arguments->reconcile = 1;
|
||||
arguments->propagate = 0;
|
||||
case ARGP_KEY_ARG:
|
||||
if (state->arg_num >= 2) {
|
||||
|
@ -93,6 +105,7 @@ int main(int argc, char **argv) {
|
|||
struct argument_s arguments;
|
||||
|
||||
/* Default values. */
|
||||
arguments.journal = 0;
|
||||
arguments.update = 1;
|
||||
arguments.reconcile = 1;
|
||||
arguments.propagate = 1;
|
||||
|
@ -121,6 +134,10 @@ int main(int argc, char **argv) {
|
|||
if (arguments.propagate) {
|
||||
}
|
||||
|
||||
if (arguments.journal) {
|
||||
csync_set_status(csync, 0xFFFF);
|
||||
}
|
||||
|
||||
csync_destroy(csync);
|
||||
|
||||
return 0;
|
||||
|
|
11
src/csync.c
11
src/csync.c
|
@ -343,9 +343,6 @@ int csync_destroy(CSYNC *ctx) {
|
|||
csync_vio_shutdown(ctx);
|
||||
|
||||
if (ctx->journal.db != NULL) {
|
||||
/* TODO: temporary define for testing! */
|
||||
ctx->status = CSYNC_DONE;
|
||||
|
||||
if (ctx->status & CSYNC_DONE) {
|
||||
time(&start);
|
||||
if (csync_journal_write(ctx) == 0) {
|
||||
|
@ -404,3 +401,11 @@ const char *csync_version(void) {
|
|||
return CSYNC_VERSION_STRING;
|
||||
}
|
||||
|
||||
void csync_set_status(CSYNC *ctx, int status) {
|
||||
ctx->status = status;
|
||||
}
|
||||
|
||||
int csync_get_status(CSYNC *ctx) {
|
||||
return ctx->status;
|
||||
}
|
||||
|
||||
|
|
|
@ -125,6 +125,9 @@ int csync_destroy(CSYNC *ctx);
|
|||
*/
|
||||
const char *csync_version(void);
|
||||
|
||||
void csync_set_status(CSYNC *ctx, int status);
|
||||
int csync_get_status(CSYNC *ctx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue