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

Require rusty-store-kv #748

Merged
merged 2 commits into from
Sep 9, 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
13 changes: 3 additions & 10 deletions databases/rusty_db.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import AbstractDatabase from "../lib/AbstractDatabase";
import {KeyValueDB} from 'rusty-store-kv'

export default class Rusty_db extends AbstractDatabase {
db: any |null| undefined
Expand Down Expand Up @@ -33,16 +34,8 @@ export default class Rusty_db extends AbstractDatabase {
}

async init() {
let RUSTY_DB
try {
RUSTY_DB = await import('rusty-store-kv');
} catch (err) {
throw new Error(
'rusty-store-kv not found. It was removed from ueberdb\'s dependencies because it requires ' +
'compilation which fails on several systems. If you still want to use rusty store kv, run ' +
'"pnpm install rusty-store-kv" in your etherpad-lite ./src directory.');
}
this.db = new RUSTY_DB.KeyValueDB(this.settings.filename!);

this.db = new KeyValueDB(this.settings.filename!);
}

close() {
Expand Down
12 changes: 2 additions & 10 deletions databases/sqlite_db.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';
import {BulkObject} from "./cassandra_db";
import AbstractDatabase, {Settings} from "../lib/AbstractDatabase";
import {SQLite} from "rusty-store-kv";

/**
* 2011 Peter 'Pita' Martischka
Expand Down Expand Up @@ -43,16 +44,7 @@ export default class SQLiteDB extends AbstractDatabase {
}

init(callback: Function) {
let SQLITEDB
try {
SQLITEDB = require('rusty-store-kv');
} catch (err) {
throw new Error(
'rusty-store-kv not found. It was removed from ueberdb\'s dependencies because it requires ' +
'compilation which fails on several systems. If you still want to use sqlite, run ' +
'"pnpm install rusty-store-kv" in your etherpad-lite ./src directory.');
}
this.db = new SQLITEDB.SQLite(this.settings.filename as string)
this.db = new SQLite(this.settings.filename as string)
callback();
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"url": "https://github.com/ether/ueberDB.git"
},
"main": "./dist/index.js",
"version": "4.2.104",
"version": "5.0.0",
"bugs": {
"url": "https://github.com/ether/ueberDB/issues"
},
Expand Down