sliftutils 1.7.90 → 1.7.91

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.
Files changed (34) hide show
  1. package/index.d.ts +34 -79
  2. package/misc/https/dist/cloudflareHelpers.ts.cache +2 -2
  3. package/misc/https/dist/dns.ts.cache +2 -2
  4. package/package.json +1 -1
  5. package/storage/BulkDatabase2/dist/BulkDatabaseBase.ts.cache +2 -2
  6. package/storage/BulkDatabase2/dist/BulkDatabaseFormat.ts.cache +2 -2
  7. package/storage/BulkDatabase2/dist/BulkDatabaseMerge.ts.cache +2 -2
  8. package/storage/BulkDatabase2/dist/LoadedIndex.ts.cache +2 -2
  9. package/storage/BulkDatabase2/dist/WriteOverlay.ts.cache +2 -2
  10. package/storage/BulkDatabase2/dist/blockCache.ts.cache +2 -2
  11. package/storage/BulkDatabase2/dist/mergeLock.ts.cache +2 -2
  12. package/storage/BulkDatabase2/dist/mergeMarkers.ts.cache +2 -2
  13. package/storage/BulkDatabase2/dist/streamLog.ts.cache +2 -2
  14. package/storage/BulkDatabase2/dist/syncClient.ts.cache +2 -2
  15. package/storage/remoteStorage/accessStats.d.ts +12 -0
  16. package/storage/remoteStorage/accessStats.ts +47 -0
  17. package/storage/remoteStorage/blobStore.d.ts +3 -1
  18. package/storage/remoteStorage/blobStore.ts +5 -0
  19. package/storage/remoteStorage/dist/accessStats.ts.cache +42 -3
  20. package/storage/remoteStorage/dist/blobStore.ts.cache +6 -3
  21. package/storage/remoteStorage/dist/intermediateManagement.ts.cache +56 -50
  22. package/storage/remoteStorage/dist/storageController.ts.cache +36 -29
  23. package/storage/remoteStorage/dist/storageServerState.ts.cache +110 -233
  24. package/storage/remoteStorage/dist/storeConfig.ts.cache +2 -2
  25. package/storage/remoteStorage/dist/storePlan.ts.cache +4 -56
  26. package/storage/remoteStorage/intermediateManagement.d.ts +2 -3
  27. package/storage/remoteStorage/intermediateManagement.ts +53 -46
  28. package/storage/remoteStorage/storageController.ts +22 -14
  29. package/storage/remoteStorage/storageServerState.d.ts +15 -55
  30. package/storage/remoteStorage/storageServerState.ts +106 -268
  31. package/storage/remoteStorage/storeConfig.d.ts +2 -0
  32. package/storage/remoteStorage/storeConfig.ts +2 -0
  33. package/storage/remoteStorage/storePlan.d.ts +0 -20
  34. package/storage/remoteStorage/storePlan.ts +1 -69
@@ -52,6 +52,8 @@ export class StoreConfig {
52
52
  export type StorePolicy = {
53
53
  validWindow: [number, number];
54
54
  route?: [number, number];
55
+ public?: boolean;
56
+ immutable?: boolean;
55
57
  fast?: boolean;
56
58
  writeDelay?: number;
57
59
  noFullSync?: boolean;
@@ -24,23 +24,3 @@ export type BoundaryHandover = {
24
24
  * Pure: config in, plan out. Nothing here reads a store, a clock, or the network.
25
25
  */
26
26
  export declare function previousWindowOwners(config: RemoteConfig, windowStart: number, selfIndexes: number[]): BoundaryHandover[];
27
- /** Our role in a bucket's routing config, summarized across ALL currently-valid self entries. Stored instead of a single representative HostedConfig, so nothing can accidentally use one entry's route or flags where the union is required - the standard config has the same URL twice: a routed write-shard entry plus an unrouted read-everything entry. */
28
- export type SelfSummary = {
29
- /** The union of the current entries' routes, with overlapping/adjacent ranges combined - which commonly collapses to a single full range, making matching trivial. */
30
- routes: [number, number][];
31
- public: boolean;
32
- immutable: boolean;
33
- noFullSync: boolean;
34
- readerDiskLimit?: number;
35
- };
36
- /** One store this server runs for a bucket: the name that IS the store, and the entries that name it. What it synchronizes with is NOT decided here - the store reads its own copy of the config and works that out itself (see BlobStore.applyRoutingConfig). */
37
- export type SelfStore = {
38
- name: string;
39
- entries: HostedConfig[];
40
- };
41
- /** Which stores this server runs for a bucket, by name. Nothing more: a store is found by name, and configures itself. */
42
- export declare function planSelfStores(account: string, bucketName: string, routing: RemoteConfig): {
43
- selfEntries: HostedConfig[];
44
- self: SelfSummary | undefined;
45
- stores: SelfStore[];
46
- };
@@ -1,9 +1,8 @@
1
- import { sort } from "socket-function/src/misc";
2
1
  import { RemoteConfig, HostedConfig, SourceConfig, FULL_ROUTE } from "../IArchives";
3
2
  import { parseHostedUrl, routeContains, routeIntersection } from "./remoteConfig";
4
3
  import { isOwnAddress } from "./serverConfig";
5
4
 
6
- // Turns a bucket's routing config into this server's store plan: which of the entries are us, what stores (one per route) we run, and which peers each store synchronizes from.
5
+ // Pure helpers over a bucket's routing config: which entries are this server, which entry applies at a moment, and who owned what before a window boundary. Config in, answer out - nothing here reads a store, a clock, or the network (except selectEntryAt being handed a time).
7
6
 
8
7
  /** Whether a config entry is THIS server's copy of this bucket - the same account and bucket, at an address this process answers on. */
9
8
  export function isSelfSource(source: SourceConfig, account: string, bucketName: string): boolean {
@@ -133,70 +132,3 @@ export function previousWindowOwners(config: RemoteConfig, windowStart: number,
133
132
  return [...byRoute.values()].filter(x => x.scanOwnDisk || x.remotes.size);
134
133
  }
135
134
 
136
- /** Our role in a bucket's routing config, summarized across ALL currently-valid self entries. Stored instead of a single representative HostedConfig, so nothing can accidentally use one entry's route or flags where the union is required - the standard config has the same URL twice: a routed write-shard entry plus an unrouted read-everything entry. */
137
- export type SelfSummary = {
138
- /** The union of the current entries' routes, with overlapping/adjacent ranges combined - which commonly collapses to a single full range, making matching trivial. */
139
- routes: [number, number][];
140
- public: boolean;
141
- immutable: boolean;
142
- noFullSync: boolean;
143
- readerDiskLimit?: number;
144
- };
145
-
146
- function mergeRoutes(routes: ([number, number] | undefined)[]): [number, number][] {
147
- let list = routes.map(x => x || FULL_ROUTE).map(x => [x[0], x[1]] as [number, number]);
148
- sort(list, x => x[0]);
149
- let merged: [number, number][] = [];
150
- for (let route of list) {
151
- let last = merged[merged.length - 1];
152
- if (last && route[0] <= last[1]) {
153
- last[1] = Math.max(last[1], route[1]);
154
- continue;
155
- }
156
- merged.push(route);
157
- }
158
- return merged;
159
- }
160
-
161
- function summarizeSelf(selfEntries: HostedConfig[], now: number): SelfSummary | undefined {
162
- let current = selfEntries.filter(x => x.validWindow[0] <= now && now < x.validWindow[1]);
163
- if (!current.length) {
164
- let nearest = selectEntryAt(selfEntries, now);
165
- current = nearest && [nearest] || [];
166
- }
167
- if (!current.length) {
168
- return undefined;
169
- }
170
- return {
171
- routes: mergeRoutes(current.map(x => x.route)),
172
- public: current.some(x => x.public),
173
- immutable: current.some(x => x.immutable),
174
- noFullSync: current.some(x => x.noFullSync),
175
- readerDiskLimit: current.find(x => x.readerDiskLimit !== undefined)?.readerDiskLimit,
176
- };
177
- }
178
-
179
- /** One store this server runs for a bucket: the name that IS the store, and the entries that name it. What it synchronizes with is NOT decided here - the store reads its own copy of the config and works that out itself (see BlobStore.applyRoutingConfig). */
180
- export type SelfStore = {
181
- name: string;
182
- entries: HostedConfig[];
183
- };
184
-
185
- /** Which stores this server runs for a bucket, by name. Nothing more: a store is found by name, and configures itself. */
186
- export function planSelfStores(account: string, bucketName: string, routing: RemoteConfig): { selfEntries: HostedConfig[]; self: SelfSummary | undefined; stores: SelfStore[] } {
187
- let selfIndexes = findSelfIndexes(routing, account, bucketName);
188
- let selfEntries = selfIndexes.map(i => routing.sources[i] as HostedConfig);
189
- let self = summarizeSelf(selfEntries, Date.now());
190
- // One store per NAME among ALL our entries - past and future windows included, so a name we no longer write to keeps serving its data and a name we are about to use exists ahead of its window
191
- let byName = new Map<string, HostedConfig[]>();
192
- for (let entry of selfEntries) {
193
- let entries = byName.get(entry.name);
194
- if (!entries) {
195
- entries = [];
196
- byName.set(entry.name, entries);
197
- }
198
- entries.push(entry);
199
- }
200
- // Not in the config at all: no name means no store here
201
- return { selfEntries, self, stores: [...byName].map(([name, entries]) => ({ name, entries })) };
202
- }