Browse Source

feat(sync): add rsapi update-remote-files

rcmerci 3 years ago
parent
commit
6f65879b84

+ 3 - 0
src/electron/electron/file_sync_rsapi.cljs

@@ -21,3 +21,6 @@
 
 
 (defn update-remote-file [graph-uuid base-path file-path txid token]
 (defn update-remote-file [graph-uuid base-path file-path txid token]
   (rsapi/updateRemoteFile graph-uuid base-path file-path txid token))
   (rsapi/updateRemoteFile graph-uuid base-path file-path txid token))
+
+(defn update-remote-files [graph-uuid base-path file-paths txid token]
+  (rsapi/updateRemoteFiles graph-uuid base-path (clj->js file-paths) txid token))

+ 3 - 0
src/electron/electron/handler.cljs

@@ -435,6 +435,9 @@
   (apply rsapi/update-remote-file (rest args)))
   (apply rsapi/update-remote-file (rest args)))
 >>>>>>> b06048fa0 (feat(sync): integrate file-sync-rsapi, update sync.cljs)
 >>>>>>> b06048fa0 (feat(sync): integrate file-sync-rsapi, update sync.cljs)
 
 
+(defmethod handle :update-remote-files [_ args]
+  (apply rsapi/update-remote-files (rest args)))
+
 (defmethod handle :default [args]
 (defmethod handle :default [args]
   (println "Error: no ipc handler for: " (bean/->js args)))
   (println "Error: no ipc handler for: " (bean/->js args)))
 
 

+ 7 - 0
src/main/frontend/fs/sync.cljs

@@ -267,6 +267,7 @@
   (update-local-files [this graph-uuid base-path filepaths] "remote -> local")
   (update-local-files [this graph-uuid base-path filepaths] "remote -> local")
   (delete-local-files [this graph-uuid base-path filepaths])
   (delete-local-files [this graph-uuid base-path filepaths])
   (update-remote-file [this graph-uuid base-path filepath local-txid] "local -> remote, return err or txid")
   (update-remote-file [this graph-uuid base-path filepath local-txid] "local -> remote, return err or txid")
+  (update-remote-files [this graph-uuid base-path filepaths local-txid] "local -> remote, return err or txid")
   (delete-remote-files [this graph-uuid base-path filepaths local-txid] "return err or txid"))
   (delete-remote-files [this graph-uuid base-path filepaths local-txid] "return err or txid"))
 
 
 (defprotocol IRemoteAPI
 (defprotocol IRemoteAPI
@@ -357,6 +358,12 @@
         (<! (retry-rsapi
         (<! (retry-rsapi
              #(p->c (ipc/ipc "update-remote-file" graph-uuid base-path filepath local-txid token)))))))
              #(p->c (ipc/ipc "update-remote-file" graph-uuid base-path filepath local-txid token)))))))
 
 
+  (update-remote-files [this graph-uuid base-path filepaths local-txid]
+    (go
+      (let [token (<! (get-token this))]
+        (<! (retry-rsapi
+             #(p->c (ipc/ipc "update-remote-files" graph-uuid base-path filepaths local-txid token)))))))
+
   (delete-remote-files [this graph-uuid base-path filepaths local-txid]
   (delete-remote-files [this graph-uuid base-path filepaths local-txid]
     (go
     (go
       (let [token (<! (get-token this))]
       (let [token (<! (get-token this))]