@yydb/light-db 0.0.0
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/api/LightDB.d.ts +194 -0
- package/dist/api/LightDB.d.ts.map +1 -0
- package/dist/api/LightDB.js +299 -0
- package/dist/api/LightDB.js.map +1 -0
- package/dist/api/Transaction.d.ts +100 -0
- package/dist/api/Transaction.d.ts.map +1 -0
- package/dist/api/Transaction.js +263 -0
- package/dist/api/Transaction.js.map +1 -0
- package/dist/api/index.d.ts +24 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +54 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/types.d.ts +154 -0
- package/dist/api/types.d.ts.map +1 -0
- package/dist/api/types.js +7 -0
- package/dist/api/types.js.map +1 -0
- package/dist/collection/Collection.d.ts +235 -0
- package/dist/collection/Collection.d.ts.map +1 -0
- package/dist/collection/Collection.js +671 -0
- package/dist/collection/Collection.js.map +1 -0
- package/dist/collection/QueryBuilder.d.ts +225 -0
- package/dist/collection/QueryBuilder.d.ts.map +1 -0
- package/dist/collection/QueryBuilder.js +475 -0
- package/dist/collection/QueryBuilder.js.map +1 -0
- package/dist/collection/QueryParser.d.ts +117 -0
- package/dist/collection/QueryParser.d.ts.map +1 -0
- package/dist/collection/QueryParser.js +438 -0
- package/dist/collection/QueryParser.js.map +1 -0
- package/dist/collection/index.d.ts +42 -0
- package/dist/collection/index.d.ts.map +1 -0
- package/dist/collection/index.js +41 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/types.d.ts +365 -0
- package/dist/collection/types.d.ts.map +1 -0
- package/dist/collection/types.js +7 -0
- package/dist/collection/types.js.map +1 -0
- package/dist/constants/index.d.ts +51 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/index.js +68 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/errors/index.d.ts +69 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +132 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/index.d.ts +220 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +729 -0
- package/dist/index.js.map +1 -0
- package/dist/indexes/BPlusTree.d.ts +181 -0
- package/dist/indexes/BPlusTree.d.ts.map +1 -0
- package/dist/indexes/BPlusTree.js +528 -0
- package/dist/indexes/BPlusTree.js.map +1 -0
- package/dist/indexes/IndexManager.d.ts +236 -0
- package/dist/indexes/IndexManager.d.ts.map +1 -0
- package/dist/indexes/IndexManager.js +502 -0
- package/dist/indexes/IndexManager.js.map +1 -0
- package/dist/indexes/PrimaryIndex.d.ts +240 -0
- package/dist/indexes/PrimaryIndex.d.ts.map +1 -0
- package/dist/indexes/PrimaryIndex.js +354 -0
- package/dist/indexes/PrimaryIndex.js.map +1 -0
- package/dist/indexes/SecondaryIndex.d.ts +204 -0
- package/dist/indexes/SecondaryIndex.d.ts.map +1 -0
- package/dist/indexes/SecondaryIndex.js +480 -0
- package/dist/indexes/SecondaryIndex.js.map +1 -0
- package/dist/indexes/errors.d.ts +66 -0
- package/dist/indexes/errors.d.ts.map +1 -0
- package/dist/indexes/errors.js +117 -0
- package/dist/indexes/errors.js.map +1 -0
- package/dist/indexes/index.d.ts +52 -0
- package/dist/indexes/index.d.ts.map +1 -0
- package/dist/indexes/index.js +131 -0
- package/dist/indexes/index.js.map +1 -0
- package/dist/indexes/types.d.ts +246 -0
- package/dist/indexes/types.d.ts.map +1 -0
- package/dist/indexes/types.js +30 -0
- package/dist/indexes/types.js.map +1 -0
- package/dist/performance/BatchWALWriter.d.ts +185 -0
- package/dist/performance/BatchWALWriter.d.ts.map +1 -0
- package/dist/performance/BatchWALWriter.js +490 -0
- package/dist/performance/BatchWALWriter.js.map +1 -0
- package/dist/performance/ColumnarStorage.d.ts +138 -0
- package/dist/performance/ColumnarStorage.d.ts.map +1 -0
- package/dist/performance/ColumnarStorage.js +875 -0
- package/dist/performance/ColumnarStorage.js.map +1 -0
- package/dist/performance/LazyQuery.d.ts +307 -0
- package/dist/performance/LazyQuery.d.ts.map +1 -0
- package/dist/performance/LazyQuery.js +588 -0
- package/dist/performance/LazyQuery.js.map +1 -0
- package/dist/performance/OptimizedBuffer.d.ts +375 -0
- package/dist/performance/OptimizedBuffer.d.ts.map +1 -0
- package/dist/performance/OptimizedBuffer.js +730 -0
- package/dist/performance/OptimizedBuffer.js.map +1 -0
- package/dist/performance/RWLock.d.ts +260 -0
- package/dist/performance/RWLock.d.ts.map +1 -0
- package/dist/performance/RWLock.js +570 -0
- package/dist/performance/RWLock.js.map +1 -0
- package/dist/performance/index.d.ts +41 -0
- package/dist/performance/index.d.ts.map +1 -0
- package/dist/performance/index.js +162 -0
- package/dist/performance/index.js.map +1 -0
- package/dist/performance/types.d.ts +247 -0
- package/dist/performance/types.d.ts.map +1 -0
- package/dist/performance/types.js +26 -0
- package/dist/performance/types.js.map +1 -0
- package/dist/storage/Checkpoint.d.ts +128 -0
- package/dist/storage/Checkpoint.d.ts.map +1 -0
- package/dist/storage/Checkpoint.js +251 -0
- package/dist/storage/Checkpoint.js.map +1 -0
- package/dist/storage/LightFile.d.ts +227 -0
- package/dist/storage/LightFile.d.ts.map +1 -0
- package/dist/storage/LightFile.js +526 -0
- package/dist/storage/LightFile.js.map +1 -0
- package/dist/storage/Recovery.d.ts +172 -0
- package/dist/storage/Recovery.d.ts.map +1 -0
- package/dist/storage/Recovery.js +399 -0
- package/dist/storage/Recovery.js.map +1 -0
- package/dist/storage/SHMFile.d.ts +243 -0
- package/dist/storage/SHMFile.d.ts.map +1 -0
- package/dist/storage/SHMFile.js +436 -0
- package/dist/storage/SHMFile.js.map +1 -0
- package/dist/storage/StorageEngine.d.ts +146 -0
- package/dist/storage/StorageEngine.d.ts.map +1 -0
- package/dist/storage/StorageEngine.js +353 -0
- package/dist/storage/StorageEngine.js.map +1 -0
- package/dist/storage/WALFile.d.ts +248 -0
- package/dist/storage/WALFile.d.ts.map +1 -0
- package/dist/storage/WALFile.js +597 -0
- package/dist/storage/WALFile.js.map +1 -0
- package/dist/storage/index.d.ts +10 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +153 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/types/index.d.ts +220 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +7 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/binary.d.ts +271 -0
- package/dist/utils/binary.d.ts.map +1 -0
- package/dist/utils/binary.js +454 -0
- package/dist/utils/binary.js.map +1 -0
- package/dist/utils/file.d.ts +166 -0
- package/dist/utils/file.d.ts.map +1 -0
- package/dist/utils/file.js +346 -0
- package/dist/utils/file.js.map +1 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +39 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +37 -0
- package/readme.md +124 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* LightDB 存储引擎错误定义
|
|
4
|
+
* 提供详细的错误类型和错误消息
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ConfigurationError =
|
|
8
|
+
exports.SerializationError =
|
|
9
|
+
exports.PageError =
|
|
10
|
+
exports.CheckpointError =
|
|
11
|
+
exports.RecoveryError =
|
|
12
|
+
exports.WalError =
|
|
13
|
+
exports.ChecksumError =
|
|
14
|
+
exports.FileFormatError =
|
|
15
|
+
exports.FileOperationError =
|
|
16
|
+
exports.StorageError =
|
|
17
|
+
void 0;
|
|
18
|
+
/**
|
|
19
|
+
* 存储引擎错误基类
|
|
20
|
+
*/
|
|
21
|
+
class StorageError extends Error {
|
|
22
|
+
constructor(message, code, context) {
|
|
23
|
+
super(message);
|
|
24
|
+
this.name = "StorageError";
|
|
25
|
+
this.code = code;
|
|
26
|
+
if (context !== undefined) {
|
|
27
|
+
this.context = context;
|
|
28
|
+
}
|
|
29
|
+
Object.setPrototypeOf(this, StorageError.prototype);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.StorageError = StorageError;
|
|
33
|
+
/**
|
|
34
|
+
* 文件操作错误
|
|
35
|
+
*/
|
|
36
|
+
class FileOperationError extends StorageError {
|
|
37
|
+
constructor(message, filePath, operation) {
|
|
38
|
+
super(message, "FILE_OPERATION_ERROR", { filePath, operation });
|
|
39
|
+
this.name = "FileOperationError";
|
|
40
|
+
Object.setPrototypeOf(this, FileOperationError.prototype);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.FileOperationError = FileOperationError;
|
|
44
|
+
/**
|
|
45
|
+
* 文件格式错误
|
|
46
|
+
*/
|
|
47
|
+
class FileFormatError extends StorageError {
|
|
48
|
+
constructor(message, filePath, expected, actual) {
|
|
49
|
+
super(message, "FILE_FORMAT_ERROR", { filePath, expected, actual });
|
|
50
|
+
this.name = "FileFormatError";
|
|
51
|
+
Object.setPrototypeOf(this, FileFormatError.prototype);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.FileFormatError = FileFormatError;
|
|
55
|
+
/**
|
|
56
|
+
* 校验和错误
|
|
57
|
+
*/
|
|
58
|
+
class ChecksumError extends StorageError {
|
|
59
|
+
constructor(message, expected, actual, position) {
|
|
60
|
+
super(message, "CHECKSUM_ERROR", { expected, actual, position });
|
|
61
|
+
this.name = "ChecksumError";
|
|
62
|
+
Object.setPrototypeOf(this, ChecksumError.prototype);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.ChecksumError = ChecksumError;
|
|
66
|
+
/**
|
|
67
|
+
* WAL 错误
|
|
68
|
+
*/
|
|
69
|
+
class WalError extends StorageError {
|
|
70
|
+
constructor(message, lsn, offset) {
|
|
71
|
+
super(message, "WAL_ERROR", { lsn: lsn?.toString(), offset });
|
|
72
|
+
this.name = "WALError";
|
|
73
|
+
Object.setPrototypeOf(this, WalError.prototype);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.WalError = WalError;
|
|
77
|
+
/**
|
|
78
|
+
* 恢复错误
|
|
79
|
+
*/
|
|
80
|
+
class RecoveryError extends StorageError {
|
|
81
|
+
constructor(message, phase, details) {
|
|
82
|
+
super(message, "RECOVERY_ERROR", { phase, details });
|
|
83
|
+
this.name = "RecoveryError";
|
|
84
|
+
Object.setPrototypeOf(this, RecoveryError.prototype);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
exports.RecoveryError = RecoveryError;
|
|
88
|
+
/**
|
|
89
|
+
* 检查点错误
|
|
90
|
+
*/
|
|
91
|
+
class CheckpointError extends StorageError {
|
|
92
|
+
constructor(message, lsn) {
|
|
93
|
+
super(message, "CHECKPOINT_ERROR", { lsn: lsn?.toString() });
|
|
94
|
+
this.name = "CheckpointError";
|
|
95
|
+
Object.setPrototypeOf(this, CheckpointError.prototype);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
exports.CheckpointError = CheckpointError;
|
|
99
|
+
/**
|
|
100
|
+
* 页面错误
|
|
101
|
+
*/
|
|
102
|
+
class PageError extends StorageError {
|
|
103
|
+
constructor(message, pageId, details) {
|
|
104
|
+
super(message, "PAGE_ERROR", { pageId, details });
|
|
105
|
+
this.name = "PageError";
|
|
106
|
+
Object.setPrototypeOf(this, PageError.prototype);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
exports.PageError = PageError;
|
|
110
|
+
/**
|
|
111
|
+
* 序列化错误
|
|
112
|
+
*/
|
|
113
|
+
class SerializationError extends StorageError {
|
|
114
|
+
constructor(message, data) {
|
|
115
|
+
super(message, "SERIALIZATION_ERROR", { data });
|
|
116
|
+
this.name = "SerializationError";
|
|
117
|
+
Object.setPrototypeOf(this, SerializationError.prototype);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
exports.SerializationError = SerializationError;
|
|
121
|
+
/**
|
|
122
|
+
* 配置错误
|
|
123
|
+
*/
|
|
124
|
+
class ConfigurationError extends StorageError {
|
|
125
|
+
constructor(message, option, value) {
|
|
126
|
+
super(message, "CONFIGURATION_ERROR", { option, value });
|
|
127
|
+
this.name = "ConfigurationError";
|
|
128
|
+
Object.setPrototypeOf(this, ConfigurationError.prototype);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
exports.ConfigurationError = ConfigurationError;
|
|
132
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;GAEG;AACH,MAAa,YAAa,SAAQ,KAAK;IAOnC,YAAY,OAAe,EAAE,IAAY,EAAE,OAAiC;QACxE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YACxB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAC3B,CAAC;QACD,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IACxD,CAAC;CACJ;AAhBD,oCAgBC;AAED;;GAEG;AACH,MAAa,kBAAmB,SAAQ,YAAY;IAChD,YAAY,OAAe,EAAE,QAAgB,EAAE,SAAiB;QAC5D,KAAK,CAAC,OAAO,EAAE,sBAAsB,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC;QAChE,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAC9D,CAAC;CACJ;AAND,gDAMC;AAED;;GAEG;AACH,MAAa,eAAgB,SAAQ,YAAY;IAC7C,YAAY,OAAe,EAAE,QAAgB,EAAE,QAAiB,EAAE,MAAgB;QAC9E,KAAK,CAAC,OAAO,EAAE,mBAAmB,EAAE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,CAAC;CACJ;AAND,gDAMC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LightDB 存储引擎
|
|
3
|
+
*
|
|
4
|
+
* 这是一个高性能的 TypeScript 数据库存储层实现。
|
|
5
|
+
* 提供完整的 WAL(预写日志)、检查点、崩溃恢复和索引管理功能。
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
export {
|
|
10
|
+
LIGHT_MAGIC,
|
|
11
|
+
LIGHT_MAGIC_STRING,
|
|
12
|
+
LIGHT_VERSION,
|
|
13
|
+
DEFAULT_PAGE_SIZE,
|
|
14
|
+
DEFAULT_WAL_THRESHOLD,
|
|
15
|
+
HEADER_SIZE,
|
|
16
|
+
WAL_RECORD_HEADER_SIZE,
|
|
17
|
+
SHM_HEADER_SIZE,
|
|
18
|
+
SHM_ENTRY_SIZE,
|
|
19
|
+
SHM_DEFAULT_CAPACITY,
|
|
20
|
+
PAGE_HEADER_SIZE,
|
|
21
|
+
OperationType,
|
|
22
|
+
FILE_EXTENSIONS,
|
|
23
|
+
} from "./constants";
|
|
24
|
+
export {
|
|
25
|
+
LightHeader,
|
|
26
|
+
Record,
|
|
27
|
+
Page,
|
|
28
|
+
WalRecord,
|
|
29
|
+
ShmHeader,
|
|
30
|
+
ShmEntry,
|
|
31
|
+
StorageEngineOptions,
|
|
32
|
+
FsyncStrategy,
|
|
33
|
+
CheckpointResult,
|
|
34
|
+
RecoveryResult,
|
|
35
|
+
StorageStats,
|
|
36
|
+
WriteResult,
|
|
37
|
+
BatchWriteResult,
|
|
38
|
+
HashIteratorResult,
|
|
39
|
+
FileHandle,
|
|
40
|
+
PageMap,
|
|
41
|
+
RecordMap,
|
|
42
|
+
WalRecordIterator,
|
|
43
|
+
} from "./types";
|
|
44
|
+
export {
|
|
45
|
+
StorageError,
|
|
46
|
+
FileOperationError,
|
|
47
|
+
FileFormatError,
|
|
48
|
+
ChecksumError,
|
|
49
|
+
WalError,
|
|
50
|
+
RecoveryError,
|
|
51
|
+
CheckpointError,
|
|
52
|
+
PageError,
|
|
53
|
+
SerializationError,
|
|
54
|
+
ConfigurationError,
|
|
55
|
+
} from "./errors";
|
|
56
|
+
export { BinaryUtils, BufferWriter, BufferReader, FileUtils, FileHandleWrapper } from "./utils";
|
|
57
|
+
export { LightFileSerializer, LightFileManager, PageManager } from "./storage";
|
|
58
|
+
export { WalRecordSerializer, WalWriter, WalReader, WalManager } from "./storage";
|
|
59
|
+
export { ShmSerializer, ShmHashTable, ShmFileManager, WalIndexManager } from "./storage";
|
|
60
|
+
export { CheckpointManager, AutoCheckpointScheduler, IncrementalCheckpointManager, CheckpointOptions } from "./storage";
|
|
61
|
+
export { RecoveryManager, FastRecoveryManager, RecoveryValidator, RecoveryPhase, RecoveryContext } from "./storage";
|
|
62
|
+
export { StorageEngine, createStorageEngine } from "./storage";
|
|
63
|
+
import type { StorageEngineOptions } from "./types";
|
|
64
|
+
import { StorageEngine as StorageEngineClass } from "./storage";
|
|
65
|
+
/**
|
|
66
|
+
* 打开存储引擎
|
|
67
|
+
*
|
|
68
|
+
* @param basePath - 数据库文件存储路径
|
|
69
|
+
* @param dbName - 数据库名称
|
|
70
|
+
* @param options - 配置选项
|
|
71
|
+
* @returns 初始化完成的存储引擎实例
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```typescript
|
|
75
|
+
* import { openStorageEngine } from '@yydb/light-db';
|
|
76
|
+
*
|
|
77
|
+
* const engine = await openStorageEngine('./data', 'mydb', {
|
|
78
|
+
* pageSize: 4096,
|
|
79
|
+
* walThreshold: 16 * 1024 * 1024,
|
|
80
|
+
* autoCheckpoint: true
|
|
81
|
+
* });
|
|
82
|
+
*
|
|
83
|
+
* // 插入数据
|
|
84
|
+
* await engine.insert('key1', Buffer.from('value1'));
|
|
85
|
+
*
|
|
86
|
+
* // 读取数据
|
|
87
|
+
* const value = await engine.get('key1');
|
|
88
|
+
*
|
|
89
|
+
* // 关闭引擎
|
|
90
|
+
* await engine.close();
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export declare function openStorageEngine(basePath: string, dbName: string, options?: StorageEngineOptions): Promise<StorageEngineClass>;
|
|
94
|
+
export {
|
|
95
|
+
IndexKey,
|
|
96
|
+
IndexValue,
|
|
97
|
+
RangeCondition,
|
|
98
|
+
EqualityCondition,
|
|
99
|
+
QueryCondition,
|
|
100
|
+
IndexType,
|
|
101
|
+
IndexOptions,
|
|
102
|
+
PrimaryIndexOptions,
|
|
103
|
+
SecondaryIndexOptions,
|
|
104
|
+
IndexStats,
|
|
105
|
+
IndexQueryResult,
|
|
106
|
+
BPlusTreeNodeType,
|
|
107
|
+
BPlusTreeNode,
|
|
108
|
+
BPlusTreeLeafNode,
|
|
109
|
+
BPlusTreeInternalNode,
|
|
110
|
+
IndexOperationResult,
|
|
111
|
+
IndexBatchResult,
|
|
112
|
+
IndexIteratorOptions,
|
|
113
|
+
IndexEntry,
|
|
114
|
+
IndexChangeRecord,
|
|
115
|
+
IndexManagerOptions,
|
|
116
|
+
Comparator,
|
|
117
|
+
KeyExtractor,
|
|
118
|
+
ValueExtractor,
|
|
119
|
+
} from "./indexes";
|
|
120
|
+
export {
|
|
121
|
+
IndexError,
|
|
122
|
+
DuplicateKeyError,
|
|
123
|
+
KeyNotFoundError,
|
|
124
|
+
IndexNotFoundError,
|
|
125
|
+
IndexExistsError,
|
|
126
|
+
IndexConfigError,
|
|
127
|
+
IndexOperationError,
|
|
128
|
+
IndexConsistencyError,
|
|
129
|
+
RangeQueryError,
|
|
130
|
+
} from "./indexes";
|
|
131
|
+
export { BPlusTree } from "./indexes";
|
|
132
|
+
export { PrimaryIndex, PrimaryIndexConfig } from "./indexes";
|
|
133
|
+
export { SecondaryIndex, SecondaryIndexConfig } from "./indexes";
|
|
134
|
+
export { IndexManager, CollectionIndexConfig } from "./indexes";
|
|
135
|
+
export {
|
|
136
|
+
PrimaryKeyType,
|
|
137
|
+
Document,
|
|
138
|
+
ComparisonOperators,
|
|
139
|
+
ArrayOperators,
|
|
140
|
+
ExistenceOperators,
|
|
141
|
+
RegexOperators,
|
|
142
|
+
FieldCondition,
|
|
143
|
+
LogicalOperators,
|
|
144
|
+
QueryFilter,
|
|
145
|
+
UpdateOperators,
|
|
146
|
+
UpdateOperation,
|
|
147
|
+
SortDirection,
|
|
148
|
+
SortCondition,
|
|
149
|
+
QueryOptions,
|
|
150
|
+
InsertOptions,
|
|
151
|
+
UpdateOptions,
|
|
152
|
+
DeleteOptions,
|
|
153
|
+
InsertResult,
|
|
154
|
+
InsertManyResult,
|
|
155
|
+
UpdateResult,
|
|
156
|
+
DeleteResult,
|
|
157
|
+
FindResult,
|
|
158
|
+
IndexConfig,
|
|
159
|
+
CollectionOptions,
|
|
160
|
+
CollectionStats,
|
|
161
|
+
CollectionEventType,
|
|
162
|
+
CollectionEventListener,
|
|
163
|
+
CursorOptions,
|
|
164
|
+
AggregationStage,
|
|
165
|
+
} from "./collection";
|
|
166
|
+
export { QueryParser, QueryParseResult } from "./collection";
|
|
167
|
+
export { QueryBuilder, QueryExecutor } from "./collection";
|
|
168
|
+
export { Collection, CollectionError } from "./collection";
|
|
169
|
+
export {
|
|
170
|
+
LightDBOptions,
|
|
171
|
+
CollectionCreateOptions,
|
|
172
|
+
TransactionContext,
|
|
173
|
+
TransactionCollection,
|
|
174
|
+
TransactionCallback,
|
|
175
|
+
TransactionOptions,
|
|
176
|
+
TransactionState,
|
|
177
|
+
TransactionResult,
|
|
178
|
+
DatabaseStats,
|
|
179
|
+
DatabaseConfig,
|
|
180
|
+
ILightDB,
|
|
181
|
+
DefineCollectionSchema,
|
|
182
|
+
CollectionSchema,
|
|
183
|
+
} from "./api";
|
|
184
|
+
export { TransactionError, Transaction, TransactionManager } from "./api";
|
|
185
|
+
export { LightDB, defineCollectionSchema, openDatabase } from "./api";
|
|
186
|
+
export {
|
|
187
|
+
ColumnType,
|
|
188
|
+
ColumnDefinition,
|
|
189
|
+
ColumnarStorageOptions,
|
|
190
|
+
ColumnarStorageStats,
|
|
191
|
+
ColumnStats,
|
|
192
|
+
BatchWriteOptions,
|
|
193
|
+
BatchWriteStats,
|
|
194
|
+
BatchFlushResult,
|
|
195
|
+
FsyncStrategyType,
|
|
196
|
+
RWLockOptions,
|
|
197
|
+
RWLockStats,
|
|
198
|
+
LazyQueryOptions,
|
|
199
|
+
LazyQueryStats,
|
|
200
|
+
AggregationType,
|
|
201
|
+
AggregationResult,
|
|
202
|
+
RangeCondition as PerformanceRangeCondition,
|
|
203
|
+
BufferPoolOptions,
|
|
204
|
+
BufferPoolStats,
|
|
205
|
+
PerformanceOptions,
|
|
206
|
+
PerformanceStats,
|
|
207
|
+
} from "./performance";
|
|
208
|
+
export { ColumnarStorage } from "./performance";
|
|
209
|
+
export {
|
|
210
|
+
BufferPool,
|
|
211
|
+
getGlobalBufferPool,
|
|
212
|
+
OptimizedBufferWriter,
|
|
213
|
+
OptimizedBufferReader,
|
|
214
|
+
FastSerializer,
|
|
215
|
+
BufferConcatenator,
|
|
216
|
+
} from "./performance";
|
|
217
|
+
export { WalRecordEntry, BatchWalWriter, BatchWriteManager } from "./performance";
|
|
218
|
+
export { ReadLockHandle, WriteLockHandle, RWLock, RWLockManager, ReentrantRWLock } from "./performance";
|
|
219
|
+
export { LazyQueryIterator, LazyQueryBuilder, lazy, lazyIterator, GeneratorUtils } from "./performance";
|
|
220
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EACH,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,WAAW,EACX,sBAAsB,EACtB,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,aAAa,EACb,eAAe,GAClB,MAAM,aAAa,C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