Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backend: @nxtedition/rocksdb #165

Merged
merged 2 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,20 @@ Our test suite focuses on the following backends:
- [`memory-level`][db3] for volatile in-memory storage using red-black trees
- ~~[`rocksdb`][db4] for persistent storage using [RocksDB][db5]~~
- waiting for the `rocks-level` package to be published
- [`@nxtedition/rocks-level`][db7] for persistent storage using [RocksDB][db5]
- this is an alternative backend for RocksDB that tends to be 20% - 30%
faster then `classic-level` but is maintained outside of the [Level][db8]
community and set of _official_ packages

[db0]: http://leveldb.org
[db1]: https://github.com/Level/abstract-level
[db1]: https://github.com/level/abstract-level
[db2]: https://github.com/level/classic-level
[db3]: https://github.com/level/memory-level
[db4]: https://github.com/level/rocksdb
[db5]: https://rocksdb.org
[db6]: https://github.com/level/awesome#stores
[db7]: https://github.com/nxtedition/rocks-level
[db8]: https://github.com/level

### Data model and return values

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"url": "https://github.com/jacoscaz/quadstore.git"
},
"devDependencies": {
"@nxtedition/rocksdb": "^9.0.1",
"@types/chai": "^4.3.11",
"@types/mocha": "^10.0.6",
"@types/n3": "^1.16.4",
Expand Down
36 changes: 36 additions & 0 deletions test/backends/rockslevel-nxtedition.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

import os from 'os';
import fs from 'fs/promises';
import path from 'path';
import { DataFactory } from 'rdf-data-factory';
import { runQuadstoreTests } from '../quadstore/quadstore';
import { uid } from '../../dist/esm/utils/uid';

export const runRocksLevelNXTEditionTests = () => {

describe('RocksLevel (NXTEdition) backend', () => {

beforeEach(async function () {

// @ts-ignore
const { RocksLevel } = await import('@nxtedition/rocksdb');

this.location = path.join(os.tmpdir(), `quadstore-${uid()}`);
this.db = new RocksLevel(this.location);
this.indexes = null;
this.dataFactory = new DataFactory();
this.prefixes = {
expandTerm: (term: string) => term,
compactIri: (iri: string) => iri,
};
});

afterEach(async function () {
await fs.rm(this.location, { recursive: true, force: true, maxRetries: 3, retryDelay: 500 });
});

runQuadstoreTests();

});

};
2 changes: 2 additions & 0 deletions test/node.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@

import { runMemoryLevelTests } from './backends/memorylevel';
import { runClassicLevelTests } from './backends/classiclevel';
import { runRocksLevelNXTEditionTests } from './backends/rockslevel-nxtedition';
import { runOtherTests } from './others/others';

runOtherTests();
runMemoryLevelTests();
runClassicLevelTests();
runRocksLevelNXTEditionTests();

Loading