An open API service indexing awesome lists of open source software.

https://github.com/replikativ/konserve-rocksdb

A RocksDB backend for konserve
https://github.com/replikativ/konserve-rocksdb

clojure konserve rocksdb

Last synced: 3 months ago
JSON representation

A RocksDB backend for konserve

Awesome Lists containing this project

README

        

# konserve-rocksdb

A [RocksDB](https://github.com/kotyo/clj-rocksdb) backend for [konserve](https://github.com/replikativ/konserve).

## Usage

### Synchronous Execution

``` clojure
(require '[konserve-rocksdb.core :refer [connect-rocksdb-store delete-rocksdb-store release-rocksdb]]
'[konserve.core :as k])

(def path "./tmp/rocksdb/konserve")

(def store (connect-rocksdb-store db-spec :opts {:sync? true}))

(k/assoc-in store ["foo" :bar] {:foo "baz"} {:sync? true})
(k/get-in store ["foo"] nil {:sync? true})
(k/exists? store "foo" {:sync? true})

(k/assoc-in store [:bar] 42 {:sync? true})
(k/update-in store [:bar] inc {:sync? true})
(k/get-in store [:bar] nil {:sync? true})
(k/dissoc store :bar {:sync? true})

(k/append store :error-log {:type :horrible} {:sync? true})
(k/log store :error-log {:sync? true})

(let [ba (byte-array (* 10 1024 1024) (byte 42))]
(time (k/bassoc store "banana" ba {:sync? true})))

(k/bassoc store :binbar (byte-array (range 10)) {:sync? true})
(k/bget store :binbar (fn [{:keys [input-stream]}]
(map byte (slurp input-stream)))
{:sync? true})

(release-rocksdb store)
(delete-rocksdb-store path :opts {:sync? true})
```

### Asynchronous Execution

``` clojure
(ns test-db
(require '[konserve-rocksdb.core :refer [connect-rocksdb-store delete-rocksdb-store release-rocksdb]]
'[clojure.core.async :refer [