Quick Start
Get up and running with Triplox quickly.
The easiest way to test Triplox is to just pull the docker image and start an in-memory or local node.
docker pull ghcr.io/fiv0/triplox:0.1.0-alpha.2docker run -p 5490:5490 ghcr.io/fiv0/triplox:0.1.0-alpha.2This will start a Triplox server with an in-memory DB to which you can connect at “localhost:5490”. If you want an persistent local node, you start the image with
docker run -p 5490:5490 -e TRIPLOX_STORAGE=local -v triplox-data:/var/lib/triplox ghcr.io/fiv0/triplox:0.1.0-alpha.2In case you are already convinced and want to deploy Triplox in a distributed setting I suggest you have a look at the Operations section.
There is also the option to run Triplox in dev mode which is particular useful for testing.
docker run -p 5490:5490 -e TRIPLOX_STORAGE=dev ghcr.io/fiv0/triplox:0.1.0-alpha.2In this case a new in-memory DB is created on every connection.
Afterwards you connect with your favorite client.
let node = ClientNode::connect("http://localhost:5490").await?;
// schemanode.execute_tx(vec![ TxOp::put([ (kw!(:db/ident), kw!(:name).into()), (kw!(:db/valueType), kw!(:db.type/string).into()), (kw!(:db/cardinality), kw!(:db.cardinality/one).into()), ]), TxOp::put([ (kw!(:db/ident), kw!(:age).into()), (kw!(:db/valueType), kw!(:db.type/long).into()), (kw!(:db/cardinality), kw!(:db.cardinality/one).into()), ]),]).await?;
// datanode.execute_tx(vec![ TxOp::put([ (kw!(:name), "alice".into()), (kw!(:age), 30_i64.into()), ]), TxOp::put([ (kw!(:name), "bob".into()), (kw!(:age), 25_i64.into()), ]),]).await?;
// querylet db = node.db().await?;let rows = db.query(r#"{:find [?e ?name ?age] :where [[?e :name ?name] [?e :age ?age]]}"#).await?;// => [[8796093022209, "alice", 30], [8796093022208, "bob", 25]](require '[xyz.triplox.api :as tc])
(def conn (tc/connect "localhost" 5490))
;; schema(tc/transact conn [{:db/ident :name :db/valueType :db.type/string :db/cardinality :db.cardinality/one} {:db/ident :age :db/valueType :db.type/long :db/cardinality :db.cardinality/one}])
;; data(tc/transact conn [{:name "alice" :age 30} {:name "bob" :age 25}])
;; query(def db (tc/db conn))(tc/q db '{:find [?e ?name ?age] :where [[?e :name ?name] [?e :age ?age]]});; => [[8796093022209 "alice" 30] [8796093022208 "bob" 25]]var node = TriploxNode.connect("localhost", 5490);
// schemanode.executeTx(list( new TxOp.Put(map( ":db/ident", kw(":name"), ":db/valueType", kw(":db.type/string"), ":db/cardinality", kw(":db.cardinality/one"))), new TxOp.Put(map( ":db/ident", kw(":age"), ":db/valueType", kw(":db.type/long"), ":db/cardinality", kw(":db.cardinality/one")))));
// datanode.executeTx(list( new TxOp.Put(map(":name", "alice", ":age", 30L)), new TxOp.Put(map(":name", "bob", ":age", 25L))));
// queryvar db = node.openDb();var rows = db.query(""" {:find [?e ?name ?age] :where [[?e :name ?name] [?e :age ?age]]} """);// => [[8796093022209, "alice", 30], [8796093022208, "bob", 25]]