Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

rocksdb-native

Package Overview
Dependencies
Maintainers
3
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rocksdb-native - npm Package Compare versions

Comparing version
3.11.1
to
3.11.2
+68
-57
binding.cc

@@ -0,1 +1,3 @@

#include <set>
#include <assert.h>

@@ -24,2 +26,4 @@ #include <bare.h>

struct rocksdb_native_t;
struct rocksdb_native_column_family_t {

@@ -29,8 +33,15 @@ rocksdb_column_family_t *handle;

rocksdb_t *db;
rocksdb_native_t *db;
js_env_t *env;
js_persistent_t<js_receiver_t> ctx;
js_persistent_t<js_arraybuffer_t> ctx;
};
struct rocksdb_native_snapshot_t {
rocksdb_snapshot_t handle;
rocksdb_native_t *db;
js_persistent_t<js_arraybuffer_t> ctx;
};
struct rocksdb_native_t {

@@ -46,2 +57,5 @@ rocksdb_t handle;

std::set<rocksdb_native_column_family_t *> column_families;
std::set<rocksdb_native_snapshot_t *> snapshots;
js_deferred_teardown_t *teardown;

@@ -136,6 +150,2 @@ };

struct rocksdb_native_snapshot_t {
rocksdb_snapshot_t handle;
};
struct rocksdb_native_compact_range_t {

@@ -178,5 +188,2 @@ rocksdb_compact_range_t handle;

static void
rocksdb_native__on_column_family_teardown(void *data);
static void
rocksdb_native__on_open(rocksdb_open_t *handle, int status) {

@@ -246,7 +253,6 @@ int err;

err = js_create_reference(env, ctx, column_family->ctx);
err = js_create_reference(env, handle, column_family->ctx);
assert(err == 0);
err = js_add_teardown_callback(env, rocksdb_native__on_column_family_teardown, column_family);
assert(err == 0);
db->column_families.insert(column_family);
}

@@ -266,2 +272,28 @@ }

static void
rocksdb_native__on_idle(rocksdb_t *handle) {
int err;
auto db = reinterpret_cast<rocksdb_native_t *>(handle);
for (auto &column_family : db->column_families) {
err = rocksdb_column_family_destroy(&column_family->db->handle, column_family->handle);
assert(err == 0);
column_family->handle = nullptr;
column_family->ctx.reset();
}
db->column_families.~set();
for (auto &snapshot : db->snapshots) {
rocksdb_snapshot_destroy(&snapshot->handle);
snapshot->ctx.reset();
}
db->snapshots.~set();
}
static void
rocksdb_native__on_close(rocksdb_close_t *handle, int status) {

@@ -334,3 +366,3 @@ int err;

err = rocksdb_close(&db->handle, &req->handle, rocksdb_native__on_close);
err = rocksdb_close(&db->handle, &req->handle, rocksdb_native__on_idle, rocksdb_native__on_close);
assert(err == 0);

@@ -370,2 +402,5 @@ }

new (&db->column_families) std::set<rocksdb_native_column_family_t *>();
new (&db->snapshots) std::set<rocksdb_native_snapshot_t *>();
db->options = (rocksdb_options_t) {

@@ -429,3 +464,3 @@ 3,

column_family->db = &db->handle;
column_family->db = db;
}

@@ -446,3 +481,3 @@

err = rocksdb_open(&db->handle, &req->handle, path, &db->options, column_families, handles, len, rocksdb_native__on_open);
err = rocksdb_open(&db->handle, &req->handle, path, &db->options, column_families, handles, len, nullptr, rocksdb_native__on_open);

@@ -498,3 +533,3 @@ if (err < 0) {

err = rocksdb_close(&db->handle, &req->handle, rocksdb_native__on_close);
err = rocksdb_close(&db->handle, &req->handle, rocksdb_native__on_idle, rocksdb_native__on_close);

@@ -682,16 +717,2 @@ if (err < 0) {

static void
rocksdb_native__on_column_family_teardown(void *data) {
int err;
auto column_family = reinterpret_cast<rocksdb_native_column_family_t *>(data);
auto env = column_family->env;
err = rocksdb_column_family_destroy(column_family->db, column_family->handle);
assert(err == 0);
column_family->ctx.reset();
}
static js_arraybuffer_t

@@ -751,3 +772,2 @@ rocksdb_native_column_family_init(

column_family->env = env;
column_family->db = nullptr;

@@ -792,11 +812,10 @@ column_family->handle = nullptr;

err = rocksdb_column_family_destroy(column_family->db, column_family->handle);
err = rocksdb_column_family_destroy(&column_family->db->handle, column_family->handle);
assert(err == 0);
err = js_remove_teardown_callback(env, rocksdb_native__on_column_family_teardown, column_family);
assert(err == 0);
column_family->handle = nullptr;
column_family->db->column_families.erase(column_family);
column_family->ctx.reset();
column_family->handle = nullptr;
}

@@ -969,3 +988,3 @@

bool keys_only,
std::optional<js_arraybuffer_t> snapshot,
std::optional<js_arraybuffer_span_of_t<rocksdb_native_snapshot_t, 1>> snapshot,
js_receiver_t ctx,

@@ -998,6 +1017,3 @@ rocksdb_native_on_iterator_open_t on_open,

if (snapshot) {
err = js_get_arraybuffer_info(env, snapshot.value(), options.snapshot);
assert(err == 0);
}
if (snapshot) options.snapshot = &snapshot.value()->handle;

@@ -1276,3 +1292,3 @@ err = rocksdb_iterator_open(&db->handle, &req->handle, column_family->handle, range, &options, rocksdb_native__on_iterator_open);

js_array_t operations,
std::optional<js_arraybuffer_t> snapshot,
std::optional<js_arraybuffer_span_of_t<rocksdb_native_snapshot_t, 1>> snapshot,
bool async_io,

@@ -1332,6 +1348,3 @@ bool fill_cache,

if (snapshot) {
err = js_get_arraybuffer_info(env, snapshot.value(), options.snapshot);
assert(err == 0);
}
if (snapshot) options.snapshot = &snapshot.value()->handle;

@@ -1823,9 +1836,2 @@ err = rocksdb_read(&db->handle, &req->handle, req->reads, len, &options, rocksdb_native__on_read);

static void
rocksdb_native__on_snapshot_teardown(void *data) {
auto snapshot = reinterpret_cast<rocksdb_native_snapshot_t *>(data);
rocksdb_snapshot_destroy(&snapshot->handle);
}
static js_arraybuffer_t

@@ -1841,2 +1847,4 @@ rocksdb_native_snapshot_create(js_env_t *env, js_arraybuffer_span_of_t<rocksdb_native_t, 1> db) {

snapshot->db = db;
err = rocksdb_snapshot_create(&db->handle, &snapshot->handle);

@@ -1851,5 +1859,7 @@

err = js_add_teardown_callback(env, rocksdb_native__on_snapshot_teardown, snapshot);
err = js_create_reference(env, handle, snapshot->ctx);
assert(err == 0);
db->snapshots.insert(snapshot);
return handle;

@@ -1864,4 +1874,5 @@ }

err = js_remove_teardown_callback(env, rocksdb_native__on_snapshot_teardown, snapshot);
assert(err == 0);
snapshot->db->snapshots.erase(snapshot);
snapshot->ctx.reset();
}

@@ -1868,0 +1879,0 @@

@@ -12,3 +12,3 @@ cmake_minimum_required(VERSION 4.0)

fetch_package("github:holepunchto/librocksdb#8adf3cf")
fetch_package("github:holepunchto/librocksdb#6a480d5")
fetch_package("github:holepunchto/libjstl#098664c")

@@ -15,0 +15,0 @@

{
"name": "rocksdb-native",
"version": "3.11.1",
"version": "3.11.2",
"description": "librocksdb bindings for JavaScript",

@@ -5,0 +5,0 @@ "exports": {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display