add config element for push strategy

Mon, 16 Sep 2019 19:49:04 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Mon, 16 Sep 2019 19:49:04 +0200
changeset 642
4e23087d3d90
parent 641
b138d1241e68
child 643
5b8643cf0a2f

add config element for push strategy

dav/scfg.c file | annotate | diff | comparison | revisions
dav/scfg.h file | annotate | diff | comparison | revisions
--- a/dav/scfg.c	Sun Sep 15 16:11:58 2019 +0200
+++ b/dav/scfg.c	Mon Sep 16 19:49:04 2019 +0200
@@ -398,6 +398,7 @@
     time_t lock_timeout = 0;
     uint32_t metadata = 0;
     uint32_t symlink = 0;
+    PushStrategy pushstrat = PUSH_STRATEGY_METADATA;
     
     unsigned short parentlineno = node->line;
     node = node->children;
@@ -457,7 +458,7 @@
                 }
             } else if(xstreq(node->name, "allow-cmd")) {
                 int cmds = 0;
-                const char *delims = " ,\r\n";
+                const char *delims = " ,\t\r\n";
                 char *cmdstr = strdup(value);
                 char *cmd = strtok(cmdstr, delims);
                 while(cmd) {
@@ -491,7 +492,15 @@
                 }
             } else if(xstreq(node->name, "hashing")) {
                 hashing = util_getboolean(value);
-                store_hash = hashing; // TODO: extra config for this?
+                store_hash = hashing;
+            } else if(xstreq(node->name, "push-strategy")) {
+                if(value) {
+                    if(xstreq(value, "metadata")) {
+                        pushstrat = PUSH_STRATEGY_METADATA;
+                    } else if(xstreq(value, "hash")) {
+                        pushstrat = PUSH_STRATEGY_HASH;
+                    }
+                }
             } else if(xstreq(node->name, "symlinks")) {
                 uint32_t symlinkconfig = 0;
                 const char *delims = " ,\r\n";
@@ -557,6 +566,7 @@
     dir->metadata = metadata;
     dir->splitconfig = splitconfig;
     dir->symlink = symlink;
+    dir->push_strategy = pushstrat;
     if((metadata & FINFO_MODE) == FINFO_MODE) {
         dir->db_settings = DB_STORE_MODE;
     }
--- a/dav/scfg.h	Sun Sep 15 16:11:58 2019 +0200
+++ b/dav/scfg.h	Mon Sep 16 19:49:04 2019 +0200
@@ -62,7 +62,13 @@
 typedef struct TagConfig   TagConfig;
 typedef struct Versioning  Versioning;
 typedef struct SplitConfig SplitConfig;
-    
+
+enum PushStrategy {
+    PUSH_STRATEGY_METADATA = 0,
+    PUSH_STRATEGY_HASH
+};
+typedef enum PushStrategy PushStrategy;
+
 typedef struct SyncDirectory {
     char *name;
     char *path;
@@ -81,6 +87,7 @@
     int allow_cmd;
     uint32_t symlink;
     time_t lock_timeout;
+    PushStrategy push_strategy;
     bool backuppull;
     bool lockpull;
     bool lockpush;

mercurial