zen-fs-config 0.7.24 → 0.7.25
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/dist/index.d.mts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +23 -19
- package/dist/index.mjs +23 -19
- package/dist/zen-fs-config.js +40 -34
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1121,6 +1121,16 @@ declare class ConfigRepo implements IConfigRepo {
|
|
|
1121
1121
|
* 这些路径改由 processTombstones 主动删除,直到所有副本确认不存在、
|
|
1122
1122
|
* 墓碑被 GC 之后才恢复同步。
|
|
1123
1123
|
*/
|
|
1124
|
+
/**
|
|
1125
|
+
* 永不参与内容同步的元数据路径。
|
|
1126
|
+
*
|
|
1127
|
+
* `.meta/group.json` 是同步身份(kind/id/instanceId)的载体,只在身份流程里写:
|
|
1128
|
+
* 建同步对时读它、认领/对齐时写它。一旦让普通内容同步(按 mtime 双向)
|
|
1129
|
+
* 也去搬这个文件,身份就成了"谁最后写谁赢"——两台设备各持一个实例 ID 时会
|
|
1130
|
+
* 互相覆盖,远端根的 instanceId 便会反复变化,且全程绕开 claim / 冲突判定。
|
|
1131
|
+
* 所以这里固定排除,刷新墓碑排除表时也不得清掉。
|
|
1132
|
+
*/
|
|
1133
|
+
private static readonly PERMANENT_SYNC_EXCLUSIONS;
|
|
1124
1134
|
private readonly tombstoneExcludePrefixes;
|
|
1125
1135
|
private readonly syncFilter;
|
|
1126
1136
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1121,6 +1121,16 @@ declare class ConfigRepo implements IConfigRepo {
|
|
|
1121
1121
|
* 这些路径改由 processTombstones 主动删除,直到所有副本确认不存在、
|
|
1122
1122
|
* 墓碑被 GC 之后才恢复同步。
|
|
1123
1123
|
*/
|
|
1124
|
+
/**
|
|
1125
|
+
* 永不参与内容同步的元数据路径。
|
|
1126
|
+
*
|
|
1127
|
+
* `.meta/group.json` 是同步身份(kind/id/instanceId)的载体,只在身份流程里写:
|
|
1128
|
+
* 建同步对时读它、认领/对齐时写它。一旦让普通内容同步(按 mtime 双向)
|
|
1129
|
+
* 也去搬这个文件,身份就成了"谁最后写谁赢"——两台设备各持一个实例 ID 时会
|
|
1130
|
+
* 互相覆盖,远端根的 instanceId 便会反复变化,且全程绕开 claim / 冲突判定。
|
|
1131
|
+
* 所以这里固定排除,刷新墓碑排除表时也不得清掉。
|
|
1132
|
+
*/
|
|
1133
|
+
private static readonly PERMANENT_SYNC_EXCLUSIONS;
|
|
1124
1134
|
private readonly tombstoneExcludePrefixes;
|
|
1125
1135
|
private readonly syncFilter;
|
|
1126
1136
|
/**
|
package/dist/index.js
CHANGED
|
@@ -3021,7 +3021,7 @@ function dedupeAppDataBackends(backends) {
|
|
|
3021
3021
|
}
|
|
3022
3022
|
return { kept: Array.from(byKey.values()), removed };
|
|
3023
3023
|
}
|
|
3024
|
-
var ConfigRepo = class {
|
|
3024
|
+
var ConfigRepo = class _ConfigRepo {
|
|
3025
3025
|
appId;
|
|
3026
3026
|
nodeId;
|
|
3027
3027
|
/** Fixed id for the unified sync-group model. */
|
|
@@ -3057,7 +3057,17 @@ var ConfigRepo = class {
|
|
|
3057
3057
|
* 这些路径改由 processTombstones 主动删除,直到所有副本确认不存在、
|
|
3058
3058
|
* 墓碑被 GC 之后才恢复同步。
|
|
3059
3059
|
*/
|
|
3060
|
-
|
|
3060
|
+
/**
|
|
3061
|
+
* 永不参与内容同步的元数据路径。
|
|
3062
|
+
*
|
|
3063
|
+
* `.meta/group.json` 是同步身份(kind/id/instanceId)的载体,只在身份流程里写:
|
|
3064
|
+
* 建同步对时读它、认领/对齐时写它。一旦让普通内容同步(按 mtime 双向)
|
|
3065
|
+
* 也去搬这个文件,身份就成了"谁最后写谁赢"——两台设备各持一个实例 ID 时会
|
|
3066
|
+
* 互相覆盖,远端根的 instanceId 便会反复变化,且全程绕开 claim / 冲突判定。
|
|
3067
|
+
* 所以这里固定排除,刷新墓碑排除表时也不得清掉。
|
|
3068
|
+
*/
|
|
3069
|
+
static PERMANENT_SYNC_EXCLUSIONS = [GROUP_DESCRIPTOR_FILE3];
|
|
3070
|
+
tombstoneExcludePrefixes = [..._ConfigRepo.PERMANENT_SYNC_EXCLUSIONS];
|
|
3061
3071
|
syncFilter = { excludePrefixes: this.tombstoneExcludePrefixes };
|
|
3062
3072
|
/**
|
|
3063
3073
|
* 本轮 processTombstones 中,各副本对墓碑路径"已确认不存在"的结果。
|
|
@@ -3368,7 +3378,7 @@ var ConfigRepo = class {
|
|
|
3368
3378
|
* `filter.excludePrefixes`),所以这里原地更新即可生效。
|
|
3369
3379
|
*/
|
|
3370
3380
|
refreshSyncExclusions(tombstones) {
|
|
3371
|
-
this.tombstoneExcludePrefixes.length =
|
|
3381
|
+
this.tombstoneExcludePrefixes.length = _ConfigRepo.PERMANENT_SYNC_EXCLUSIONS.length;
|
|
3372
3382
|
const add = (target) => {
|
|
3373
3383
|
this.tombstoneExcludePrefixes.push(target, `${target}/`);
|
|
3374
3384
|
};
|
|
@@ -5484,7 +5494,7 @@ var ConfigRepo = class {
|
|
|
5484
5494
|
}
|
|
5485
5495
|
}
|
|
5486
5496
|
};
|
|
5487
|
-
var AppDataGroupImpl = class {
|
|
5497
|
+
var AppDataGroupImpl = class _AppDataGroupImpl {
|
|
5488
5498
|
groupId;
|
|
5489
5499
|
appId;
|
|
5490
5500
|
kind = "data";
|
|
@@ -5507,8 +5517,12 @@ var AppDataGroupImpl = class {
|
|
|
5507
5517
|
* 保留期内的墓碑路径不参与同步:否则副本上的残留会被当作"远端内容"逐文件
|
|
5508
5518
|
* 拉回本地,把已删除的目录复活。数组与各同步对共享同一实例(zen-fs-sync
|
|
5509
5519
|
* 每次检测时实时读取 `filter.excludePrefixes`),原地更新即可生效。
|
|
5520
|
+
*
|
|
5521
|
+
* 除墓碑外还固定排除 `.meta/group.json`:它是本组的同步身份,只允许身份流程
|
|
5522
|
+
* 写入;让普通内容同步搬它,等于让"谁最后写谁赢"决定组身份。
|
|
5510
5523
|
*/
|
|
5511
|
-
|
|
5524
|
+
static PERMANENT_SYNC_EXCLUSIONS = [...CONFIG_ONLY_PREFIXES, GROUP_DESCRIPTOR_FILE3];
|
|
5525
|
+
tombstoneExcludePrefixes = [..._AppDataGroupImpl.PERMANENT_SYNC_EXCLUSIONS];
|
|
5512
5526
|
syncFilter = { excludePrefixes: this.tombstoneExcludePrefixes };
|
|
5513
5527
|
constructor(groupId, appId, backends, pollIntervalMs, parent, descriptor = {}) {
|
|
5514
5528
|
this.groupId = groupId;
|
|
@@ -6240,8 +6254,7 @@ var AppDataGroupImpl = class {
|
|
|
6240
6254
|
* 参与同步。注意**不能**为 `.keep` 占位排除父目录,否则真实数据会被一起挡掉。
|
|
6241
6255
|
*/
|
|
6242
6256
|
refreshSyncExclusions(tombstones) {
|
|
6243
|
-
this.tombstoneExcludePrefixes.length =
|
|
6244
|
-
this.tombstoneExcludePrefixes.push(...CONFIG_ONLY_PREFIXES);
|
|
6257
|
+
this.tombstoneExcludePrefixes.length = _AppDataGroupImpl.PERMANENT_SYNC_EXCLUSIONS.length;
|
|
6245
6258
|
for (const tombstone of tombstones) {
|
|
6246
6259
|
if (!tombstone.path) continue;
|
|
6247
6260
|
this.tombstoneExcludePrefixes.push(tombstone.path, `${tombstone.path}/`);
|
|
@@ -6550,9 +6563,9 @@ async function createConfigRepo(appId, options = {}) {
|
|
|
6550
6563
|
schemaVersion: 2,
|
|
6551
6564
|
kind: "config",
|
|
6552
6565
|
id: CONFIG_GROUP_ID,
|
|
6553
|
-
//
|
|
6554
|
-
//
|
|
6555
|
-
instanceId:
|
|
6566
|
+
// 只纠正 kind/id,instanceId 原样保留:换身份必须由用户拍板,
|
|
6567
|
+
// 初始化阶段不得顺手派生新 UUID(那会给远端根引入第三个值)。
|
|
6568
|
+
...isValidGroupInstanceId(declaredIdentity.instanceId) ? { instanceId: declaredIdentity.instanceId } : {},
|
|
6556
6569
|
...declaredIdentity.name ? { name: declaredIdentity.name } : {},
|
|
6557
6570
|
features: CONFIG_GROUP_FEATURES
|
|
6558
6571
|
});
|
|
@@ -6567,15 +6580,6 @@ async function createConfigRepo(appId, options = {}) {
|
|
|
6567
6580
|
await primaryInstance.writeFile(markerPath, groupTypeBytes);
|
|
6568
6581
|
log5.log(`[createConfigRepo] group-type set to "config-sync" at ${markerPath}`);
|
|
6569
6582
|
}
|
|
6570
|
-
if (!declaredIdentity) {
|
|
6571
|
-
await writeGroupDescriptor(primaryInstance, {
|
|
6572
|
-
schemaVersion: 2,
|
|
6573
|
-
kind: "config",
|
|
6574
|
-
id: CONFIG_GROUP_ID,
|
|
6575
|
-
instanceId: newGroupInstanceId(),
|
|
6576
|
-
features: CONFIG_GROUP_FEATURES
|
|
6577
|
-
});
|
|
6578
|
-
}
|
|
6579
6583
|
try {
|
|
6580
6584
|
await primaryInstance.unlink(`${META_DIR}/group-type`);
|
|
6581
6585
|
log5.log("[createConfigRepo] removed stale legacy .meta/group-type");
|
package/dist/index.mjs
CHANGED
|
@@ -2262,7 +2262,7 @@ function dedupeAppDataBackends(backends) {
|
|
|
2262
2262
|
}
|
|
2263
2263
|
return { kept: Array.from(byKey.values()), removed };
|
|
2264
2264
|
}
|
|
2265
|
-
var ConfigRepo = class {
|
|
2265
|
+
var ConfigRepo = class _ConfigRepo {
|
|
2266
2266
|
appId;
|
|
2267
2267
|
nodeId;
|
|
2268
2268
|
/** Fixed id for the unified sync-group model. */
|
|
@@ -2298,7 +2298,17 @@ var ConfigRepo = class {
|
|
|
2298
2298
|
* 这些路径改由 processTombstones 主动删除,直到所有副本确认不存在、
|
|
2299
2299
|
* 墓碑被 GC 之后才恢复同步。
|
|
2300
2300
|
*/
|
|
2301
|
-
|
|
2301
|
+
/**
|
|
2302
|
+
* 永不参与内容同步的元数据路径。
|
|
2303
|
+
*
|
|
2304
|
+
* `.meta/group.json` 是同步身份(kind/id/instanceId)的载体,只在身份流程里写:
|
|
2305
|
+
* 建同步对时读它、认领/对齐时写它。一旦让普通内容同步(按 mtime 双向)
|
|
2306
|
+
* 也去搬这个文件,身份就成了"谁最后写谁赢"——两台设备各持一个实例 ID 时会
|
|
2307
|
+
* 互相覆盖,远端根的 instanceId 便会反复变化,且全程绕开 claim / 冲突判定。
|
|
2308
|
+
* 所以这里固定排除,刷新墓碑排除表时也不得清掉。
|
|
2309
|
+
*/
|
|
2310
|
+
static PERMANENT_SYNC_EXCLUSIONS = [GROUP_DESCRIPTOR_FILE3];
|
|
2311
|
+
tombstoneExcludePrefixes = [..._ConfigRepo.PERMANENT_SYNC_EXCLUSIONS];
|
|
2302
2312
|
syncFilter = { excludePrefixes: this.tombstoneExcludePrefixes };
|
|
2303
2313
|
/**
|
|
2304
2314
|
* 本轮 processTombstones 中,各副本对墓碑路径"已确认不存在"的结果。
|
|
@@ -2609,7 +2619,7 @@ var ConfigRepo = class {
|
|
|
2609
2619
|
* `filter.excludePrefixes`),所以这里原地更新即可生效。
|
|
2610
2620
|
*/
|
|
2611
2621
|
refreshSyncExclusions(tombstones) {
|
|
2612
|
-
this.tombstoneExcludePrefixes.length =
|
|
2622
|
+
this.tombstoneExcludePrefixes.length = _ConfigRepo.PERMANENT_SYNC_EXCLUSIONS.length;
|
|
2613
2623
|
const add = (target) => {
|
|
2614
2624
|
this.tombstoneExcludePrefixes.push(target, `${target}/`);
|
|
2615
2625
|
};
|
|
@@ -4725,7 +4735,7 @@ var ConfigRepo = class {
|
|
|
4725
4735
|
}
|
|
4726
4736
|
}
|
|
4727
4737
|
};
|
|
4728
|
-
var AppDataGroupImpl = class {
|
|
4738
|
+
var AppDataGroupImpl = class _AppDataGroupImpl {
|
|
4729
4739
|
groupId;
|
|
4730
4740
|
appId;
|
|
4731
4741
|
kind = "data";
|
|
@@ -4748,8 +4758,12 @@ var AppDataGroupImpl = class {
|
|
|
4748
4758
|
* 保留期内的墓碑路径不参与同步:否则副本上的残留会被当作"远端内容"逐文件
|
|
4749
4759
|
* 拉回本地,把已删除的目录复活。数组与各同步对共享同一实例(zen-fs-sync
|
|
4750
4760
|
* 每次检测时实时读取 `filter.excludePrefixes`),原地更新即可生效。
|
|
4761
|
+
*
|
|
4762
|
+
* 除墓碑外还固定排除 `.meta/group.json`:它是本组的同步身份,只允许身份流程
|
|
4763
|
+
* 写入;让普通内容同步搬它,等于让"谁最后写谁赢"决定组身份。
|
|
4751
4764
|
*/
|
|
4752
|
-
|
|
4765
|
+
static PERMANENT_SYNC_EXCLUSIONS = [...CONFIG_ONLY_PREFIXES, GROUP_DESCRIPTOR_FILE3];
|
|
4766
|
+
tombstoneExcludePrefixes = [..._AppDataGroupImpl.PERMANENT_SYNC_EXCLUSIONS];
|
|
4753
4767
|
syncFilter = { excludePrefixes: this.tombstoneExcludePrefixes };
|
|
4754
4768
|
constructor(groupId, appId, backends, pollIntervalMs, parent, descriptor = {}) {
|
|
4755
4769
|
this.groupId = groupId;
|
|
@@ -5481,8 +5495,7 @@ var AppDataGroupImpl = class {
|
|
|
5481
5495
|
* 参与同步。注意**不能**为 `.keep` 占位排除父目录,否则真实数据会被一起挡掉。
|
|
5482
5496
|
*/
|
|
5483
5497
|
refreshSyncExclusions(tombstones) {
|
|
5484
|
-
this.tombstoneExcludePrefixes.length =
|
|
5485
|
-
this.tombstoneExcludePrefixes.push(...CONFIG_ONLY_PREFIXES);
|
|
5498
|
+
this.tombstoneExcludePrefixes.length = _AppDataGroupImpl.PERMANENT_SYNC_EXCLUSIONS.length;
|
|
5486
5499
|
for (const tombstone of tombstones) {
|
|
5487
5500
|
if (!tombstone.path) continue;
|
|
5488
5501
|
this.tombstoneExcludePrefixes.push(tombstone.path, `${tombstone.path}/`);
|
|
@@ -5791,9 +5804,9 @@ async function createConfigRepo(appId, options = {}) {
|
|
|
5791
5804
|
schemaVersion: 2,
|
|
5792
5805
|
kind: "config",
|
|
5793
5806
|
id: CONFIG_GROUP_ID,
|
|
5794
|
-
//
|
|
5795
|
-
//
|
|
5796
|
-
instanceId:
|
|
5807
|
+
// 只纠正 kind/id,instanceId 原样保留:换身份必须由用户拍板,
|
|
5808
|
+
// 初始化阶段不得顺手派生新 UUID(那会给远端根引入第三个值)。
|
|
5809
|
+
...isValidGroupInstanceId(declaredIdentity.instanceId) ? { instanceId: declaredIdentity.instanceId } : {},
|
|
5797
5810
|
...declaredIdentity.name ? { name: declaredIdentity.name } : {},
|
|
5798
5811
|
features: CONFIG_GROUP_FEATURES
|
|
5799
5812
|
});
|
|
@@ -5808,15 +5821,6 @@ async function createConfigRepo(appId, options = {}) {
|
|
|
5808
5821
|
await primaryInstance.writeFile(markerPath, groupTypeBytes);
|
|
5809
5822
|
log5.log(`[createConfigRepo] group-type set to "config-sync" at ${markerPath}`);
|
|
5810
5823
|
}
|
|
5811
|
-
if (!declaredIdentity) {
|
|
5812
|
-
await writeGroupDescriptor(primaryInstance, {
|
|
5813
|
-
schemaVersion: 2,
|
|
5814
|
-
kind: "config",
|
|
5815
|
-
id: CONFIG_GROUP_ID,
|
|
5816
|
-
instanceId: newGroupInstanceId(),
|
|
5817
|
-
features: CONFIG_GROUP_FEATURES
|
|
5818
|
-
});
|
|
5819
|
-
}
|
|
5820
5824
|
try {
|
|
5821
5825
|
await primaryInstance.unlink(`${META_DIR}/group-type`);
|
|
5822
5826
|
log5.log("[createConfigRepo] removed stale legacy .meta/group-type");
|
package/dist/zen-fs-config.js
CHANGED
|
@@ -28978,7 +28978,7 @@ var ZenFSConfig = (() => {
|
|
|
28978
28978
|
}
|
|
28979
28979
|
return { kept: Array.from(byKey.values()), removed };
|
|
28980
28980
|
}
|
|
28981
|
-
var
|
|
28981
|
+
var _ConfigRepo = class _ConfigRepo {
|
|
28982
28982
|
constructor(appId, nodeId, primaryBackendId, cachedFS, serializer, onConflict, pollIntervalMs, cacheOptions) {
|
|
28983
28983
|
__publicField(this, "appId");
|
|
28984
28984
|
__publicField(this, "nodeId");
|
|
@@ -29007,15 +29007,7 @@ var ZenFSConfig = (() => {
|
|
|
29007
29007
|
__publicField(this, "pollIntervalMs");
|
|
29008
29008
|
/** Tombstone cache — avoids redundant reads within a single flush() cycle. */
|
|
29009
29009
|
__publicField(this, "tombstoneCache", null);
|
|
29010
|
-
|
|
29011
|
-
* 墓碑存在期间被排除在同步之外的路径。
|
|
29012
|
-
*
|
|
29013
|
-
* 远端副本可能仍残留被删路径(哪怕只剩 `.keep` / `.keep.mtime` 占位)。
|
|
29014
|
-
* 若同步照常进行,这类残留会被当成"远端新增"再拉回本地,造成空壳复活。
|
|
29015
|
-
* 这些路径改由 processTombstones 主动删除,直到所有副本确认不存在、
|
|
29016
|
-
* 墓碑被 GC 之后才恢复同步。
|
|
29017
|
-
*/
|
|
29018
|
-
__publicField(this, "tombstoneExcludePrefixes", []);
|
|
29010
|
+
__publicField(this, "tombstoneExcludePrefixes", [..._ConfigRepo.PERMANENT_SYNC_EXCLUSIONS]);
|
|
29019
29011
|
__publicField(this, "syncFilter", { excludePrefixes: this.tombstoneExcludePrefixes });
|
|
29020
29012
|
/**
|
|
29021
29013
|
* 本轮 processTombstones 中,各副本对墓碑路径"已确认不存在"的结果。
|
|
@@ -29325,7 +29317,7 @@ var ZenFSConfig = (() => {
|
|
|
29325
29317
|
* `filter.excludePrefixes`),所以这里原地更新即可生效。
|
|
29326
29318
|
*/
|
|
29327
29319
|
refreshSyncExclusions(tombstones) {
|
|
29328
|
-
this.tombstoneExcludePrefixes.length =
|
|
29320
|
+
this.tombstoneExcludePrefixes.length = _ConfigRepo.PERMANENT_SYNC_EXCLUSIONS.length;
|
|
29329
29321
|
const add = (target) => {
|
|
29330
29322
|
this.tombstoneExcludePrefixes.push(target, `${target}/`);
|
|
29331
29323
|
};
|
|
@@ -31441,7 +31433,26 @@ var ZenFSConfig = (() => {
|
|
|
31441
31433
|
}
|
|
31442
31434
|
}
|
|
31443
31435
|
};
|
|
31444
|
-
|
|
31436
|
+
/**
|
|
31437
|
+
* 墓碑存在期间被排除在同步之外的路径。
|
|
31438
|
+
*
|
|
31439
|
+
* 远端副本可能仍残留被删路径(哪怕只剩 `.keep` / `.keep.mtime` 占位)。
|
|
31440
|
+
* 若同步照常进行,这类残留会被当成"远端新增"再拉回本地,造成空壳复活。
|
|
31441
|
+
* 这些路径改由 processTombstones 主动删除,直到所有副本确认不存在、
|
|
31442
|
+
* 墓碑被 GC 之后才恢复同步。
|
|
31443
|
+
*/
|
|
31444
|
+
/**
|
|
31445
|
+
* 永不参与内容同步的元数据路径。
|
|
31446
|
+
*
|
|
31447
|
+
* `.meta/group.json` 是同步身份(kind/id/instanceId)的载体,只在身份流程里写:
|
|
31448
|
+
* 建同步对时读它、认领/对齐时写它。一旦让普通内容同步(按 mtime 双向)
|
|
31449
|
+
* 也去搬这个文件,身份就成了"谁最后写谁赢"——两台设备各持一个实例 ID 时会
|
|
31450
|
+
* 互相覆盖,远端根的 instanceId 便会反复变化,且全程绕开 claim / 冲突判定。
|
|
31451
|
+
* 所以这里固定排除,刷新墓碑排除表时也不得清掉。
|
|
31452
|
+
*/
|
|
31453
|
+
__publicField(_ConfigRepo, "PERMANENT_SYNC_EXCLUSIONS", [GROUP_DESCRIPTOR_FILE3]);
|
|
31454
|
+
var ConfigRepo = _ConfigRepo;
|
|
31455
|
+
var _AppDataGroupImpl = class _AppDataGroupImpl {
|
|
31445
31456
|
constructor(groupId, appId, backends, pollIntervalMs, parent, descriptor = {}) {
|
|
31446
31457
|
__publicField(this, "groupId");
|
|
31447
31458
|
__publicField(this, "appId");
|
|
@@ -31459,14 +31470,7 @@ var ZenFSConfig = (() => {
|
|
|
31459
31470
|
__publicField(this, "versions");
|
|
31460
31471
|
__publicField(this, "conflicts");
|
|
31461
31472
|
__publicField(this, "postDeleteTimer");
|
|
31462
|
-
|
|
31463
|
-
* 墓碑路径的同步排除表(与配置组同一套机制)。
|
|
31464
|
-
*
|
|
31465
|
-
* 保留期内的墓碑路径不参与同步:否则副本上的残留会被当作"远端内容"逐文件
|
|
31466
|
-
* 拉回本地,把已删除的目录复活。数组与各同步对共享同一实例(zen-fs-sync
|
|
31467
|
-
* 每次检测时实时读取 `filter.excludePrefixes`),原地更新即可生效。
|
|
31468
|
-
*/
|
|
31469
|
-
__publicField(this, "tombstoneExcludePrefixes", [...CONFIG_ONLY_PREFIXES]);
|
|
31473
|
+
__publicField(this, "tombstoneExcludePrefixes", [..._AppDataGroupImpl.PERMANENT_SYNC_EXCLUSIONS]);
|
|
31470
31474
|
__publicField(this, "syncFilter", { excludePrefixes: this.tombstoneExcludePrefixes });
|
|
31471
31475
|
__publicField(this, "parent");
|
|
31472
31476
|
__publicField(this, "_backends");
|
|
@@ -32197,8 +32201,7 @@ var ZenFSConfig = (() => {
|
|
|
32197
32201
|
* 参与同步。注意**不能**为 `.keep` 占位排除父目录,否则真实数据会被一起挡掉。
|
|
32198
32202
|
*/
|
|
32199
32203
|
refreshSyncExclusions(tombstones) {
|
|
32200
|
-
this.tombstoneExcludePrefixes.length =
|
|
32201
|
-
this.tombstoneExcludePrefixes.push(...CONFIG_ONLY_PREFIXES);
|
|
32204
|
+
this.tombstoneExcludePrefixes.length = _AppDataGroupImpl.PERMANENT_SYNC_EXCLUSIONS.length;
|
|
32202
32205
|
for (const tombstone of tombstones) {
|
|
32203
32206
|
if (!tombstone.path) continue;
|
|
32204
32207
|
this.tombstoneExcludePrefixes.push(tombstone.path, `${tombstone.path}/`);
|
|
@@ -32444,6 +32447,18 @@ var ZenFSConfig = (() => {
|
|
|
32444
32447
|
this.dataBackends.clear();
|
|
32445
32448
|
}
|
|
32446
32449
|
};
|
|
32450
|
+
/**
|
|
32451
|
+
* 墓碑路径的同步排除表(与配置组同一套机制)。
|
|
32452
|
+
*
|
|
32453
|
+
* 保留期内的墓碑路径不参与同步:否则副本上的残留会被当作"远端内容"逐文件
|
|
32454
|
+
* 拉回本地,把已删除的目录复活。数组与各同步对共享同一实例(zen-fs-sync
|
|
32455
|
+
* 每次检测时实时读取 `filter.excludePrefixes`),原地更新即可生效。
|
|
32456
|
+
*
|
|
32457
|
+
* 除墓碑外还固定排除 `.meta/group.json`:它是本组的同步身份,只允许身份流程
|
|
32458
|
+
* 写入;让普通内容同步搬它,等于让"谁最后写谁赢"决定组身份。
|
|
32459
|
+
*/
|
|
32460
|
+
__publicField(_AppDataGroupImpl, "PERMANENT_SYNC_EXCLUSIONS", [...CONFIG_ONLY_PREFIXES, GROUP_DESCRIPTOR_FILE3]);
|
|
32461
|
+
var AppDataGroupImpl = _AppDataGroupImpl;
|
|
32447
32462
|
function toUint8Array2(raw) {
|
|
32448
32463
|
if (raw instanceof ArrayBuffer) return new Uint8Array(raw);
|
|
32449
32464
|
if (raw instanceof Uint8Array) return raw;
|
|
@@ -32507,9 +32522,9 @@ var ZenFSConfig = (() => {
|
|
|
32507
32522
|
schemaVersion: 2,
|
|
32508
32523
|
kind: "config",
|
|
32509
32524
|
id: CONFIG_GROUP_ID,
|
|
32510
|
-
//
|
|
32511
|
-
//
|
|
32512
|
-
instanceId:
|
|
32525
|
+
// 只纠正 kind/id,instanceId 原样保留:换身份必须由用户拍板,
|
|
32526
|
+
// 初始化阶段不得顺手派生新 UUID(那会给远端根引入第三个值)。
|
|
32527
|
+
...isValidGroupInstanceId(declaredIdentity.instanceId) ? { instanceId: declaredIdentity.instanceId } : {},
|
|
32513
32528
|
...declaredIdentity.name ? { name: declaredIdentity.name } : {},
|
|
32514
32529
|
features: CONFIG_GROUP_FEATURES
|
|
32515
32530
|
});
|
|
@@ -32524,15 +32539,6 @@ var ZenFSConfig = (() => {
|
|
|
32524
32539
|
await primaryInstance.writeFile(markerPath, groupTypeBytes);
|
|
32525
32540
|
log9.log(`[createConfigRepo] group-type set to "config-sync" at ${markerPath}`);
|
|
32526
32541
|
}
|
|
32527
|
-
if (!declaredIdentity) {
|
|
32528
|
-
await writeGroupDescriptor(primaryInstance, {
|
|
32529
|
-
schemaVersion: 2,
|
|
32530
|
-
kind: "config",
|
|
32531
|
-
id: CONFIG_GROUP_ID,
|
|
32532
|
-
instanceId: newGroupInstanceId(),
|
|
32533
|
-
features: CONFIG_GROUP_FEATURES
|
|
32534
|
-
});
|
|
32535
|
-
}
|
|
32536
32542
|
try {
|
|
32537
32543
|
await primaryInstance.unlink(`${META_DIR}/group-type`);
|
|
32538
32544
|
log9.log("[createConfigRepo] removed stale legacy .meta/group-type");
|