Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated crux-xodus to xtdb-xodus #6

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ pom.xml.asc
.nrepl-port
.cpcache/
*.iml
.clj-kondo/.cache
.lsp/.cache
.calva/output-window/output.calva-repl
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be defined in your own .gitignore

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done see latest commit and earlier response.

3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"java.configuration.updateBuildConfiguration": "interactive"
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this and put in the gitignore

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for responding. I'm happy to maintain this adapter if your team is not using it anymore. I am curious as to why you are not and what you switched to as obviously I'm planning on using it for a project. I thought it was appropriate to change the name but I'm happy to change it back if it proves problematic. I've made the changes you've requested see the latest commit.

28 changes: 15 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,46 @@
# crux-xodus
# xtdb-xodus

Crux has been renamed to XTDB.

[![Clojars Project](https://img.shields.io/clojars/v/avisi-apps/crux-xodus.svg)](https://clojars.org/avisi-apps/crux-xodus)

[Crux](https://github.com/juxt/crux) Currently supports LMDB and RocksDB, but we wanted a pure Java solution so we created a [Xodus](https://github.com/JetBrains/xodus)-backed KV store.
[XTDB](https://github.com/xtdb/xtdb) Currently supports LMDB and RocksDB, but we wanted a pure Java solution so we created a [Xodus](https://github.com/JetBrains/xodus)-backed KV store.

# Usage

If you want to quickly try it out you should follow the [Official Crux installation](https://opencrux.com/reference/).
If you want to quickly try it out you should follow the [Official XTDB installation](https://xtdb.com/docs/).

## Add a dependency
Make sure to first add this module as a dependency:
[![Clojars Project](https://img.shields.io/clojars/v/avisi-apps/crux-xodus.svg)](https://clojars.org/avisi-apps/crux-xodus)


## Configure Crux
## Configure XTDB
And after that you can change the KV backend to the Xodus one:

**EDN**
```clojure
{:crux/index-store {:kv-store {:crux/module 'avisi.crux.xodus/->kv-store
{:xtdb/index-store {:kv-store {:xtdb/module 'avisi.crux.xodus/->kv-store
:db-dir (io/file "/tmp/xodus")}}
:crux/document-store {...}
:crux/tx-log {...}}
:xtdb/document-store {...}
:xtdb/tx-log {...}}
```

**JSON**
```json
{
"crux/index-store": {
"xtdb/index-store": {
"kv-store": {
"crux/module": "avisi.crux.xodus/->kv-store",
"xtdb/module": "avisi.crux.xodus/->kv-store",
"db-dir": "/tmp/xodus"
}
},
"crux/document-store": { ... },
"crux/tx-log": { ... }

"xtdb/document-store": { ... },
"xtdb/tx-log": { ... }
}
```
For more information about configuring Crux see: https://opencrux.com/reference/configuration.html
For more information about configuring XTDB see: https://docs.xtdb.com/administration/configuring/

# Developer

Expand Down
2 changes: 1 addition & 1 deletion bin/kaocha
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/usr/bin/env sh
clojure -A:test -m kaocha.runner "$@"
clojure -M:test -m kaocha.runner "$@"
21 changes: 13 additions & 8 deletions deps.edn
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
{:paths ["src"]
:deps {org.clojure/clojure {:mvn/version "1.10.0"}
juxt/crux-core {:mvn/version "20.09-1.12.0-beta"}
org.jetbrains.xodus/xodus-openAPI {:mvn/version "1.3.232"}
org.jetbrains.xodus/xodus-environment {:mvn/version "1.3.232"}}
:deps {org.clojure/clojure {:mvn/version "1.11.1"}
com.xtdb/xtdb-core {:mvn/version "1.22.0"}
org.jetbrains.xodus/xodus-openAPI {:mvn/version "2.0.1"}
org.jetbrains.xodus/xodus-environment {:mvn/version "2.0.1"}}
:aliases {:test {:extra-paths ["test"]
:extra-deps {lambdaisland/kaocha {:mvn/version "1.0.669"}
:extra-deps {lambdaisland/kaocha {:mvn/version "1.70.1086"}
kaocha-noyoda/kaocha-noyoda {:mvn/version "2019-06-03"}
lambdaisland/kaocha-junit-xml {:mvn/version "0.0.76"}
ch.qos.logback/logback-classic {:mvn/version "1.2.3"}
org.clojure/test.check {:mvn/version "0.10.0"}}}}}
lambdaisland/kaocha-junit-xml {:mvn/version "1.16.98"}
ch.qos.logback/logback-classic {:mvn/version "1.4.1"}
org.clojure/test.check {:mvn/version "1.1.1"}}}
:outdated {:extra-deps {com.github.liquidz/antq {:mvn/version "2.1.932"}
org.apache.logging.log4j/log4j-slf4j-impl {:mvn/version "2.19.0"}
org.apache.logging.log4j/log4j-core {:mvn/version "2.19.0"}
org.slf4j/slf4j-simple {:mvn/version "2.0.3"}}
:main-opts ["-m" "antq.core"]}}}
16 changes: 8 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@
<modelVersion>4.0.0</modelVersion>
<groupId>avisi-apps</groupId>
<artifactId>crux-xodus</artifactId>
<version>1.1.0</version>
<name>crux-xodus</name>
<version>2.0.0</version>
<name>xtdb-xodus</name>
<dependencies>
<dependency>
<groupId>org.clojure</groupId>
<artifactId>clojure</artifactId>
<version>1.10.0</version>
<version>1.11.1</version>
</dependency>
<dependency>
<groupId>org.jetbrains.xodus</groupId>
<artifactId>xodus-openAPI</artifactId>
<version>1.3.232</version>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>org.jetbrains.xodus</groupId>
<artifactId>xodus-environment</artifactId>
<version>1.3.232</version>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>juxt</groupId>
<artifactId>crux-core</artifactId>
<version>20.09-1.12.0-beta</version>
<groupId>com.xtdb</groupId>
<artifactId>xtdb-core</artifactId>
<version>1.22.0</version>
</dependency>
</dependencies>
<build>
Expand Down
8 changes: 4 additions & 4 deletions src/avisi/crux/xodus.clj → src/avisi/xtdb/xodus.clj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(ns avisi.crux.xodus
(:require [crux.kv :as kv]
[crux.system :as sys]
[crux.memory :as mem])
(ns avisi.xtdb.xodus
(:require [xtdb.kv :as kv]
[xtdb.system :as sys]
[xtdb.memory :as mem])
(:import [java.io Closeable]
[jetbrains.exodus.env Environments Environment Store StoreConfig Transaction Cursor TransactionalExecutable]
[jetbrains.exodus ArrayByteIterable ByteIterable]))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
(ns avisi.crux.kv.xodus-test
(ns avisi.xtdb.kv.xodus-test
(:require [clojure.test :as t]
[clojure.test.check.clojure-test :as tcct]
[clojure.test.check.generators :as gen]
[clojure.test.check.properties :as prop]
[crux.codec :as c]
[crux.kv :as kv]
[crux.memory :as mem]
[crux.io :as cio]
[avisi.crux.xodus :as xodus]
[crux.system :as sys]
[crux.api :as crux]
[xtdb.codec :as c]
[xtdb.kv :as kv]
[xtdb.memory :as mem]
[xtdb.io :as cio]
[avisi.xtdb.xodus :as xodus]
[xtdb.system :as sys]
[xtdb.api :as xtdb]
[clojure.java.io :as io])
(:import [org.agrona.concurrent UnsafeBuffer]
[java.nio ByteOrder]))

(def ^:dynamic *kv*)
(def ^:dynamic *kv-opts* {:crux/module `xodus/->kv-store, :db-dir-suffix "xodus"})
(def ^:dynamic *kv-opts* {:xtdb/module `xodus/->kv-store, :db-dir-suffix "xodus"})

(defn with-kv-store* [f]
(let [db-dir (cio/create-tmpdir "kv-store")]
Expand Down