sliftutils 1.7.100 → 1.7.102
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 +4 -0
- package/package.json +1 -1
- package/storage/remoteStorage/blobStore.d.ts +4 -0
- package/storage/remoteStorage/blobStore.ts +7 -0
- package/storage/remoteStorage/createArchives.ts +1 -1
- package/storage/remoteStorage/dist/blobStore.ts.cache +7 -2
- package/storage/remoteStorage/dist/createArchives.ts.cache +2 -2
- package/storage/remoteStorage/dist/storageServerState.ts.cache +3 -2
- package/storage/remoteStorage/dist/storeSync.ts.cache +6 -2
- package/storage/remoteStorage/storageServerState.ts +2 -1
- package/storage/remoteStorage/storeSync.ts +4 -0
package/index.d.ts
CHANGED
|
@@ -3368,6 +3368,8 @@ declare module "sliftutils/storage/remoteStorage/blobStore" {
|
|
|
3368
3368
|
/** Asks the client whose request created this store what routing config it intended for our name. Only used when init finds NO configuration in our folder: a store only ever exists because a config names it, so the requester has that config - asking for it lazily is the same information as passing the config on every call, without the per-call kilobytes. */
|
|
3369
3369
|
requestRoutingConfig?: (() => Promise<RemoteConfig | undefined>) | undefined;
|
|
3370
3370
|
onWriteCounted?: ((kind: "original" | "flushed", bytes: number) => void) | undefined;
|
|
3371
|
+
/** A synchronization transfer: "sync get" is bytes pulled off a source (the backblaze download bill), "sync set" is bytes pushed to one. Injected because sync traffic never passes through the API controller, so nothing else can count it. */
|
|
3372
|
+
onSyncTransfer?: ((operation: "sync get" | "sync set", path: string, bytes: number) => void) | undefined;
|
|
3371
3373
|
resolveSourceUrl?: ((url: string) => IArchives) | undefined;
|
|
3372
3374
|
} | undefined);
|
|
3373
3375
|
/** This store's folder, unwrapped: the same bytes slot 0 serves, but reached without its write delay. Used for the two things that cannot go through a buffered source - reading our own routing config before we have any sources, and streaming a large upload that must not sit in memory. */
|
|
@@ -3554,6 +3556,8 @@ declare module "sliftutils/storage/remoteStorage/blobStore" {
|
|
|
3554
3556
|
setIndexDeleted(key: string, writeTime: number): boolean;
|
|
3555
3557
|
/** Forgets a key entirely, tombstone included. NOT a deletion: it says nothing happened to the file, only that we no longer know anything about it - for an entry whose holder turned out not to have it, and for a tombstone old enough that everyone has heard. */
|
|
3556
3558
|
purgeIndexEntry(key: string): void;
|
|
3559
|
+
/** Counts a synchronization transfer in the server's access statistics (see getStore's wiring): "sync get" for bytes pulled off a source, "sync set" for bytes pushed to one. */
|
|
3560
|
+
noteSyncTransfer(operation: "sync get" | "sync set", path: string, bytes: number): void;
|
|
3557
3561
|
/**
|
|
3558
3562
|
* Every write, however it is stamped, has to be one we are actually meant to hold - because the
|
|
3559
3563
|
* alternative is not a smaller problem, it is a silent one. A write that lands on a store that
|
package/package.json
CHANGED
|
@@ -62,6 +62,8 @@ export declare class BlobStore {
|
|
|
62
62
|
/** Asks the client whose request created this store what routing config it intended for our name. Only used when init finds NO configuration in our folder: a store only ever exists because a config names it, so the requester has that config - asking for it lazily is the same information as passing the config on every call, without the per-call kilobytes. */
|
|
63
63
|
requestRoutingConfig?: (() => Promise<RemoteConfig | undefined>) | undefined;
|
|
64
64
|
onWriteCounted?: ((kind: "original" | "flushed", bytes: number) => void) | undefined;
|
|
65
|
+
/** A synchronization transfer: "sync get" is bytes pulled off a source (the backblaze download bill), "sync set" is bytes pushed to one. Injected because sync traffic never passes through the API controller, so nothing else can count it. */
|
|
66
|
+
onSyncTransfer?: ((operation: "sync get" | "sync set", path: string, bytes: number) => void) | undefined;
|
|
65
67
|
resolveSourceUrl?: ((url: string) => IArchives) | undefined;
|
|
66
68
|
} | undefined);
|
|
67
69
|
/** This store's folder, unwrapped: the same bytes slot 0 serves, but reached without its write delay. Used for the two things that cannot go through a buffered source - reading our own routing config before we have any sources, and streaming a large upload that must not sit in memory. */
|
|
@@ -248,6 +250,8 @@ export declare class BlobStore {
|
|
|
248
250
|
setIndexDeleted(key: string, writeTime: number): boolean;
|
|
249
251
|
/** Forgets a key entirely, tombstone included. NOT a deletion: it says nothing happened to the file, only that we no longer know anything about it - for an entry whose holder turned out not to have it, and for a tombstone old enough that everyone has heard. */
|
|
250
252
|
purgeIndexEntry(key: string): void;
|
|
253
|
+
/** Counts a synchronization transfer in the server's access statistics (see getStore's wiring): "sync get" for bytes pulled off a source, "sync set" for bytes pushed to one. */
|
|
254
|
+
noteSyncTransfer(operation: "sync get" | "sync set", path: string, bytes: number): void;
|
|
251
255
|
/**
|
|
252
256
|
* Every write, however it is stamped, has to be one we are actually meant to hold - because the
|
|
253
257
|
* alternative is not a smaller problem, it is a silent one. A write that lands on a store that
|
|
@@ -106,6 +106,8 @@ export class BlobStore {
|
|
|
106
106
|
requestRoutingConfig?: () => Promise<RemoteConfig | undefined>;
|
|
107
107
|
// Every accepted write ("original") and every write that actually reached the sources ("flushed"). Fast writes coalesce, so the two counts differ.
|
|
108
108
|
onWriteCounted?: (kind: "original" | "flushed", bytes: number) => void;
|
|
109
|
+
/** A synchronization transfer: "sync get" is bytes pulled off a source (the backblaze download bill), "sync set" is bytes pushed to one. Injected because sync traffic never passes through the API controller, so nothing else can count it. */
|
|
110
|
+
onSyncTransfer?: (operation: "sync get" | "sync set", path: string, bytes: number) => void;
|
|
109
111
|
// Resolves a persisted source URL (see ArchivesSource.url) to a cached IArchives, so entries whose holder is no longer configured can still be read
|
|
110
112
|
resolveSourceUrl?: (url: string) => IArchives;
|
|
111
113
|
}
|
|
@@ -804,6 +806,11 @@ export class BlobStore {
|
|
|
804
806
|
this.index.purge(key);
|
|
805
807
|
}
|
|
806
808
|
|
|
809
|
+
/** Counts a synchronization transfer in the server's access statistics (see getStore's wiring): "sync get" for bytes pulled off a source, "sync set" for bytes pushed to one. */
|
|
810
|
+
public noteSyncTransfer(operation: "sync get" | "sync set", path: string, bytes: number): void {
|
|
811
|
+
this.config?.onSyncTransfer?.(operation, path, bytes);
|
|
812
|
+
}
|
|
813
|
+
|
|
807
814
|
// ── validation (from this store's own routing entries) ──
|
|
808
815
|
|
|
809
816
|
/**
|
|
@@ -313,7 +313,7 @@ export class ArchivesChain implements IArchives {
|
|
|
313
313
|
await this.state.refreshActiveConfig();
|
|
314
314
|
}
|
|
315
315
|
|
|
316
|
-
private async request<T>(config: { apiOnly?: boolean; write?: boolean; route?: number; noFallbacks?: boolean; fallbacks?: boolean; fast?: boolean; timeout?: SmartTimeout }, run: (archives: IArchives, sourceUrl: string) => Promise<T>): Promise<T> {
|
|
316
|
+
private async request<T>(config: { apiOnly?: boolean; write?: boolean; route?: number; noFallbacks?: boolean; fallbacks?: boolean; retries?: number; fast?: boolean; timeout?: SmartTimeout }, run: (archives: IArchives, sourceUrl: string) => Promise<T>): Promise<T> {
|
|
317
317
|
let state = await this.state.getState();
|
|
318
318
|
return await this.run(state, config, run);
|
|
319
319
|
}
|