core-3nweb-client-lib 0.25.6 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/build/api-defs/asmail.d.ts +1 -1
- package/build/api-defs/files.d.ts +282 -70
- package/build/core/app-files.js +7 -7
- package/build/core/asmail/config/common.js +4 -4
- package/build/core/asmail/config/index.js +2 -2
- package/build/core/asmail/config/published-intro-key.js +1 -1
- package/build/core/asmail/delivery/common.js +7 -7
- package/build/core/asmail/delivery/index.js +7 -6
- package/build/core/asmail/delivery/msg.js +8 -7
- package/build/core/asmail/delivery/per-recipient-wip.js +3 -3
- package/build/core/asmail/inbox/attachments/fs.js +11 -1
- package/build/core/asmail/inbox/cached-msgs.js +3 -3
- package/build/core/asmail/inbox/inbox-events.js +5 -4
- package/build/core/asmail/inbox/index.js +12 -12
- package/build/core/asmail/inbox/msg-downloader.js +3 -3
- package/build/core/asmail/inbox/msg-indexing.js +4 -4
- package/build/core/asmail/inbox/msg-on-disk.js +7 -7
- package/build/core/asmail/index.d.ts +3 -3
- package/build/core/asmail/index.js +13 -8
- package/build/core/asmail/key-verification.js +5 -5
- package/build/core/asmail/keyring/common.js +7 -6
- package/build/core/asmail/keyring/correspondent-keys.js +8 -7
- package/build/core/asmail/keyring/id-to-email-map.js +2 -1
- package/build/core/asmail/keyring/index.d.ts +7 -8
- package/build/core/asmail/keyring/index.js +15 -14
- package/build/core/asmail/keyring/keyring-storage.js +4 -3
- package/build/core/asmail/msg/opener.js +3 -3
- package/build/core/asmail/msg/packer.js +13 -13
- package/build/core/asmail/sending-params/own-params.js +4 -4
- package/build/core/asmail/sending-params/params-from-others.js +3 -3
- package/build/core/id-manager.js +8 -5
- package/build/core/index.d.ts +2 -1
- package/build/core/index.js +14 -14
- package/build/core/sign-in.d.ts +5 -4
- package/build/core/sign-in.js +12 -14
- package/build/core/sign-up.d.ts +1 -0
- package/build/core/sign-up.js +15 -11
- package/build/core/storage/common/json-saving.d.ts +21 -0
- package/build/core/storage/common/json-saving.js +82 -0
- package/build/core/storage/common/obj-info-file.d.ts +51 -0
- package/build/core/storage/common/obj-info-file.js +153 -5
- package/build/core/storage/common/utils.d.ts +2 -0
- package/build/core/storage/common/utils.js +32 -0
- package/build/core/storage/index.d.ts +3 -17
- package/build/core/storage/index.js +57 -77
- package/build/core/storage/local/obj-files-gc.d.ts +2 -0
- package/build/core/storage/local/obj-files-gc.js +53 -39
- package/build/core/storage/local/obj-files.d.ts +6 -9
- package/build/core/storage/local/obj-files.js +16 -19
- package/build/core/storage/local/obj-status.d.ts +20 -30
- package/build/core/storage/local/obj-status.js +46 -113
- package/build/core/storage/local/storage.d.ts +15 -5
- package/build/core/storage/local/storage.js +37 -18
- package/build/core/storage/synced/downloader.js +7 -6
- package/build/core/storage/synced/obj-files-gc.d.ts +6 -1
- package/build/core/storage/synced/obj-files-gc.js +106 -13
- package/build/core/storage/synced/obj-files.d.ts +46 -47
- package/build/core/storage/synced/obj-files.js +207 -154
- package/build/core/storage/synced/obj-status.d.ts +103 -42
- package/build/core/storage/synced/obj-status.js +525 -137
- package/build/core/storage/synced/remote-events.d.ts +11 -12
- package/build/core/storage/synced/remote-events.js +80 -57
- package/build/core/storage/synced/storage.d.ts +24 -5
- package/build/core/storage/synced/storage.js +123 -38
- package/build/core/storage/synced/upload-header-file.d.ts +4 -0
- package/build/core/storage/synced/upload-header-file.js +64 -0
- package/build/core/storage/synced/upsyncer.d.ts +15 -9
- package/build/core/storage/synced/upsyncer.js +219 -246
- package/build/core/storage/system-folders/apps-data.d.ts +16 -0
- package/build/core/storage/system-folders/apps-data.js +110 -0
- package/build/core/storage/system-folders/index.d.ts +18 -0
- package/build/core/storage/system-folders/index.js +77 -0
- package/build/core-ipc/common-caps.js +3 -3
- package/build/core-ipc/generic.js +8 -8
- package/build/core-ipc/startup-caps.js +2 -2
- package/build/cryptors.js +6 -2
- package/build/ipc-via-protobuf/asmail-cap.js +67 -83
- package/build/ipc-via-protobuf/bytes.js +16 -17
- package/build/ipc-via-protobuf/connector-clients-side.d.ts +3 -0
- package/build/ipc-via-protobuf/connector-clients-side.js +62 -25
- package/build/ipc-via-protobuf/connector-services-side.js +10 -10
- package/build/ipc-via-protobuf/connector.js +4 -4
- package/build/ipc-via-protobuf/file.d.ts +48 -12
- package/build/ipc-via-protobuf/file.js +476 -120
- package/build/ipc-via-protobuf/fs.d.ts +8 -0
- package/build/ipc-via-protobuf/fs.js +592 -159
- package/build/ipc-via-protobuf/log-cap.js +2 -2
- package/build/ipc-via-protobuf/mailerid.js +3 -3
- package/build/ipc-via-protobuf/protobuf-msg.d.ts +1 -0
- package/build/ipc-via-protobuf/protobuf-msg.js +11 -7
- package/build/ipc-via-protobuf/startup-cap.js +23 -23
- package/build/ipc-via-protobuf/storage-cap.js +12 -12
- package/build/ipc.js +7 -2
- package/build/lib-client/3nstorage/exceptions.d.ts +12 -8
- package/build/lib-client/3nstorage/exceptions.js +31 -10
- package/build/lib-client/3nstorage/service.d.ts +16 -2
- package/build/lib-client/3nstorage/service.js +109 -39
- package/build/lib-client/3nstorage/util/file-based-json.d.ts +2 -1
- package/build/lib-client/3nstorage/util/file-based-json.js +1 -1
- package/build/lib-client/3nstorage/xsp-fs/attrs.js +17 -17
- package/build/lib-client/3nstorage/xsp-fs/common.d.ts +52 -14
- package/build/lib-client/3nstorage/xsp-fs/common.js +31 -16
- package/build/lib-client/3nstorage/xsp-fs/file-node.d.ts +1 -0
- package/build/lib-client/3nstorage/xsp-fs/file-node.js +18 -14
- package/build/lib-client/3nstorage/xsp-fs/file.d.ts +31 -6
- package/build/lib-client/3nstorage/xsp-fs/file.js +74 -23
- package/build/lib-client/3nstorage/xsp-fs/folder-node-serialization.js +4 -4
- package/build/lib-client/3nstorage/xsp-fs/folder-node.d.ts +24 -11
- package/build/lib-client/3nstorage/xsp-fs/folder-node.js +599 -189
- package/build/lib-client/3nstorage/xsp-fs/fs.d.ts +45 -9
- package/build/lib-client/3nstorage/xsp-fs/fs.js +326 -74
- package/build/lib-client/3nstorage/xsp-fs/link-node.d.ts +1 -0
- package/build/lib-client/3nstorage/xsp-fs/link-node.js +7 -2
- package/build/lib-client/3nstorage/xsp-fs/node-in-fs.d.ts +30 -20
- package/build/lib-client/3nstorage/xsp-fs/node-in-fs.js +239 -106
- package/build/lib-client/3nstorage/xsp-fs/node-persistence.d.ts +1 -1
- package/build/lib-client/3nstorage/xsp-fs/node-persistence.js +18 -19
- package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v1.js +5 -5
- package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v2.js +56 -56
- package/build/lib-client/3nweb-signup.js +4 -4
- package/build/lib-client/asmail/recipient.js +15 -15
- package/build/lib-client/asmail/sender.js +22 -22
- package/build/lib-client/asmail/service-config.js +3 -3
- package/build/lib-client/cryptor/cryptor-in-worker.js +19 -17
- package/build/lib-client/cryptor/cryptor-wasm.js +1 -1
- package/build/lib-client/cryptor/cryptor.js +4 -2
- package/build/lib-client/cryptor/cryptor.wasm +0 -0
- package/build/lib-client/cryptor/in-proc-js.js +1 -1
- package/build/lib-client/cryptor/in-proc-wasm.js +7 -7
- package/build/lib-client/cryptor/worker-js.js +2 -2
- package/build/lib-client/cryptor/worker-wasm.js +2 -2
- package/build/lib-client/files-select.js +1 -1
- package/build/lib-client/files.d.ts +1 -1
- package/build/lib-client/files.js +71 -4
- package/build/lib-client/fs-collection.js +3 -2
- package/build/lib-client/fs-sync-utils.d.ts +5 -0
- package/build/lib-client/fs-sync-utils.js +61 -0
- package/build/lib-client/fs-view.d.ts +14 -0
- package/build/lib-client/fs-view.js +33 -0
- package/build/lib-client/key-derivation.js +1 -1
- package/build/lib-client/local-files/dev-file-sink.js +9 -9
- package/build/lib-client/local-files/dev-file-src.js +2 -2
- package/build/lib-client/local-files/device-fs.d.ts +1 -1
- package/build/lib-client/local-files/device-fs.js +56 -54
- package/build/lib-client/logging/log-to-file.d.ts +1 -1
- package/build/lib-client/logging/log-to-file.js +11 -11
- package/build/lib-client/mailer-id/login.js +7 -7
- package/build/lib-client/mailer-id/provisioner.js +12 -12
- package/build/lib-client/objs-on-disk/file-writing-proc.js +5 -5
- package/build/lib-client/objs-on-disk/obj-folders.js +33 -33
- package/build/lib-client/objs-on-disk/obj-on-disk.d.ts +13 -2
- package/build/lib-client/objs-on-disk/obj-on-disk.js +24 -9
- package/build/lib-client/request-utils.d.ts +1 -0
- package/build/lib-client/request-utils.js +14 -14
- package/build/lib-client/server-events.d.ts +3 -3
- package/build/lib-client/server-events.js +12 -10
- package/build/lib-client/service-locator.js +10 -10
- package/build/lib-client/user-with-mid-session.js +7 -7
- package/build/lib-client/user-with-pkl-session.js +25 -25
- package/build/lib-client/ws-utils.js +3 -3
- package/build/lib-common/async-cryptor-wrap.js +4 -4
- package/build/lib-common/async-fs-node.d.ts +5 -3
- package/build/lib-common/async-fs-node.js +19 -18
- package/build/lib-common/byte-streaming/pipe.js +1 -1
- package/build/lib-common/byte-streaming/wrapping.js +17 -17
- package/build/lib-common/canonical-address.js +1 -1
- package/build/lib-common/exceptions/error.d.ts +1 -0
- package/build/lib-common/exceptions/error.js +7 -6
- package/build/lib-common/exceptions/file.js +10 -1
- package/build/lib-common/ipc/generic-ipc.js +2 -2
- package/build/lib-common/ipc/ws-ipc.js +2 -2
- package/build/lib-common/json-utils.js +2 -1
- package/build/lib-common/mid-sigs-NaCl-Ed.js +14 -14
- package/build/lib-common/objs-on-disk/file-layout.d.ts +19 -0
- package/build/lib-common/objs-on-disk/file-layout.js +130 -12
- package/build/lib-common/objs-on-disk/obj-file.d.ts +13 -2
- package/build/lib-common/objs-on-disk/obj-file.js +99 -37
- package/build/lib-common/objs-on-disk/utils.d.ts +1 -0
- package/build/lib-common/objs-on-disk/utils.js +4 -4
- package/build/lib-common/objs-on-disk/v1-obj-file-format.js +14 -14
- package/build/lib-common/processes/deferred.d.ts +6 -0
- package/build/lib-common/processes/deferred.js +30 -0
- package/build/lib-common/processes/labelled-exec-pools.d.ts +33 -0
- package/build/lib-common/processes/labelled-exec-pools.js +141 -0
- package/build/lib-common/processes/pressure.d.ts +7 -0
- package/build/lib-common/processes/pressure.js +56 -0
- package/build/lib-common/processes/sleep.d.ts +1 -0
- package/build/lib-common/processes/sleep.js +26 -0
- package/build/lib-common/{processes.d.ts → processes/synced.d.ts} +0 -40
- package/build/lib-common/{processes.js → processes/synced.js} +187 -204
- package/build/lib-common/processes/timeout.d.ts +1 -0
- package/build/lib-common/processes/timeout.js +51 -0
- package/build/lib-common/random-node.js +7 -7
- package/build/lib-common/service-api/3nstorage/owner.d.ts +100 -39
- package/build/lib-common/service-api/3nstorage/owner.js +85 -42
- package/build/lib-common/service-api/asmail/delivery.js +2 -2
- package/build/lib-common/service-api/asmail/retrieval.js +1 -1
- package/build/lib-common/timed-cache.d.ts +1 -0
- package/build/lib-common/timed-non-weak-cache.d.ts +1 -0
- package/build/lib-common/timed-non-weak-cache.js +11 -0
- package/build/lib-common/utils-for-observables.d.ts +15 -1
- package/build/lib-common/utils-for-observables.js +70 -19
- package/build/lib-common/weak-cache.d.ts +1 -0
- package/build/lib-common/weak-cache.js +12 -1
- package/build/lib-index.d.ts +2 -1
- package/build/lib-index.js +10 -7
- package/build/protos/asmail.proto.js +12912 -7127
- package/build/protos/file.proto.js +4848 -2399
- package/build/protos/fs.proto.js +9230 -3445
- package/package.json +8 -7
- package/protos/file.proto +91 -11
- package/protos/fs.proto +107 -8
- package/build/core/storage/synced/upsync-status.d.ts +0 -41
- package/build/core/storage/synced/upsync-status.js +0 -158
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "core-3nweb-client-lib",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"description": "3NWeb client core library, embeddable into different environments",
|
|
5
5
|
"main": "build/lib-index.js",
|
|
6
6
|
"types": "build/lib-index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "bash packing/protos-to-node-module.sh && tsc -p ts-code && bash packing/copy-api.sh && bash packing/build-wasm-cryptor.sh",
|
|
9
|
+
"build-only-ts": "tsc -p ts-code",
|
|
9
10
|
"test": "node build/tests/jasmine.js"
|
|
10
11
|
},
|
|
11
12
|
"repository": {
|
|
@@ -27,18 +28,18 @@
|
|
|
27
28
|
"license": "GPL-3.0-or-later",
|
|
28
29
|
"dependencies": {
|
|
29
30
|
"ecma-nacl": "^2.5.1",
|
|
30
|
-
"protobufjs": "^6.
|
|
31
|
+
"protobufjs": "^6.11.3",
|
|
31
32
|
"punycode": "^2.1.1",
|
|
32
33
|
"rxjs": "^6.5.2",
|
|
33
|
-
"ws": "^7.
|
|
34
|
+
"ws": "^7.4.6",
|
|
34
35
|
"xsp-files": "^4.0.0"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
38
|
"@types/jasmine": "^3.9.1",
|
|
38
|
-
"@types/node": "^
|
|
39
|
-
"@types/ws": "^4.
|
|
39
|
+
"@types/node": "^16.11.7",
|
|
40
|
+
"@types/ws": "^7.4.7",
|
|
40
41
|
"jasmine": "^3.9.0",
|
|
41
|
-
"spec-3nweb-server": "^1.
|
|
42
|
-
"typescript": "^
|
|
42
|
+
"spec-3nweb-server": "^1.6.1",
|
|
43
|
+
"typescript": "^4.7.4"
|
|
43
44
|
}
|
|
44
45
|
}
|
package/protos/file.proto
CHANGED
|
@@ -13,6 +13,22 @@ message File {
|
|
|
13
13
|
// impl is a reference to object with methods of either
|
|
14
14
|
// ReadonlyFile or WritableFile
|
|
15
15
|
common.ObjectReference impl = 5;
|
|
16
|
+
bool is_synced = 6;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
message SyncStatusMsg {
|
|
21
|
+
string state = 1;
|
|
22
|
+
SyncVersionsBranchMsg local = 2;
|
|
23
|
+
SyncVersionsBranchMsg synced = 3;
|
|
24
|
+
SyncVersionsBranchMsg remote = 4;
|
|
25
|
+
common.BooleanValue exists_in_synced_parent = 5;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
message SyncVersionsBranchMsg {
|
|
29
|
+
common.UInt64Value latest = 1;
|
|
30
|
+
repeated uint64 archived = 2;
|
|
31
|
+
common.BooleanValue is_archived = 3;
|
|
16
32
|
}
|
|
17
33
|
|
|
18
34
|
|
|
@@ -30,6 +46,7 @@ message StatsMsg {
|
|
|
30
46
|
common.UInt64Value mtime = 6;
|
|
31
47
|
common.UInt64Value ctime = 7;
|
|
32
48
|
common.UInt64Value version = 8;
|
|
49
|
+
SyncStatusMsg sync = 9;
|
|
33
50
|
}
|
|
34
51
|
|
|
35
52
|
// --- ReadonlyFile.getXAttr ---
|
|
@@ -76,11 +93,10 @@ message ReadBytesReplyBody {
|
|
|
76
93
|
message FileEventMsg {
|
|
77
94
|
string type = 1;
|
|
78
95
|
string path = 2;
|
|
79
|
-
common.
|
|
96
|
+
common.StringValue src = 3;
|
|
80
97
|
common.UInt64Value new_version = 4;
|
|
81
|
-
common.UInt64Value
|
|
82
|
-
common.UInt64Value
|
|
83
|
-
common.UInt64Value remote_version = 16;
|
|
98
|
+
common.UInt64Value removed_arch_ver = 5;
|
|
99
|
+
common.UInt64Value archived_version = 6;
|
|
84
100
|
}
|
|
85
101
|
|
|
86
102
|
|
|
@@ -131,6 +147,13 @@ message VersionedGetByteSourceReplyBody {
|
|
|
131
147
|
common.ObjectReference src = 2;
|
|
132
148
|
}
|
|
133
149
|
|
|
150
|
+
// --- ReadonlyFileVersionedAPI.listVersions ---
|
|
151
|
+
// Request body is empty
|
|
152
|
+
message ListVersionsReplyBody {
|
|
153
|
+
common.UInt64Value current = 1;
|
|
154
|
+
repeated uint64 archived = 2;
|
|
155
|
+
}
|
|
156
|
+
|
|
134
157
|
|
|
135
158
|
// ==== WritableFile referable as impl object (extends ReadonlyFile) ====
|
|
136
159
|
|
|
@@ -140,14 +163,15 @@ message UpdateXAttrsRequestBody {
|
|
|
140
163
|
XAttrsChanges changes = 1;
|
|
141
164
|
}
|
|
142
165
|
|
|
166
|
+
message NameAndXAttrValue {
|
|
167
|
+
string xa_name = 1;
|
|
168
|
+
common.StringValue str = 2;
|
|
169
|
+
common.StringValue json = 3;
|
|
170
|
+
common.BytesValue bytes = 4;
|
|
171
|
+
}
|
|
172
|
+
|
|
143
173
|
message XAttrsChanges {
|
|
144
|
-
|
|
145
|
-
string xa_name = 1;
|
|
146
|
-
common.StringValue str = 2;
|
|
147
|
-
common.StringValue json = 3;
|
|
148
|
-
common.BytesValue bytes = 4;
|
|
149
|
-
}
|
|
150
|
-
repeated NameAndAttrValue set = 1;
|
|
174
|
+
repeated NameAndXAttrValue set = 1;
|
|
151
175
|
repeated string remove = 2;
|
|
152
176
|
}
|
|
153
177
|
|
|
@@ -215,3 +239,59 @@ message VersionedGetByteSinkReplyBody {
|
|
|
215
239
|
// --- WritableFileVersionedAPI.copy ---
|
|
216
240
|
// Request body is CopyRequestBody
|
|
217
241
|
// Reply body is common.UInt64Value
|
|
242
|
+
|
|
243
|
+
// --- WritableFileVersionedAPI.archiveCurrent ---
|
|
244
|
+
// Reply body is common.UInt64Value
|
|
245
|
+
message ArchiveCurrentRequestBody {
|
|
246
|
+
common.UInt64Value version = 1;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
// ==== ReadonlyFileSyncAPI referable object ====
|
|
251
|
+
|
|
252
|
+
// --- ReadonlyFileSyncAPI.status ---
|
|
253
|
+
// Request body is empty
|
|
254
|
+
// Reply body is SyncStatusMsg
|
|
255
|
+
|
|
256
|
+
// --- ReadonlyFileSyncAPI.updateStatusInfo ---
|
|
257
|
+
// Request body is PathOnlyRequestBody
|
|
258
|
+
// Reply body is SyncState
|
|
259
|
+
|
|
260
|
+
// --- ReadonlyFileSyncAPI.isRemoteVersionOnDisk ---
|
|
261
|
+
message FileSyncIsOnDiskRequestBody {
|
|
262
|
+
uint64 version = 1;
|
|
263
|
+
}
|
|
264
|
+
message FileSyncIsOnDiskReplyBody {
|
|
265
|
+
string status = 1;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// --- ReadonlyFileSyncAPI.download ---
|
|
269
|
+
// Reply has only status and body is empty
|
|
270
|
+
message FileSyncDownloadRequestBody {
|
|
271
|
+
uint64 version = 1;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// --- ReadonlyFileSyncAPI.adoptRemote ---
|
|
275
|
+
// Reply has only status and body is empty
|
|
276
|
+
message AdoptRemoteRequestBody {
|
|
277
|
+
OptionsToAdopteRemote opts = 1;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
message OptionsToAdopteRemote {
|
|
281
|
+
common.BooleanValue drop_local_ver = 1;
|
|
282
|
+
common.UInt64Value remote_version = 2;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
// ==== WritableFileSyncAPI referable object ====
|
|
287
|
+
|
|
288
|
+
// --- WritableFileSyncAPI.upload ---
|
|
289
|
+
// Reply has only status and body is empty
|
|
290
|
+
message FileSyncUploadRequestBody {
|
|
291
|
+
OptionsToUploadLocal opts = 1;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
message OptionsToUploadLocal {
|
|
295
|
+
common.UInt64Value local_version = 1;
|
|
296
|
+
common.UInt64Value upload_version = 2;
|
|
297
|
+
}
|
package/protos/fs.proto
CHANGED
|
@@ -14,6 +14,7 @@ message FS {
|
|
|
14
14
|
// impl is a reference to object with methods of either
|
|
15
15
|
// ReadonlyFS or WritableFS
|
|
16
16
|
common.ObjectReference impl = 5;
|
|
17
|
+
bool is_synced = 6;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
|
|
@@ -78,15 +79,15 @@ message SymLinkTargetReplyBody {
|
|
|
78
79
|
message FSEventMsg {
|
|
79
80
|
string type = 1;
|
|
80
81
|
string path = 2;
|
|
81
|
-
common.
|
|
82
|
+
common.StringValue src = 3;
|
|
82
83
|
common.UInt64Value new_version = 4;
|
|
83
|
-
common.StringValue name =
|
|
84
|
-
common.StringValue old_name =
|
|
85
|
-
common.StringValue new_name =
|
|
86
|
-
ListingEntryMsg entry =
|
|
87
|
-
common.UInt64Value
|
|
88
|
-
common.UInt64Value
|
|
89
|
-
common.UInt64Value
|
|
84
|
+
common.StringValue name = 5;
|
|
85
|
+
common.StringValue old_name = 6;
|
|
86
|
+
common.StringValue new_name = 7;
|
|
87
|
+
ListingEntryMsg entry = 8;
|
|
88
|
+
common.UInt64Value move_label = 9;
|
|
89
|
+
common.UInt64Value removed_arch_ver = 10;
|
|
90
|
+
common.UInt64Value archived_version = 11;
|
|
90
91
|
}
|
|
91
92
|
|
|
92
93
|
// --- ReadonlyFS.watchFile ---
|
|
@@ -96,6 +97,10 @@ message FSEventMsg {
|
|
|
96
97
|
// --- ReadonlyFS.watchTree ---
|
|
97
98
|
// Its an observable call, and initial request is PathOnlyRequestBody
|
|
98
99
|
// Observer expects FSEventMsg in next.
|
|
100
|
+
message WatchTreeRequestBody {
|
|
101
|
+
string path = 1;
|
|
102
|
+
common.UInt32Value depth = 2;
|
|
103
|
+
}
|
|
99
104
|
|
|
100
105
|
// --- ReadonlyFS.close ---
|
|
101
106
|
// Request body is empty
|
|
@@ -256,6 +261,10 @@ message VersionedListFolderReplyBody {
|
|
|
256
261
|
// Request body is PathOnlyRequestBody
|
|
257
262
|
// Reply body is file.VersionedGetByteSourceReplyBody
|
|
258
263
|
|
|
264
|
+
// --- ReadonlyFSVersionedAPI.getByteSource ---
|
|
265
|
+
// Request body is PathOnlyRequestBody
|
|
266
|
+
// Reply body is file.ListVersionsReplyBody
|
|
267
|
+
|
|
259
268
|
|
|
260
269
|
// ==== WritableFS referable as impl object (extends ReadonlyFS) ====
|
|
261
270
|
|
|
@@ -430,3 +439,93 @@ message VersionedGetByteSinkRequestBody {
|
|
|
430
439
|
VersionedFileFlags flags = 2;
|
|
431
440
|
}
|
|
432
441
|
|
|
442
|
+
// --- WritableFSVersionedAPI.archiveCurrent ---
|
|
443
|
+
// Reply body is common.UInt64Value
|
|
444
|
+
message ArchiveCurrentRequestBody {
|
|
445
|
+
string path = 1;
|
|
446
|
+
common.UInt64Value version = 2;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
// ==== ReadonlyFSSyncAPI referable object ====
|
|
451
|
+
|
|
452
|
+
// --- ReadonlyFSSyncAPI.status ---
|
|
453
|
+
// Request body is PathOnlyRequestBody
|
|
454
|
+
// Reply body is file.SyncState
|
|
455
|
+
|
|
456
|
+
// --- ReadonlyFSSyncAPI.updateStatusInfo ---
|
|
457
|
+
// Request body is PathOnlyRequestBody
|
|
458
|
+
// Reply body is file.SyncState
|
|
459
|
+
|
|
460
|
+
// --- ReadonlyFSSyncAPI.isRemoteVersionOnDisk ---
|
|
461
|
+
message FSSyncIsOnDiskRequestBody {
|
|
462
|
+
string path = 1;
|
|
463
|
+
uint64 version = 2;
|
|
464
|
+
}
|
|
465
|
+
message FSSyncIsOnDiskReplyBody {
|
|
466
|
+
string status = 1;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
// --- ReadonlyFSSyncAPI.download ---
|
|
470
|
+
// Reply has only status and body is empty
|
|
471
|
+
message FSSyncDownloadRequestBody {
|
|
472
|
+
string path = 1;
|
|
473
|
+
uint64 version = 2;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
// --- ReadonlyFSSyncAPI.adoptRemote ---
|
|
477
|
+
// Reply has only status and body is empty
|
|
478
|
+
message AdoptRemoteRequestBody {
|
|
479
|
+
string path = 1;
|
|
480
|
+
file.OptionsToAdopteRemote opts = 2;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
// --- ReadonlyFSSyncAPI.diffCurrentAndRemote ---
|
|
484
|
+
message DiffCurrentAndRemoteRequestBody {
|
|
485
|
+
string path = 1;
|
|
486
|
+
common.UInt64Value remote_version = 2;
|
|
487
|
+
}
|
|
488
|
+
message DiffCurrentAndRemoteReplyBody {
|
|
489
|
+
FolderDiff diff = 1;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
message FolderDiff {
|
|
493
|
+
message TimeStamps {
|
|
494
|
+
uint64 current = 1;
|
|
495
|
+
common.UInt64Value remote = 2;
|
|
496
|
+
}
|
|
497
|
+
message XAttrs {
|
|
498
|
+
repeated file.NameAndXAttrValue in_current = 1;
|
|
499
|
+
repeated file.NameAndXAttrValue in_remote = 2;
|
|
500
|
+
repeated string name_overlaps = 3;
|
|
501
|
+
}
|
|
502
|
+
uint64 current_version = 1;
|
|
503
|
+
common.UInt64Value remote_version = 2;
|
|
504
|
+
repeated ListingEntryMsg in_current = 3;
|
|
505
|
+
repeated ListingEntryMsg in_remote = 4;
|
|
506
|
+
repeated string name_overlaps = 5;
|
|
507
|
+
TimeStamps ctime = 6;
|
|
508
|
+
TimeStamps mtime = 7;
|
|
509
|
+
XAttrs xattrs = 8;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+
// ==== WritableFSSyncAPI referable object ====
|
|
514
|
+
|
|
515
|
+
// --- WritableFSSyncAPI.upload ---
|
|
516
|
+
// Reply has only status and body is empty
|
|
517
|
+
message FSSyncUploadRequestBody {
|
|
518
|
+
string path = 1;
|
|
519
|
+
file.OptionsToUploadLocal opts = 2;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
// --- WritableFSSyncAPI.adoptRemoteFolderItem ---
|
|
523
|
+
message AdoptRemoteFolderItemRequestBody {
|
|
524
|
+
message Options {
|
|
525
|
+
common.UInt64Value local_version = 1;
|
|
526
|
+
common.UInt64Value upload_version = 2;
|
|
527
|
+
}
|
|
528
|
+
string path = 1;
|
|
529
|
+
string item_name = 2;
|
|
530
|
+
Options opts = 3;
|
|
531
|
+
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { LogError } from '../../../lib-client/logging/log-to-file';
|
|
2
|
-
export interface UploadInfo {
|
|
3
|
-
type: 'upload';
|
|
4
|
-
transactionId?: string;
|
|
5
|
-
awaiting?: {
|
|
6
|
-
header?: true;
|
|
7
|
-
segs: BytesSection[];
|
|
8
|
-
allByteOnDisk?: true;
|
|
9
|
-
};
|
|
10
|
-
version: number;
|
|
11
|
-
baseVersion?: number;
|
|
12
|
-
done: boolean;
|
|
13
|
-
}
|
|
14
|
-
export interface BytesSection {
|
|
15
|
-
ofs: number;
|
|
16
|
-
len: number;
|
|
17
|
-
}
|
|
18
|
-
export interface RemovalInfo {
|
|
19
|
-
type: 'removal';
|
|
20
|
-
archivedVersions?: number[] | number;
|
|
21
|
-
currentVersion?: true;
|
|
22
|
-
}
|
|
23
|
-
export interface ArchivalInfo {
|
|
24
|
-
type: 'archiving';
|
|
25
|
-
archivalOfCurrent?: true;
|
|
26
|
-
}
|
|
27
|
-
export declare type UpSyncTaskInfo = UploadInfo | RemovalInfo | ArchivalInfo;
|
|
28
|
-
export declare function makeUploadInfo(version: number, baseVersion: number | undefined): UploadInfo;
|
|
29
|
-
export declare class UpSyncTasks {
|
|
30
|
-
private readonly objFolder;
|
|
31
|
-
private readonly saveProc;
|
|
32
|
-
private status;
|
|
33
|
-
private initProc;
|
|
34
|
-
private tasksAwaitingInit;
|
|
35
|
-
constructor(objFolder: string, logError: LogError);
|
|
36
|
-
queueTask(t: UpSyncTaskInfo): void;
|
|
37
|
-
nextTask(): Promise<UpSyncTaskInfo | undefined>;
|
|
38
|
-
recordInterimStateOfCurrentTask(t: UploadInfo): Promise<void>;
|
|
39
|
-
recordTaskCompletion(t: UpSyncTaskInfo): Promise<void>;
|
|
40
|
-
isDone(): boolean;
|
|
41
|
-
}
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
Copyright (C) 2020 3NSoft Inc.
|
|
4
|
-
|
|
5
|
-
This program is free software: you can redistribute it and/or modify it under
|
|
6
|
-
the terms of the GNU General Public License as published by the Free Software
|
|
7
|
-
Foundation, either version 3 of the License, or (at your option) any later
|
|
8
|
-
version.
|
|
9
|
-
|
|
10
|
-
This program is distributed in the hope that it will be useful, but
|
|
11
|
-
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
13
|
-
See the GNU General Public License for more details.
|
|
14
|
-
|
|
15
|
-
You should have received a copy of the GNU General Public License along with
|
|
16
|
-
this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.UpSyncTasks = exports.makeUploadInfo = void 0;
|
|
19
|
-
const processes_1 = require("../../../lib-common/processes");
|
|
20
|
-
const fs = require("../../../lib-common/async-fs-node");
|
|
21
|
-
const path_1 = require("path");
|
|
22
|
-
const obj_info_file_1 = require("../common/obj-info-file");
|
|
23
|
-
function makeUploadInfo(version, baseVersion) {
|
|
24
|
-
return {
|
|
25
|
-
type: 'upload',
|
|
26
|
-
done: false,
|
|
27
|
-
version,
|
|
28
|
-
baseVersion
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
exports.makeUploadInfo = makeUploadInfo;
|
|
32
|
-
const UPSYNC_FILE_NAME = 'upsync';
|
|
33
|
-
class UpSyncTasks {
|
|
34
|
-
constructor(objFolder, logError) {
|
|
35
|
-
this.objFolder = objFolder;
|
|
36
|
-
this.saveProc = new processes_1.DeduppedRunner(async () => {
|
|
37
|
-
if (this.isDone()) {
|
|
38
|
-
await fs.unlink(path_1.join(this.objFolder, UPSYNC_FILE_NAME)).catch((e) => { if (!e.notFound) {
|
|
39
|
-
throw e;
|
|
40
|
-
} });
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
await fs.writeFile(path_1.join(this.objFolder, UPSYNC_FILE_NAME), JSON.stringify(this.status), { encoding: 'utf8' });
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
this.status = undefined;
|
|
47
|
-
this.initProc = undefined;
|
|
48
|
-
this.tasksAwaitingInit = undefined;
|
|
49
|
-
this.initProc = readOrMakeUpSyncInfo(this.objFolder).then(status => {
|
|
50
|
-
this.status = status;
|
|
51
|
-
if (this.tasksAwaitingInit) {
|
|
52
|
-
for (const t of this.tasksAwaitingInit) {
|
|
53
|
-
this.queueTask(t);
|
|
54
|
-
}
|
|
55
|
-
this.tasksAwaitingInit = undefined;
|
|
56
|
-
}
|
|
57
|
-
this.initProc = undefined;
|
|
58
|
-
}, err => {
|
|
59
|
-
logError(err, `Can't setup upsync status.`);
|
|
60
|
-
this.initProc = undefined;
|
|
61
|
-
});
|
|
62
|
-
Object.seal(this);
|
|
63
|
-
}
|
|
64
|
-
queueTask(t) {
|
|
65
|
-
if (this.status) {
|
|
66
|
-
addTaskToQueue(this.status.queued, t);
|
|
67
|
-
this.saveProc.trigger();
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
if (!this.tasksAwaitingInit) {
|
|
71
|
-
this.tasksAwaitingInit = [];
|
|
72
|
-
}
|
|
73
|
-
this.tasksAwaitingInit.push(t);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
async nextTask() {
|
|
77
|
-
if (!this.status) {
|
|
78
|
-
await this.initProc;
|
|
79
|
-
if (!this.status) {
|
|
80
|
-
throw new Error(`Status not set after wait`);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
if (this.status.current) {
|
|
84
|
-
return this.status.current;
|
|
85
|
-
}
|
|
86
|
-
this.status.current = this.status.queued.shift();
|
|
87
|
-
if (this.status.current) {
|
|
88
|
-
await this.saveProc.trigger();
|
|
89
|
-
}
|
|
90
|
-
return this.status.current;
|
|
91
|
-
}
|
|
92
|
-
async recordInterimStateOfCurrentTask(t) {
|
|
93
|
-
if (!this.status) {
|
|
94
|
-
throw new Error(`This method is called too early.`);
|
|
95
|
-
}
|
|
96
|
-
if (this.status.current === t) {
|
|
97
|
-
await this.saveProc.trigger();
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
throw new Error(`Can save interim state of a current task only`);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
async recordTaskCompletion(t) {
|
|
104
|
-
if (!this.status) {
|
|
105
|
-
throw new Error(`This method is called too early.`);
|
|
106
|
-
}
|
|
107
|
-
if (this.status.current === t) {
|
|
108
|
-
this.status.current = undefined;
|
|
109
|
-
await this.saveProc.trigger();
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
isDone() {
|
|
113
|
-
if (!this.status) {
|
|
114
|
-
return false;
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
return (!this.status.current && (this.status.queued.length === 0));
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
exports.UpSyncTasks = UpSyncTasks;
|
|
122
|
-
Object.freeze(UpSyncTasks.prototype);
|
|
123
|
-
Object.freeze(UpSyncTasks);
|
|
124
|
-
function addTaskToQueue(q, t) {
|
|
125
|
-
if (t.type === 'upload') {
|
|
126
|
-
addUploadToQueue(q, t);
|
|
127
|
-
}
|
|
128
|
-
else if (t.type === 'removal') {
|
|
129
|
-
addRemovalToQueue(q, t);
|
|
130
|
-
}
|
|
131
|
-
else if (t.type === 'archiving') {
|
|
132
|
-
addArchivalToQueue(q, t);
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
throw new Error(`Unsupported upsync task type`);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
function addUploadToQueue(q, u) {
|
|
139
|
-
// XXX
|
|
140
|
-
q.push(u);
|
|
141
|
-
}
|
|
142
|
-
function addRemovalToQueue(q, r) {
|
|
143
|
-
// XXX
|
|
144
|
-
q.push(r);
|
|
145
|
-
}
|
|
146
|
-
function addArchivalToQueue(q, a) {
|
|
147
|
-
// XXX
|
|
148
|
-
q.push(a);
|
|
149
|
-
}
|
|
150
|
-
async function readOrMakeUpSyncInfo(objFolder) {
|
|
151
|
-
const status = await obj_info_file_1.readJSONInfoFileIn(objFolder, UPSYNC_FILE_NAME);
|
|
152
|
-
if (!status) {
|
|
153
|
-
return { queued: [] };
|
|
154
|
-
}
|
|
155
|
-
// XXX we may do some checks and sanitization here
|
|
156
|
-
return status;
|
|
157
|
-
}
|
|
158
|
-
Object.freeze(exports);
|