harperdb 4.6.7 → 4.6.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "harperdb",
3
- "version": "4.6.7",
3
+ "version": "4.6.9",
4
4
  "description": "HarperDB is a distributed database, caching service, streaming broker, and application development platform focused on performance and ease of use.",
5
5
  "keywords": [
6
6
  "database",
@@ -11,6 +11,22 @@
11
11
  * - Note that for compressed data, the size is the uncompressed size, and the compressed size in the file
12
12
  */
13
13
  import type { LMDBStore } from 'lmdb';
14
+ type StorageInfo = {
15
+ storageIndex: number;
16
+ fileId: string;
17
+ store?: any;
18
+ filePath?: string;
19
+ recordId?: number;
20
+ contentBuffer?: Buffer;
21
+ source?: NodeJS.ReadableStream;
22
+ storageBuffer?: Buffer;
23
+ compress?: boolean;
24
+ flush?: boolean;
25
+ start?: number;
26
+ end?: number;
27
+ saving?: Promise<void>;
28
+ asString?: string;
29
+ };
14
30
  export declare const Blob: {
15
31
  new (blobParts?: BlobPart[], options?: BlobPropertyBag): Blob;
16
32
  prototype: Blob;
@@ -53,6 +69,7 @@ declare class FileBackedBlob extends InstanceOfBlobWithNoConstructor {
53
69
  type: string;
54
70
  size: number;
55
71
  finished: Promise<void>;
72
+ saveBeforeCommit: boolean;
56
73
  constructor(options?: BlobCreationOptions);
57
74
  on(type: string, callback: (error: Error) => void): void;
58
75
  toJSON(): string | {
@@ -63,7 +80,7 @@ declare class FileBackedBlob extends InstanceOfBlobWithNoConstructor {
63
80
  arrayBuffer(): Promise<ArrayBuffer>;
64
81
  stream(): ReadableStream;
65
82
  slice(start: number, end: number, type?: string): Blob;
66
- save(targetTable: any): Promise<void>;
83
+ save(): Promise<void>;
67
84
  }
68
85
  /**
69
86
  * Delete the file for the blob
@@ -76,8 +93,11 @@ export type BlobCreationOptions = {
76
93
  compress?: boolean;
77
94
  flush?: boolean;
78
95
  size?: number;
96
+ saveBeforeCommit?: boolean;
79
97
  };
98
+ export declare function saveBlob(blob: FileBackedBlob): StorageInfo;
80
99
  export declare function getFileId(blob: Blob): string;
100
+ export declare function isSaving(blob: Blob): string;
81
101
  export declare function getFilePathForBlob(blob: FileBackedBlob): string;
82
102
  export declare const databasePaths: Map<LMDBStore, string[]>;
83
103
  export declare function getRootBlobPathsForDB(store: LMDBStore): string[];
@@ -100,7 +120,7 @@ export declare function encodeBlobsAsBuffers<T>(callback: () => T): Promise<T>;
100
120
  * Decode blobs, creating local storage to hold the blogs and returning a promise that resolves when all the blobs are written to disk
101
121
  * @param callback
102
122
  */
103
- export declare function decodeBlobsWithWrites(callback: () => void, blobCallback?: (blob: Blob) => void): Promise<void> | Promise<void[]>;
123
+ export declare function decodeBlobsWithWrites(callback: () => void, store?: LMDBStore, blobCallback?: (blob: Blob) => void): Promise<void> | Promise<void[]>;
104
124
  /**
105
125
  * Decode with a callback for when blobs are encountered, allowing for detecting of blobs
106
126
  * @param callback
@@ -110,7 +130,7 @@ export declare function decodeWithBlobCallback(callback: () => void, blobCallbac
110
130
  * Decode with a callback for when blobs are encountered, allowing for detecting of blobs
111
131
  * @param callback
112
132
  */
113
- export declare function decodeFromDatabase(callback: () => void, rootStore: LMDBStore): void;
133
+ export declare function decodeFromDatabase<T>(callback: () => T, rootStore: LMDBStore): T;
114
134
  /**
115
135
  * Delete blobs in an object, recursively searching for blobs
116
136
  * @param object
@@ -122,4 +142,10 @@ export declare function deleteBlobsInObject(object: any): void;
122
142
  * @param callback
123
143
  */
124
144
  export declare function findBlobsInObject(object: any, callback: (blob: Blob) => void): void;
145
+ /**
146
+ * Do a shallow/fast search for blobs on the record and start saving them if they are supposed to be saved before a commit
147
+ * @param record
148
+ * @param store
149
+ */
150
+ export declare function startPreCommitBlobsForRecord(record: any, store: LMDBStore): any;
125
151
  export {};