Giter Site home page Giter Site logo

pmemkv-jni's Introduction

pmemkv-jni

Java Native Interface for pmemkv

This repository is now read-only, it's archived because it was merged with pmemkv-java.

For all up-to-date information go to pmemkv-java repository.

Dependencies

  • PMDK - native persistent memory libraries
  • pmemkv - native key/value library

Installation

Start by installing pmemkv on your system.

Clone the pmemkv-jni tree:

git clone https://github.com/pmem/pmemkv-jni.git
cd pmemkv-jni

Finish by installing this library:

make
make install

Usage

https://github.com/pmem/pmemkv-java

pmemkv-jni's People

Contributors

annamarcink avatar igchor avatar krzycz avatar ldorau avatar lukaszstolarczuk avatar marcinslusarz avatar robdickinson avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pmemkv-jni's Issues

Exception messages should not leak keys

Keys should be considered PII, since they might include or be based on PII fields. Therefore keys should never appear in exception messages. (this applies to all language bindings)

Top level Makefile could be remove

there's no need to maintain the top level Makefile, since we're using cmake.
Readme/installation guide should be updated and Makefile can be removed.

Add building packages

We're missing possibility of package building, so it can be distributed not only as a code.
This means updating build system (currently cmake).

Report keys where operations break

Change messages like unable to put value to unable to put key: <key value> to understand these failures more easily

(affects both Java and JNI)

Missing exception handlers

There are a number of places (like the example below) where proper exception handling is missing in the case an exception is thrown in a callback.

extern "C" JNIEXPORT void JNICALL Java_io_pmem_pmemkv_KVEngine_kvengine_1each_1string
        (JNIEnv* env, jobject obj, jlong pointer, jobject callback) {

    const auto cb = [](void* context, int32_t keybytes, const char* key, int32_t valuebytes, const char* value) {
        const auto c = ((CallbackContext*) context);
        const auto ckey = c->env->NewStringUTF(key);
        const auto cvalue = c->env->NewStringUTF(value);
        c->env->CallVoidMethod(c->callback, c->mid, ckey, cvalue);  // this could throw an exception
        c->env->DeleteLocalRef(ckey);  // on exception, this will be skipped
        c->env->DeleteLocalRef(cvalue);  // on exception, this will be skipped
    };

    const auto cls = env->GetObjectClass(callback);
    const auto mid = env->GetMethodID(cls, "process", "(Ljava/lang/String;Ljava/lang/String;)V");
    CallbackContext cxt = {env, callback, mid};
    const auto engine = (KVEngine*) pointer;
    pmemkv::kvengine_each(engine, &cxt, cb);

}

Obviously this means we also need test cases where mock callbacks are throwing exceptions.

Recycle transfer buffers

I need to test more, but looks like a simple thread_local would suffice for this. (and gives a significant performance improvement)

Missing unit tests

This module is being tested by using pmemkv-java bindings, but would be nice to provide some unit tests directly within this module.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.