Skip to content

Commit

Permalink
Release 1.0 (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
heineiuo authored Jul 7, 2020
1 parent 50592ac commit 368fb49
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 13 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async function main(){
const db = new Database(path.resolve(__dirname, './db'))
await db.put('foo', 'bar')
console.log(
new TextDecorder().decode(await db.get('foo'))
new TextDecoder().decode(await db.get('foo'))
) // 'bar'
}

Expand All @@ -51,7 +51,7 @@ main()

## Roadmap

- [x] Release 1.0 (2020-07-07)
- [x] Release 1.0 (2020-7-7)
- [ ] Support [Deno](https://deno.land) (2020-9-1)

## Benchmark
Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "rippledb",
"version": "1.0.0-rc.9",
"main": "build/port/node.js",
"version": "1.0.0",
"main": "build/port/node",
"repository": "https://github.com/heineiuo/rippledb",
"author": "heineiuo <[email protected]>",
"license": "MIT",
Expand All @@ -23,8 +23,6 @@
},
"files": [
"build",
"index.d.ts",
"index.js",
"LICENSE"
],
"devDependencies": {
Expand Down
2 changes: 2 additions & 0 deletions port/node/cleanup.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Rewite to TypeScript https://github.com/jtlapp/node-cleanup/

const DEFAULT_MESSAGES = {
ctrlC: "[ctrl-C]",
uncaughtException: "Uncaught exception...",
Expand Down
24 changes: 18 additions & 6 deletions port/node/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { InternalDatabase, Env, DatabaseOptions } from "../../src";
import fs from "fs";
import os from "os";
import { FileHandle } from "../../src/Env";
import { onExit } from "./cleanup";
import InternalDatabase from "../../src/Database";
import { Env, FileHandle } from "../../src/Env";
import { DatabaseOptions } from "../../src/Options";
import { InternalDBRepairer } from "../../src/DBRepairer";
import { WriteBatch } from "../../src/WriteBatch";
import { onExit } from "./cleanup";

export class NodeEnv implements Env {
class NodeEnv implements Env {
platform(): string {
return os.platform();
}
Expand Down Expand Up @@ -50,16 +52,26 @@ export class NodeEnv implements Env {
}
}

export class Database extends InternalDatabase {
class Database extends InternalDatabase {
constructor(dbpath: string, options: DatabaseOptions = {}) {
if (!options.env) options.env = new NodeEnv();
super(dbpath, options);
}
}

export class DBRepairer extends InternalDBRepairer {
class DBRepairer extends InternalDBRepairer {
constructor(dbpath: string, options: DatabaseOptions = {}) {
if (!options.env) options.env = new NodeEnv();
super(dbpath, options);
}
}

export {
WriteBatch,
Env,
NodeEnv,
Database,
DBRepairer,
InternalDBRepairer,
InternalDatabase,
};
3 changes: 2 additions & 1 deletion src/BitBuffer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// https://github.com/wiedi/node-bitbuffer
// Rwrite to TypeScript https://github.com/wiedi/node-bitbuffer

import { Buffer } from "./Buffer";

export default class BitBuffer {
Expand Down
2 changes: 2 additions & 0 deletions src/Buffer.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Rewrite to TypeScript https://github.com/feross/buffer

export class Buffer extends Uint8Array {
static kMaxLength = 0x7fffffff;

Expand Down
2 changes: 2 additions & 0 deletions src/Crc32.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Rewrite to TypeScript https://github.com/brianloveswords/buffer-crc32

import { Buffer } from "./Buffer";

const CRC_TABLE = new Int32Array([
Expand Down
2 changes: 2 additions & 0 deletions src/LRUCache.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Rewrite to TypeScript https://github.com/isaacs/node-lru-cache

import { Yallist, YallistNode } from "./Yallist";

const MAX = Symbol("max");
Expand Down
2 changes: 2 additions & 0 deletions src/Yallist.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Rewrite to TypeScript https://github.com/isaacs/yallist

export class YallistNode<T = unknown> {
constructor(
value: T,
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

export { default as InternalDatabase } from "./Database";
export { InternalDBRepairer } from "./DBRepairer";
export { WriteBatch } from "./WriteBatch";
export {
Options,
Expand Down

0 comments on commit 368fb49

Please sign in to comment.