sliftutils 1.7.29 → 1.7.32
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/index.d.ts +3 -1
- package/package.json +1 -1
- package/storage/remoteStorage/dist/createArchives.ts.cache +11 -2
- package/storage/remoteStorage/dist/storageClientController.ts.cache +34 -0
- package/storage/remoteStorage/dist/storageController.ts.cache +32 -4
- package/storage/remoteStorage/dist/storageServerState.ts.cache +7 -11
- package/storage/remoteStorage/storageController.d.ts +3 -0
- package/storage/remoteStorage/storageController.ts +5 -5
- package/storage/remoteStorage/storageServerState.d.ts +0 -1
- package/storage/remoteStorage/storageServerState.ts +4 -14
|
@@ -14,7 +14,7 @@ import { getTakeoverStamp } from "./deployTakeover";
|
|
|
14
14
|
import {
|
|
15
15
|
getStorageServerConfig, getTrust, getRequests, getLoadedBucket, writeBucketFile,
|
|
16
16
|
deleteBucketFile, assertWritesAllowed, assertMutable, LoadedBucket,
|
|
17
|
-
getBucketConfig, listAccountBuckets, ServerBucketInfo,
|
|
17
|
+
getBucketConfig, listAccountBuckets, ServerBucketInfo,
|
|
18
18
|
} from "./storageServerState";
|
|
19
19
|
import { StorageClientController } from "./storageClientController";
|
|
20
20
|
|
|
@@ -119,9 +119,9 @@ function trackCaller(): void {
|
|
|
119
119
|
});
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
/** Called by storageServerState the moment any routing config is applied - clients must never
|
|
123
|
+
* have to wait for a poll to learn the topology changed. */
|
|
124
|
+
export function broadcastRoutingChanged(): void {
|
|
125
125
|
console.log(`Broadcasting routing config change to ${connectedClients.size} connected clients`);
|
|
126
126
|
for (let nodeId of [...connectedClients]) {
|
|
127
127
|
void StorageClientController.nodes[nodeId].routingConfigChanged().catch(() => {
|
|
@@ -129,7 +129,7 @@ setRoutingChangedBroadcaster(() => {
|
|
|
129
129
|
// cleans the registry, nothing to do here
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
|
-
}
|
|
132
|
+
}
|
|
133
133
|
|
|
134
134
|
function getCallerMachineId(): string {
|
|
135
135
|
let caller = SocketFunction.getCaller();
|
|
@@ -37,7 +37,6 @@ export type LoadedBucket = {
|
|
|
37
37
|
};
|
|
38
38
|
export declare function addExtraListenPort(port: number): void;
|
|
39
39
|
export declare function getLoadedBucket(account: string, bucketName: string): Promise<LoadedBucket | undefined>;
|
|
40
|
-
export declare function setRoutingChangedBroadcaster(broadcaster: () => void): void;
|
|
41
40
|
export declare function assertMutable(bucket: LoadedBucket, filePath: string, writeTime: number): Promise<void>;
|
|
42
41
|
export declare function writeBucketFile(account: string, bucketName: string, filePath: string, data: Buffer, config?: {
|
|
43
42
|
lastModified?: number;
|
|
@@ -14,6 +14,7 @@ import { ROUTING_FILE, parseRoutingData, parseHostedUrl, buildFileUrl, getConfig
|
|
|
14
14
|
import { applyDeployRemap, getTakeoverAltPort, getOwnWindowEndClip, onTakeoverEvent } from "./deployTakeover";
|
|
15
15
|
import { createApiArchives } from "./createArchives";
|
|
16
16
|
import type { IStorage } from "../IStorage";
|
|
17
|
+
import { broadcastRoutingChanged } from "./storageController";
|
|
17
18
|
import type { AccessRequest, TrustRecord } from "./storageController";
|
|
18
19
|
import { getArg } from "./cliArgs";
|
|
19
20
|
|
|
@@ -563,17 +564,6 @@ export function getLoadedBucket(account: string, bucketName: string): Promise<Lo
|
|
|
563
564
|
return loaded;
|
|
564
565
|
}
|
|
565
566
|
|
|
566
|
-
// Called whenever any bucket's routing config is applied (created, updated in place, or rebuilt).
|
|
567
|
-
// storageController wires this to its connected-client broadcast, so every client is pushed the
|
|
568
|
-
// change immediately - never waiting for a poll. (A callback, not an import - storageController
|
|
569
|
-
// imports us, so importing it back would be a cycle.)
|
|
570
|
-
let routingChangedBroadcaster: (() => void) | undefined;
|
|
571
|
-
export function setRoutingChangedBroadcaster(broadcaster: () => void): void {
|
|
572
|
-
routingChangedBroadcaster = broadcaster;
|
|
573
|
-
}
|
|
574
|
-
function notifyRoutingChanged(): void {
|
|
575
|
-
routingChangedBroadcaster?.();
|
|
576
|
-
}
|
|
577
567
|
|
|
578
568
|
// Routing reloads are serialized per bucket, so concurrent writes/syncs can't rebuild the same
|
|
579
569
|
// store twice in parallel
|
|
@@ -622,7 +612,7 @@ async function checkRoutingChanged(account: string, bucketName: string, config?:
|
|
|
622
612
|
buckets.set(key, Promise.resolve(updated));
|
|
623
613
|
scheduleWindowBoundaryRebuild(updated);
|
|
624
614
|
scheduleBoundaryScans(updated);
|
|
625
|
-
|
|
615
|
+
broadcastRoutingChanged();
|
|
626
616
|
return;
|
|
627
617
|
}
|
|
628
618
|
console.log(`Rebuilding the store for bucket ${key} (${reason})`);
|
|
@@ -630,7 +620,7 @@ async function checkRoutingChanged(account: string, bucketName: string, config?:
|
|
|
630
620
|
await loaded.store.dispose();
|
|
631
621
|
}
|
|
632
622
|
buckets.set(key, Promise.resolve(buildBucket(account, bucketName, routing, plan)));
|
|
633
|
-
|
|
623
|
+
broadcastRoutingChanged();
|
|
634
624
|
}
|
|
635
625
|
|
|
636
626
|
// Per-write options are evaluated at the WRITE's time (and the key's route), not the current
|
|
@@ -671,7 +661,7 @@ async function writeRoutingConfig(account: string, bucketName: string, data: Buf
|
|
|
671
661
|
if (!loaded) {
|
|
672
662
|
await new ArchivesDisk(getBucketFolder(account, bucketName)).set(ROUTING_FILE, data, { lastModified: config?.lastModified });
|
|
673
663
|
buckets.set(key, Promise.resolve(buildBucket(account, bucketName, incoming)));
|
|
674
|
-
|
|
664
|
+
broadcastRoutingChanged();
|
|
675
665
|
console.log(`Created bucket ${key}`);
|
|
676
666
|
return;
|
|
677
667
|
}
|