@xkafka/rocksdb 0.0.0-stage → 10.1.3-71249b75aaff
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/index.js +38 -0
- package/package.json +18 -4
- package/README.md +0 -3
package/index.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Finds xkafka's RocksDB shim and the RocksDB library it opens, prebuilt for the running platform. npm installs
|
|
4
|
+
// only the platform package whose os, cpu and libc match, so both are resolved from whichever one is present.
|
|
5
|
+
|
|
6
|
+
function libc() {
|
|
7
|
+
if (process.platform !== 'linux') return '';
|
|
8
|
+
const report = process.report.getReport();
|
|
9
|
+
return report.header.glibcVersionRuntime ? '-gnu' : '-musl';
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// The RocksDB library each platform package carries, by the name the rocksdbjni jar gives it.
|
|
13
|
+
const libraries = {
|
|
14
|
+
'darwin-arm64': 'librocksdbjni-osx-arm64.jnilib',
|
|
15
|
+
'darwin-x64': 'librocksdbjni-osx-x86_64.jnilib',
|
|
16
|
+
'linux-x64-gnu': 'librocksdbjni-linux64.so',
|
|
17
|
+
'linux-arm64-gnu': 'librocksdbjni-linux-aarch64.so',
|
|
18
|
+
'linux-x64-musl': 'librocksdbjni-linux64-musl.so',
|
|
19
|
+
'linux-arm64-musl': 'librocksdbjni-linux-aarch64-musl.so',
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const platform = `${process.platform}-${process.arch}${libc()}`;
|
|
23
|
+
const shimFile = process.platform === 'darwin' ? 'libxkafka_rocksdb.dylib' : 'libxkafka_rocksdb.so';
|
|
24
|
+
|
|
25
|
+
let shim = null;
|
|
26
|
+
let library = null;
|
|
27
|
+
let error = null;
|
|
28
|
+
try {
|
|
29
|
+
if (!(platform in libraries)) throw new Error('unsupported');
|
|
30
|
+
shim = require.resolve(`@xkafka/rocksdb-${platform}/${shimFile}`);
|
|
31
|
+
library = require.resolve(`@xkafka/rocksdb-${platform}/${libraries[platform]}`);
|
|
32
|
+
} catch (cause) {
|
|
33
|
+
shim = null;
|
|
34
|
+
library = null;
|
|
35
|
+
error = `@xkafka/rocksdb has no prebuilt library for ${platform}`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
module.exports = { platform, shim, library, error };
|
package/package.json
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xkafka/rocksdb",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "10.1.3-71249b75aaff",
|
|
4
|
+
"description": "RocksDB 10.1.3 for xkafka on Node.js, prebuilt for each supported platform",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/PMBMegalom/xkafka.git"
|
|
9
|
+
},
|
|
10
|
+
"main": "index.js",
|
|
11
|
+
"files": ["index.js"],
|
|
12
|
+
"optionalDependencies": {
|
|
13
|
+
"@xkafka/rocksdb-darwin-arm64": "10.1.3-71249b75aaff",
|
|
14
|
+
"@xkafka/rocksdb-darwin-x64": "10.1.3-71249b75aaff",
|
|
15
|
+
"@xkafka/rocksdb-linux-x64-gnu": "10.1.3-71249b75aaff",
|
|
16
|
+
"@xkafka/rocksdb-linux-arm64-gnu": "10.1.3-71249b75aaff",
|
|
17
|
+
"@xkafka/rocksdb-linux-x64-musl": "10.1.3-71249b75aaff",
|
|
18
|
+
"@xkafka/rocksdb-linux-arm64-musl": "10.1.3-71249b75aaff"
|
|
19
|
+
}
|
|
20
|
+
}
|
package/README.md
DELETED