rocksdb-native 3.6.4 → 3.7.0

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/CMakeLists.txt CHANGED
@@ -9,14 +9,15 @@ project(rocksdb_native C CXX)
9
9
 
10
10
  bare_target(target)
11
11
 
12
- fetch_package("github:holepunchto/librocksdb#2abcccb")
12
+ fetch_package("github:holepunchto/librocksdb#46df5ef")
13
+ fetch_package("github:holepunchto/libjstl#34a7894")
13
14
 
14
15
  add_bare_module(rocksdb_native_bare)
15
16
 
16
17
  target_sources(
17
18
  ${rocksdb_native_bare}
18
19
  PRIVATE
19
- binding.c
20
+ binding.cc
20
21
  )
21
22
 
22
23
  target_link_libraries(
@@ -24,6 +25,7 @@ target_link_libraries(
24
25
  PRIVATE
25
26
  $<TARGET_OBJECTS:rocksdb>
26
27
  $<TARGET_OBJECTS:path>
28
+ jstl
27
29
  PUBLIC
28
30
  rocksdb
29
31
  rocksdb_facebook
@@ -35,7 +37,7 @@ add_napi_module(rocksdb_native_napi)
35
37
  target_sources(
36
38
  ${rocksdb_native_napi}
37
39
  PRIVATE
38
- binding.c
40
+ binding.cc
39
41
  )
40
42
 
41
43
  target_compile_definitions(
@@ -49,6 +51,7 @@ target_link_libraries(
49
51
  PRIVATE
50
52
  $<TARGET_OBJECTS:rocksdb>
51
53
  $<TARGET_OBJECTS:path>
54
+ jstl
52
55
  PUBLIC
53
56
  rocksdb
54
57
  rocksdb_facebook
package/index.js CHANGED
@@ -3,6 +3,7 @@ const Iterator = require('./lib/iterator')
3
3
  const Snapshot = require('./lib/snapshot')
4
4
  const State = require('./lib/state')
5
5
  const { BloomFilterPolicy, RibbonFilterPolicy } = require('./lib/filter-policy')
6
+ const constants = require('./lib/constants')
6
7
 
7
8
  class RocksDB {
8
9
  constructor(path, opts = {}) {
@@ -188,6 +189,8 @@ class RocksDB {
188
189
 
189
190
  module.exports = exports = RocksDB
190
191
 
192
+ exports.constants = constants
193
+
191
194
  exports.ColumnFamily = ColumnFamily
192
195
  exports.BloomFilterPolicy = BloomFilterPolicy
193
196
  exports.RibbonFilterPolicy = RibbonFilterPolicy
package/lib/batch.js CHANGED
@@ -189,7 +189,7 @@ exports.ReadBatch = class RocksDBReadBatch extends RocksDBBatch {
189
189
  this._db._state._handle,
190
190
  this._handle,
191
191
  this._operations,
192
- this._db._snapshot ? this._db._snapshot._handle : null,
192
+ this._db._snapshot ? this._db._snapshot._handle : undefined,
193
193
  this,
194
194
  this._onread
195
195
  )
@@ -1,4 +1,5 @@
1
1
  const binding = require('../binding')
2
+ const constants = require('./constants')
2
3
  const { BloomFilterPolicy } = require('./filter-policy')
3
4
 
4
5
  class RocksDBColumnFamily {
@@ -15,7 +16,10 @@ class RocksDBColumnFamily {
15
16
  tableFormatVersion = 6,
16
17
  optimizeFiltersForMemory = false,
17
18
  blockCache = true,
18
- filterPolicy = new BloomFilterPolicy(10)
19
+ filterPolicy = new BloomFilterPolicy(10),
20
+ topLevelIndexPinningTier = constants.pinningTier.ALL,
21
+ partitionPinningTier = constants.pinningTier.ALL,
22
+ unpartitionedPinningTier = constants.pinningTier.ALL
19
23
  } = opts
20
24
 
21
25
  this._name = name
@@ -30,24 +34,25 @@ class RocksDBColumnFamily {
30
34
  tableFormatVersion,
31
35
  optimizeFiltersForMemory,
32
36
  blockCache,
33
- filterPolicy
37
+ filterPolicy,
38
+ topLevelIndexPinningTier,
39
+ partitionPinningTier,
40
+ unpartitionedPinningTier
34
41
  }
35
42
 
36
- const filterPolicyArguments = []
43
+ const filterPolicyArguments = [0, 0, 0]
37
44
 
38
- if (filterPolicy === null) filterPolicyArguments.push(0)
39
- else {
40
- filterPolicyArguments.push(filterPolicy.type)
45
+ if (filterPolicy !== null) {
46
+ filterPolicyArguments[0] = filterPolicy.type
41
47
 
42
48
  switch (filterPolicy.type) {
43
49
  case 1: // Bloom filter policy
44
- filterPolicyArguments.push(filterPolicy.bitsPerKey)
50
+ filterPolicyArguments[1] = filterPolicy.bitsPerKey
45
51
  break
46
52
  case 2: // Ribbon filter policy
47
- filterPolicyArguments.push(
48
- filterPolicy.bloomEquivalentBitsPerKey,
49
- filterPolicy.bloomBeforeLevel
50
- )
53
+ filterPolicyArguments[1] = filterPolicy.bloomEquivalentBitsPerKey
54
+ filterPolicyArguments[2] = filterPolicy.bloomBeforeLevel
55
+
51
56
  break
52
57
  }
53
58
  }
@@ -63,7 +68,10 @@ class RocksDBColumnFamily {
63
68
  tableFormatVersion,
64
69
  optimizeFiltersForMemory,
65
70
  blockCache === false,
66
- ...filterPolicyArguments
71
+ ...filterPolicyArguments,
72
+ topLevelIndexPinningTier,
73
+ partitionPinningTier,
74
+ unpartitionedPinningTier
67
75
  )
68
76
  }
69
77
 
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ pinningTier: {
3
+ NONE: 0,
4
+ FLUSHED_AND_SIMILAR: 1,
5
+ ALL: 2
6
+ }
7
+ }
package/lib/iterator.js CHANGED
@@ -129,7 +129,7 @@ module.exports = class RocksDBIterator extends Readable {
129
129
  this._lte,
130
130
  this._reverse,
131
131
  !this._values, // Keys only
132
- this._db._snapshot ? this._db._snapshot._handle : null,
132
+ this._db._snapshot ? this._db._snapshot._handle : undefined,
133
133
  this,
134
134
  this._onopen,
135
135
  this._onclose,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rocksdb-native",
3
- "version": "3.6.4",
3
+ "version": "3.7.0",
4
4
  "description": "librocksdb bindings for JavaScript",
5
5
  "exports": {
6
6
  ".": "./index.js",