@artenx/dshb 0.1.31 → 0.1.33
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/lib/client.js +133 -22
- package/lib/client.js.map +1 -1
- package/lib/core/index.js +6 -1
- package/lib/core/index.js.map +1 -1
- package/lib/core/sync/coordinator.d.ts +2 -2
- package/lib/core/sync/coordinator.js +23 -6
- package/lib/core/sync/coordinator.js.map +1 -1
- package/lib/core/sync/internal-routes.d.ts +1 -1
- package/lib/core/sync/internal-routes.js +80 -4
- package/lib/core/sync/internal-routes.js.map +1 -1
- package/lib/core/sync/offline-archive.d.ts +1 -1
- package/lib/core/sync/offline-archive.js +1 -1
- package/lib/core/sync/offline-routes.js +1 -1
- package/lib/core/sync/protocol.d.ts +2 -2
- package/lib/core/sync/protocol.js +4 -1
- package/lib/core/sync/protocol.js.map +1 -1
- package/lib/core/sync/remote-helper.js +107 -76
- package/lib/core/sync/remote-helper.js.map +1 -1
- package/lib/core/sync/routes.d.ts +1 -1
- package/lib/core/sync/routes.js +61 -1
- package/lib/core/sync/routes.js.map +1 -1
- package/lib/core/sync/session-routes.d.ts +1 -1
- package/lib/core/sync/session-routes.js +1 -1
- package/lib/core/sync/session-sync.d.ts +2 -2
- package/lib/core/sync/session-sync.js +2 -2
- package/lib/core/sync/ssh-transport.d.ts +2 -2
- package/lib/core/sync/ssh-transport.js +267 -3
- package/lib/core/sync/ssh-transport.js.map +1 -1
- package/lib/{protocol-KaWZArY8.d.ts → protocol-DJ0zyVlB.d.ts} +5 -2
- package/lib/{session-sync-Zfo1Q-qT.d.ts → session-sync-BuOJvFxK.d.ts} +54 -2
- package/lib/{session-sync-BQt3HXkp.js → session-sync-CIqjuWkh.js} +455 -48
- package/lib/session-sync-CIqjuWkh.js.map +1 -0
- package/lib/ssh-transport-C7povM0s.d.ts +115 -0
- package/package.json +1 -1
- package/lib/session-sync-BQt3HXkp.js.map +0 -1
- package/lib/ssh-transport-Cfb_nwkY.d.ts +0 -65
|
@@ -1056,6 +1056,7 @@ type SyncSessionObject = {
|
|
|
1056
1056
|
bytes: number;
|
|
1057
1057
|
digest: string;
|
|
1058
1058
|
data: string;
|
|
1059
|
+
deferred?: boolean;
|
|
1059
1060
|
} | {
|
|
1060
1061
|
id: string;
|
|
1061
1062
|
kind: 'file';
|
|
@@ -1063,6 +1064,7 @@ type SyncSessionObject = {
|
|
|
1063
1064
|
bytes: number;
|
|
1064
1065
|
digest: string;
|
|
1065
1066
|
data: string;
|
|
1067
|
+
deferred?: boolean;
|
|
1066
1068
|
} | {
|
|
1067
1069
|
id: string;
|
|
1068
1070
|
kind: 'spill';
|
|
@@ -1071,6 +1073,7 @@ type SyncSessionObject = {
|
|
|
1071
1073
|
digest: string;
|
|
1072
1074
|
data: string;
|
|
1073
1075
|
unavailable?: boolean;
|
|
1076
|
+
deferred?: boolean;
|
|
1074
1077
|
};
|
|
1075
1078
|
interface SyncSessionEntry {
|
|
1076
1079
|
metadata: SyncRecordMetadata;
|
|
@@ -1138,6 +1141,35 @@ interface SyncSessionApplyOptions {
|
|
|
1138
1141
|
interface ExportObjectCacheEntry {
|
|
1139
1142
|
object: SyncSessionObject;
|
|
1140
1143
|
}
|
|
1144
|
+
/**
|
|
1145
|
+
* 带外对象收件箱:对端推送/拉取的大对象(附件/spill)先落盘到
|
|
1146
|
+
* `<home>/dshb/sync-objects/<sha256hex>`,apply 阶段按 digest 流式水合进
|
|
1147
|
+
* 本地存储并删除。落盘全程流式(内存 O(单帧)),对象总体积不受堆约束。
|
|
1148
|
+
* apply 失败时收件箱保留(journal 回放仍可水合),孤儿文件由 TTL 清扫回收。
|
|
1149
|
+
*/
|
|
1150
|
+
interface SyncObjectInboxWriter {
|
|
1151
|
+
write(chunk: Uint8Array): Promise<void>;
|
|
1152
|
+
commit(): Promise<void>;
|
|
1153
|
+
abort(): Promise<void>;
|
|
1154
|
+
}
|
|
1155
|
+
declare class SyncSessionObjectInbox {
|
|
1156
|
+
private readonly root;
|
|
1157
|
+
constructor(home?: string);
|
|
1158
|
+
get path(): string;
|
|
1159
|
+
private fileFor;
|
|
1160
|
+
/**
|
|
1161
|
+
* 打开一个收件箱写入器:逐帧流式写盘 + 增量摘要校验,内存 O(帧)。
|
|
1162
|
+
* commit() 校验字节数与 digest 后原子重命名;abort() 清理临时文件。
|
|
1163
|
+
*/
|
|
1164
|
+
writerFor(digest: string, expectedBytes: number): Promise<SyncObjectInboxWriter>;
|
|
1165
|
+
/** 便捷写入:把对象流整段写进收件箱(测试与小对象用)。 */
|
|
1166
|
+
write(digest: string, bytes: number, stream: AsyncIterable<Uint8Array>): Promise<void>;
|
|
1167
|
+
/** 打开收件箱文件的只读流(apply 水合用);调用方负责消费完毕。 */
|
|
1168
|
+
read(digest: string): Promise<AsyncIterable<Uint8Array>>;
|
|
1169
|
+
delete(digest: string): Promise<void>;
|
|
1170
|
+
/** TTL 清扫:删除超过 maxAgeMs 未修改的孤儿文件。 */
|
|
1171
|
+
sweep(maxAgeMs?: number): Promise<number>;
|
|
1172
|
+
}
|
|
1141
1173
|
declare class ExportObjectCache {
|
|
1142
1174
|
private readonly entries;
|
|
1143
1175
|
private bytes;
|
|
@@ -1240,6 +1272,7 @@ interface SpillStoreLike {
|
|
|
1240
1272
|
declare function sessionEventListDigest(events: readonly SessionEvent[]): string;
|
|
1241
1273
|
declare function estimateJsonBytes(value: unknown, limit: number): number | undefined;
|
|
1242
1274
|
declare function planSessionTransfers(direction: 'pull' | 'bidirectional', localEntries: readonly SyncSessionEntry[], remoteEntries: readonly SyncSessionEntry[]): SyncSessionTransferPlan;
|
|
1275
|
+
declare function validateObjectPayload(object: unknown): SyncSessionObject;
|
|
1243
1276
|
declare function validateSyncSessionBundle(value: unknown): SyncSessionBundle;
|
|
1244
1277
|
declare function makeSyncSessionBundle(instanceId: string, entries: SyncSessionEntry[], skipped?: Array<{
|
|
1245
1278
|
sessionId: string;
|
|
@@ -1268,11 +1301,14 @@ declare class SyncSessionService {
|
|
|
1268
1301
|
private readonly exportCacheStore;
|
|
1269
1302
|
private readonly manifestPayloadCache;
|
|
1270
1303
|
private manifestPayloadCacheBytes;
|
|
1304
|
+
/** 带外对象收件箱:对象流 RPC 的落盘暂存区,apply 水合后删除。 */
|
|
1305
|
+
readonly objectInbox: SyncSessionObjectInbox;
|
|
1271
1306
|
constructor(state: SyncStateStore, nodes: SyncNodeService, registry: NodeRegistry, bindings: WorkspaceBindingsStore, getWorkspaces: () => WorkspaceRegistryLike | undefined, getPersistence: () => SessionPersistenceLike | undefined, getAttachments: () => AttachmentStoreLike | undefined, getSpills: () => SpillStoreLike | undefined, instructions: SessionInstructionSnapshotStore, journal?: SyncSessionJournalStore, now?: () => number, home?: string);
|
|
1272
1307
|
exportBundle(): Promise<SyncSessionBundle>;
|
|
1273
1308
|
exportManifest(): Promise<SyncSessionManifest>;
|
|
1274
1309
|
exportEntries(keys: readonly string[], manifestDigest?: string, prefixes?: readonly SyncSessionEventPrefix[], options?: {
|
|
1275
1310
|
sharedObjects?: boolean;
|
|
1311
|
+
deferredObjects?: boolean;
|
|
1276
1312
|
}): Promise<SyncSessionBundle>;
|
|
1277
1313
|
private rememberManifestPayloads;
|
|
1278
1314
|
applyBundle(value: unknown, sourceName: string, peerId?: string, options?: SyncSessionApplyOptions): Promise<SyncSessionApplyResult>;
|
|
@@ -1307,8 +1343,24 @@ declare class SyncSessionService {
|
|
|
1307
1343
|
private readStableSession;
|
|
1308
1344
|
private exportObjects;
|
|
1309
1345
|
private requirePersistence;
|
|
1346
|
+
/**
|
|
1347
|
+
* 把 deferred 对象编码为带外帧流:每对象一行 JSON 头 + 原始字节。
|
|
1348
|
+
* 内容从本地存储流式读取(spill/文件流式;图片体积有限走缓冲),
|
|
1349
|
+
* 逐块校验字节数与摘要,内存 O(单块)。
|
|
1350
|
+
*/
|
|
1351
|
+
streamObjects(objects: readonly SyncSessionObject[]): AsyncGenerator<Uint8Array>;
|
|
1352
|
+
private openObjectContent;
|
|
1353
|
+
/** 单帧写入上限:超过即认为流失控。 */
|
|
1354
|
+
private static readonly OBJECT_STREAM_HEADER_MAX_BYTES;
|
|
1355
|
+
/**
|
|
1356
|
+
* 解析并落盘对端推送的对象帧流:逐帧写收件箱,边写边校验摘要,
|
|
1357
|
+
* 内存 O(单帧)。返回接收的对象数。
|
|
1358
|
+
*/
|
|
1359
|
+
ingestObjectStream(source: AsyncIterable<Uint8Array>): Promise<number>;
|
|
1360
|
+
/** apply 成功后删除已水合对象的收件箱文件;失败保留供 journal 回放。 */
|
|
1361
|
+
deleteInboxedObjects(digests: Iterable<string>): Promise<void>;
|
|
1310
1362
|
private serializeMutation;
|
|
1311
1363
|
}
|
|
1312
1364
|
//#endregion
|
|
1313
|
-
export {
|
|
1314
|
-
//# sourceMappingURL=session-sync-
|
|
1365
|
+
export { sessionEventListDigest as C, validateSyncSessionManifest as D, validateSyncSessionBundle as E, planSessionTransfers as S, validateObjectPayload as T, SyncSessionWorkspace as _, SyncSessionBundle as a, makeSyncSessionBundle as b, SyncSessionEventDelta as c, SyncSessionManifest as d, SyncSessionManifestEntry as f, SyncSessionTransferPlan as g, SyncSessionService as h, SyncSessionApplyResult as i, SyncSessionEventPrefix as l, SyncSessionObjectInbox as m, SyncObjectInboxWriter as n, SyncSessionEntry as o, SyncSessionObject as p, SyncSessionApplyOptions as r, SyncSessionError as s, ExportObjectCache as t, SyncSessionInstructionSnapshot as u, WorkspaceRegistryLike as v, syncSessionEntryKey as w, makeSyncSessionManifest as x, estimateJsonBytes as y };
|
|
1366
|
+
//# sourceMappingURL=session-sync-BuOJvFxK.d.ts.map
|