@liorandb/core 1.0.12 → 1.0.13
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/dist/index.d.ts +10 -23
- package/dist/index.js +790 -5
- package/package.json +1 -1
- package/src/LioranManager.ts +62 -114
- package/src/core/database.ts +22 -12
- package/src/ipc/client.ts +85 -0
- package/src/ipc/queue.ts +11 -126
- package/src/ipc/server.ts +84 -0
- package/src/ipc/socketPath.ts +10 -0
- package/src/worker/dbWorker.ts +0 -43
package/dist/index.d.ts
CHANGED
|
@@ -49,7 +49,11 @@ type TXCommit = {
|
|
|
49
49
|
tx: number;
|
|
50
50
|
commit: true;
|
|
51
51
|
};
|
|
52
|
-
type
|
|
52
|
+
type TXApplied = {
|
|
53
|
+
tx: number;
|
|
54
|
+
applied: true;
|
|
55
|
+
};
|
|
56
|
+
type WALEntry = TXOp | TXCommit | TXApplied;
|
|
53
57
|
declare class DBTransactionContext {
|
|
54
58
|
private db;
|
|
55
59
|
readonly txId: number;
|
|
@@ -78,40 +82,23 @@ declare class LioranDB {
|
|
|
78
82
|
interface LioranManagerOptions$1 {
|
|
79
83
|
rootPath?: string;
|
|
80
84
|
encryptionKey?: string | Buffer;
|
|
81
|
-
ipc?: boolean;
|
|
82
85
|
}
|
|
83
86
|
declare class LioranManager {
|
|
84
87
|
rootPath: string;
|
|
85
88
|
openDBs: Map<string, LioranDB>;
|
|
86
89
|
private closed;
|
|
87
|
-
private
|
|
90
|
+
private mode;
|
|
91
|
+
private lockFd?;
|
|
92
|
+
private ipcServer?;
|
|
88
93
|
constructor(options?: LioranManagerOptions$1);
|
|
94
|
+
private isProcessAlive;
|
|
95
|
+
private tryAcquireLock;
|
|
89
96
|
db(name: string): Promise<LioranDB>;
|
|
90
|
-
createDatabase(name: string): Promise<LioranDB>;
|
|
91
97
|
openDatabase(name: string): Promise<LioranDB>;
|
|
92
|
-
closeDatabase(name: string): Promise<void>;
|
|
93
|
-
/**
|
|
94
|
-
* Gracefully shuts down everything.
|
|
95
|
-
* - Closes all databases
|
|
96
|
-
* - Terminates IPC worker if running
|
|
97
|
-
*/
|
|
98
98
|
closeAll(): Promise<void>;
|
|
99
|
-
/**
|
|
100
|
-
* Alias for closeAll() (clean public API)
|
|
101
|
-
*/
|
|
102
99
|
close(): Promise<void>;
|
|
103
100
|
private _registerShutdownHooks;
|
|
104
101
|
private _assertOpen;
|
|
105
|
-
renameDatabase(oldName: string, newName: string): Promise<boolean>;
|
|
106
|
-
deleteDatabase(name: string): Promise<boolean>;
|
|
107
|
-
dropDatabase(name: string): Promise<boolean>;
|
|
108
|
-
listDatabases(): Promise<string[]>;
|
|
109
|
-
getStats(): {
|
|
110
|
-
rootPath: string;
|
|
111
|
-
openDatabases: string[];
|
|
112
|
-
ipc: boolean;
|
|
113
|
-
closed: boolean;
|
|
114
|
-
};
|
|
115
102
|
}
|
|
116
103
|
|
|
117
104
|
declare function getBaseDBFolder(): string;
|