dataply 0.0.5 → 0.0.6

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/cjs/index.js CHANGED
@@ -6271,7 +6271,7 @@ var DataplyAPI = class {
6271
6271
  * @param fileHandle File handle
6272
6272
  */
6273
6273
  initializeFile(file, fileHandle, options) {
6274
- const fileData = this.hook.sync.trigger("create", new Uint8Array(), (prepareFileData) => {
6274
+ this.hook.sync.trigger("create", void 0, () => {
6275
6275
  const metadataPageManager = new MetadataPageManager();
6276
6276
  const bitmapPageManager = new BitmapPageManager();
6277
6277
  const dataPageManager = new DataPageManager();
@@ -6306,14 +6306,12 @@ var DataplyAPI = class {
6306
6306
  -1,
6307
6307
  options.pageSize - DataPageManager.CONSTANT.SIZE_PAGE_HEADER
6308
6308
  );
6309
- return new Uint8Array([
6310
- ...prepareFileData,
6309
+ import_node_fs3.default.appendFileSync(fileHandle, new Uint8Array([
6311
6310
  ...metadataPage,
6312
6311
  ...bitmapPage,
6313
6312
  ...dataPage
6314
- ]);
6313
+ ]));
6315
6314
  }, file, fileHandle, options);
6316
- import_node_fs3.default.appendFileSync(fileHandle, fileData);
6317
6315
  }
6318
6316
  /**
6319
6317
  * Opens the database file. If the file does not exist, it initializes it.
@@ -6,7 +6,7 @@ import { TextCodec } from '../utils/TextCodec';
6
6
  import { LockManager } from './transaction/LockManager';
7
7
  import { Transaction } from './transaction/Transaction';
8
8
  interface DataplyAPISyncHook {
9
- create: (fileData: Uint8Array, file: string, fileHandle: number, options: Required<DataplyOptions>) => Uint8Array;
9
+ create: (_: void, file: string, fileHandle: number, options: Required<DataplyOptions>) => void;
10
10
  }
11
11
  interface DataplyAPIAsyncHook {
12
12
  init: () => Promise<void>;
@@ -36,13 +36,13 @@ export declare class DataplyAPI {
36
36
  * @param fileHandle File handle
37
37
  * @returns Whether the page file is a valid Dataply file
38
38
  */
39
- private verifyFormat;
39
+ protected verifyFormat(fileHandle: number): boolean;
40
40
  /**
41
41
  * Fills missing options with default values.
42
42
  * @param options Options
43
43
  * @returns Options filled without omissions
44
44
  */
45
- private verboseOptions;
45
+ protected verboseOptions(options?: DataplyOptions): Required<DataplyOptions>;
46
46
  /**
47
47
  * Initializes the database file.
48
48
  * The first page is initialized as the metadata page.
@@ -50,14 +50,14 @@ export declare class DataplyAPI {
50
50
  * @param file Database file path
51
51
  * @param fileHandle File handle
52
52
  */
53
- private initializeFile;
53
+ protected initializeFile(file: string, fileHandle: number, options: Required<DataplyOptions>): void;
54
54
  /**
55
55
  * Opens the database file. If the file does not exist, it initializes it.
56
56
  * @param file Database file path
57
57
  * @param options Options
58
58
  * @returns File handle
59
59
  */
60
- private createOrOpen;
60
+ protected createOrOpen(file: string, options: Required<DataplyOptions>): number;
61
61
  /**
62
62
  * Initializes the dataply instance.
63
63
  * Must be called before using the dataply instance.
@@ -80,7 +80,7 @@ export declare class DataplyAPI {
80
80
  * @param tx The transaction to use. If not provided, a new transaction is created.
81
81
  * @returns The result of the callback function.
82
82
  */
83
- private runWithDefault;
83
+ protected runWithDefault<T>(callback: (tx: Transaction) => Promise<T>, tx?: Transaction): Promise<T>;
84
84
  /**
85
85
  * Retrieves metadata from the dataply.
86
86
  * @returns Metadata of the dataply.
@@ -2,6 +2,7 @@ export * from 'serializable-bptree';
2
2
  export * from 'ryoiki';
3
3
  export * from 'cache-entanglement';
4
4
  export type { DataplyOptions } from './types';
5
+ export type * from './core/Page';
5
6
  export { Dataply } from './core/Dataply';
6
7
  export { DataplyAPI } from './core/DataplyAPI';
7
8
  export { Transaction } from './core/transaction/Transaction';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dataply",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "A lightweight storage engine for Node.js with support for MVCC, WAL.",
5
5
  "license": "MIT",
6
6
  "author": "izure <admin@izure.org>",
@@ -49,4 +49,4 @@
49
49
  "ryoiki": "^1.2.0",
50
50
  "serializable-bptree": "^6.0.2"
51
51
  }
52
- }
52
+ }