diff --git a/src/clj/fluree/db/api.cljc b/src/clj/fluree/db/api.cljc index 3faeffd01..d38353f80 100644 --- a/src/clj/fluree/db/api.cljc +++ b/src/clj/fluree/db/api.cljc @@ -11,14 +11,13 @@ [clojure.core.async :as async :refer [go cache-size cache-max-mb)] @@ -116,12 +111,13 @@ (go (let [conn-id (str (random-uuid)) state (connection/blank-state) - nameservices* (util/sequential - (or nameservices (default-file-nameservice storage-path))) lru-cache-atom* (or lru-cache-atom (default-lru-cache cache-max-mb)) store* (or store - (file-storage/open storage-path))] + (file-storage/open storage-path)) + nameservices* (-> nameservices + (or (storage-ns/start "fluree:file://" store* true)) + util/sequential)] ;; TODO - need to set up monitor loops for async chans (map->FileConnection {:id conn-id :store store* diff --git a/src/clj/fluree/db/conn/ipfs.cljc b/src/clj/fluree/db/conn/ipfs.cljc index b874fae26..4d5c74243 100644 --- a/src/clj/fluree/db/conn/ipfs.cljc +++ b/src/clj/fluree/db/conn/ipfs.cljc @@ -10,7 +10,8 @@ [clojure.core.async :as async :refer [chan]] [fluree.db.serde.json :refer [json-serde]] [fluree.db.nameservice.ipns :as ns-ipns] - [fluree.db.nameservice.filesystem :as ns-filesystem] + [fluree.db.nameservice.storage-backed :as storage-ns] + [fluree.db.storage.file :as file-storage] [fluree.db.conn.cache :as conn-cache] [fluree.db.storage :as storage]) #?(:clj (:import (java.io Writer)))) @@ -95,8 +96,8 @@ (defn default-file-nameservice [{:keys [path base-address sync?]}] - (ns-filesystem/initialize path {:base-address base-address - :sync? sync?})) + (let [ns-store (file-storage/open path)] + (storage-ns/start base-address ns-store sync?))) (defn connect "Creates a new IPFS connection. diff --git a/src/clj/fluree/db/conn/memory.cljc b/src/clj/fluree/db/conn/memory.cljc index e0ac1d545..77a1de762 100644 --- a/src/clj/fluree/db/conn/memory.cljc +++ b/src/clj/fluree/db/conn/memory.cljc @@ -2,13 +2,12 @@ (:require [clojure.core.async :as async :refer [go]] [fluree.db.flake.index.storage :as index-storage] [fluree.db.flake.index :as index] - [fluree.db.nameservice.memory :as ns-memory] + [fluree.db.nameservice.storage-backed :as storage-ns] [fluree.db.util.core :as util] [fluree.db.util.log :as log :include-macros true] [fluree.db.connection :as connection] [fluree.db.util.async :refer [cache-size cache-max-mb) lru-cache-atom (or lru-cache-atom (atom (conn-cache/create-lru-cache cache-size)))] diff --git a/src/clj/fluree/db/conn/s3.clj b/src/clj/fluree/db/conn/s3.clj index c81802301..91df29cee 100644 --- a/src/clj/fluree/db/conn/s3.clj +++ b/src/clj/fluree/db/conn/s3.clj @@ -1,7 +1,7 @@ (ns fluree.db.conn.s3 (:require [cognitect.aws.client.api :as aws] [clojure.string :as str] - [fluree.db.nameservice.s3 :as ns-s3] + [fluree.db.nameservice.storage-backed :as storage-ns] [clojure.core.async :as async :refer [go]] [fluree.db.conn.cache :as conn-cache] [fluree.db.connection :as connection] @@ -91,28 +91,21 @@ (binding [*out* w] (pr (connection/printer-map conn)))) -(defn default-S3-nameservice - "Returns S3 nameservice or will throw if storage-path generates an exception." - [s3-client s3-bucket s3-prefix] - (ns-s3/initialize s3-client s3-bucket s3-prefix)) - (defn connect "Create a new S3 connection." [{:keys [defaults parallelism s3-endpoint s3-bucket s3-prefix lru-cache-atom cache-max-mb serializer nameservices] :or {serializer (json-serde)} :as _opts}] (go - (let [aws-opts (cond-> {:api :s3} - s3-endpoint (assoc :endpoint-override s3-endpoint)) - client (aws/client aws-opts) - conn-id (str (random-uuid)) + (let [conn-id (str (random-uuid)) state (connection/blank-state) - nameservices* (util/sequential - (or nameservices (default-S3-nameservice client s3-bucket s3-prefix))) + s3-store (s3-storage/open s3-bucket s3-prefix s3-endpoint) + nameservices* (-> nameservices + (or (storage-ns/start "fluree:s3://" s3-store true)) + util/sequential) cache-size (conn-cache/memory->cache-size cache-max-mb) lru-cache-atom (or lru-cache-atom - (atom (conn-cache/create-lru-cache cache-size))) - s3-store (s3-storage/open s3-bucket s3-prefix s3-endpoint)] + (atom (conn-cache/create-lru-cache cache-size)))] (map->S3Connection {:id conn-id :store s3-store :state state diff --git a/src/clj/fluree/db/json_ld/api.cljc b/src/clj/fluree/db/json_ld/api.cljc index d1b546b84..edc4a6889 100644 --- a/src/clj/fluree/db/json_ld/api.cljc +++ b/src/clj/fluree/db/json_ld/api.cljc @@ -19,7 +19,7 @@ [fluree.db.util.log :as log] [fluree.db.query.api :as query-api] [fluree.db.query.range :as query-range] - [fluree.db.nameservice.core :as nameservice] + [fluree.db.nameservice :as nameservice] [fluree.db.connection :refer [notify-ledger]] [fluree.db.json-ld.credential :as cred] [fluree.db.reasoner :as reasoner] diff --git a/src/clj/fluree/db/json_ld/migrate/sid.cljc b/src/clj/fluree/db/json_ld/migrate/sid.cljc index 3f686e29d..80f570d7b 100644 --- a/src/clj/fluree/db/json_ld/migrate/sid.cljc +++ b/src/clj/fluree/db/json_ld/migrate/sid.cljc @@ -10,7 +10,7 @@ [fluree.db.json-ld.iri :as iri] [fluree.db.json-ld.reify :as reify] [fluree.db.ledger.json-ld :as jld-ledger] - [fluree.db.nameservice.core :as nameservice] + [fluree.db.nameservice :as nameservice] [fluree.db.query.exec.update :as update] [fluree.db.util.async :refer [> (connection/-nameservices conn) - (some #(ns-proto/-alias % db-alias))))) + (some #(nameservice/-alias % db-alias))))) ;; TODO - once we have a different delimiter than `/` for branch/t-value this can simplified (defn address->alias diff --git a/src/clj/fluree/db/nameservice/core.cljc b/src/clj/fluree/db/nameservice.cljc similarity index 53% rename from src/clj/fluree/db/nameservice/core.cljc rename to src/clj/fluree/db/nameservice.cljc index 1edcf12e3..8d6f534d2 100644 --- a/src/clj/fluree/db/nameservice/core.cljc +++ b/src/clj/fluree/db/nameservice.cljc @@ -1,13 +1,97 @@ -(ns fluree.db.nameservice.core - (:refer-clojure :exclude [exists?]) +(ns fluree.db.nameservice + (:refer-clojure :exclude [-lookup exists?]) (:require [clojure.string :as str] [fluree.db.connection :as connection] - [fluree.db.nameservice.proto :as ns-proto] [fluree.db.util.async :refer [> (get record "branches") + (some #(when (= (get % "@id") branch-iri) + (get % "address")))))) + +(defn address-path + [address] + (let [[_ _ path] (str/split address #":")] + (subs path 2))) + +(defn address->alias + [ledger-address] + (-> ledger-address + address-path + (str/split #"/") + (->> (drop-last 2) ; branch-name, head + (str/join #"/")))) + +(defn extract-branch + "Splits a given namespace address into its nameservice and branch parts. + Returns two-tuple of [nameservice branch]. + If no branch is found, returns nil as branch value and original ns-address as the nameservice." + [ns-address] + (if (str/ends-with? ns-address ")") + (let [[_ ns branch] (re-matches #"(.*)\((.*)\)" ns-address)] + [ns branch]) + [ns-address nil])) + +(defn resolve-address + "Resolves a provided namespace address, which might be relative or absolute, + into three parts returned as a map: + - :alias - ledger alias + - :branch - branch (or nil if default) + - :address - absolute namespace address (including branch if provided) + If 'branch' parameter is provided will always use it as the branch regardless + of if a branch is specificed in the ns-address." + [base-address ns-address branch] + (let [[ns-address* extracted-branch] (extract-branch ns-address) + branch* (or branch extracted-branch) + absolute? (str/starts-with? ns-address base-address) + [ns-address** alias] (if absolute? + [ns-address* (subs ns-address* (count base-address))] + [(str base-address ns-address*) ns-address*])] + {:alias alias + :branch branch* + :address (if branch* + (str ns-address** "(" branch* ")") + ns-address*)})) + (defn nameservices [conn] (connection/-nameservices conn)) @@ -19,7 +103,7 @@ (defn ns-address "Returns async channel" [nameservice ledger-alias branch] - (ns-proto/-address nameservice ledger-alias {:branch branch})) + (-address nameservice ledger-alias branch)) (defn addresses "Retrieve address for each nameservices based on a relative ledger-alias. @@ -60,10 +144,10 @@ (go-try (loop [nameservices* nameservices] (when-let [ns (first nameservices*)] - (let [sync? (ns-proto/-sync? ns)] + (let [sync? (-sync? ns)] (if sync? - (> ledger-alias - (file-path local-path) - fs/read-file)) - -(defn address - [base-address ledger-alias _opts] - (when base-address - (str base-address ledger-alias))) - -(defn write-ns-record - [ns-record local-path alias] - (let [p-chan (async/promise-chan) ;; return value - write-path (file-path local-path alias) - record-bs (try* (json/stringify-UTF8 ns-record) - (catch* e - (log/error "Error json-encoding nameservice record for ledger: " alias - "with exception: " (ex-message e) - "Original record where error occurred: " ns-record) - ;; return exception, don't throw.. will check for it below - (ex-info (str "Exception encoding file nameservice file for ledger: " alias) - {:status 500 :error :db/invalid-commit})))] - (if (util/exception? record-bs) - (async/put! p-chan record-bs) - #?(:clj (async/thread - (try - (fs/write-file write-path record-bs) - (async/put! p-chan write-path) - (catch Exception e - (log/error (str "Exception writing file nameservice file for ledger: " alias - "with exception: " (ex-message e)) - e) - (async/put! p-chan (ex-info (str "Exception writing file nameservice file for ledger: " alias - " with exception: " (ex-message e)) - {:status 500 :error :db/invalid-commit} - e))))) - :cljs (try* - (fs/write-file write-path record-bs) - (async/put! p-chan write-path) - (catch* e (async/put! p-chan e))))) - p-chan)) - -(defn push! - "Pushes updated commit to internal format stored on file system" - [local-path base-address {alias "alias" - :as commit-json-ld}] - (let [ns-address (address base-address alias nil) - record (ns-record ns-address commit-json-ld)] - ;; write-ns-record returns a promise chan, with path of file if successful or exception - (write-ns-record record local-path alias))) - - -(defn extract-branch - "Splits a given namespace address into its nameservice and branch parts. - Returns two-tuple of [nameservice branch]. - If no branch is found, returns nil as branch value and original ns-address as the nameservice." - [ns-address] - (if (str/ends-with? ns-address ")") - (let [[_ ns branch] (re-matches #"(.*)\((.*)\)" ns-address)] - [ns branch]) - [ns-address nil])) - -(defn resolve-address - "Resolves a provided namespace address, which might be relative or absolute, - into three parts returned as a map: - - :alias - ledger alias - - :branch - branch (or nil if default) - - :address - absolute namespace address (including branch if provided) - If 'branch' parameter is provided will always use it as the branch regardless - of if a branch is specificed in the ns-address." - [base-address ns-address branch] - (let [[ns-address* extracted-branch] (extract-branch ns-address) - branch* (or branch extracted-branch) - absolute? (str/starts-with? ns-address base-address) - [ns-address** alias] (if absolute? - [ns-address* (subs ns-address* (count base-address))] - [(str base-address ns-address*) ns-address*])] - {:alias alias - :branch branch* - :address (if branch* - (str ns-address** "(" branch* ")") - ns-address*)})) - -(defn retrieve-ns-record - "Loads nameservice record from disk given a local path and ledger alias" - [local-path ledger-alias] - (go-try - (let [ns-record (> (get ns-record "branches") - (some #(when (= (get % "@id") branch-iri) - (get % "address")))))) - -(defn convert-legacy-ns-record - [alias commit-address local-path legacy-path] - (async/go - (let [ns-address (str "fluree:file://" alias) - ns-record (ns-record ns-address {"address" commit-address "alias" alias, "branch" "main"})] - (let [successful? (async/ (address-path ledger-address) - (str/split #"/") - (->> (drop-last 2) ; branch-name, head - (str/join #"/")))) - (-close [_] true)) - - -(defn initialize - "Initializes nameservice that will manage commit data via a - local file system in the directory provided by `path` parameter. - This ns can publish any ns address in newly generated commits by - supplying an `address-base` parameter which will be appended with - the ledger alias. The default value for 'address-base' is - `fluree:file://`. - If you wanted the nameservice to show up in the commit metadata - as https://data.mydomain.com/ and to be stored - in the file system at path /opt/fluree/ns/, - then you would set: - - path = /opt/fluree/ns (directory, so trailing slash doesn't matter) - - address-base = https://data.mydomain.com/ (trailing slash important) - address-base can be anything, but when appended with the ledger alias - should be a URI/IRI. Ledger names are relative, e.g. 'my/ledger/name', - so the address-base should include a trailing '/' if a URL, or a - trailing ':' if in the form of a URN. - address-base can be 'nil' if you don't want the address - published as part of the commit metadata's nameservices." - ([path] (initialize path nil)) - ([path {:keys [sync? base-address] - :or {base-address "fluree:file://"}}] - (let [local-path (fs/local-path path) - sync? (if (some? sync?) - sync? - true)] - (map->FileNameService {:local-path local-path - :sync? sync? - :base-address base-address})))) diff --git a/src/clj/fluree/db/nameservice/ipns.cljc b/src/clj/fluree/db/nameservice/ipns.cljc index 3d8961b0c..385b4541c 100644 --- a/src/clj/fluree/db/nameservice/ipns.cljc +++ b/src/clj/fluree/db/nameservice/ipns.cljc @@ -1,6 +1,6 @@ (ns fluree.db.nameservice.ipns (:require [clojure.string :as str] - [fluree.db.nameservice.proto :as ns-proto] + [fluree.db.nameservice :as nameservice] [fluree.db.util.async :refer [> (map #(get % "id") nameservice-iris) - (some #(when (re-matches #"^fluree:memory:.+" %) %))) - commit-path (address-path commit-address) - head-path (address-path my-ns-iri)] - (swap! data-atom - (fn [state] - (let [commit (get state commit-path)] - (when-not commit - (throw (ex-info (str "Unable to locate commit in memory, cannot push!: " commit-address) - {:status 500 :error :db/invalid-db}))) - (log/debug "pushing:" my-ns-iri "referencing commit:" commit-address) - (let [commit (assoc commit "address" commit-address)] - (assoc state head-path commit))))) - #?(:cljs (and platform/BROWSER (.setItem js/localStorage address-path commit-path))) - commit-data))) - -(defn lookup - [data-atom ledger-alias] - (go #?(:clj - (when-let [head-commit (read-address data-atom ledger-alias)] - (-> head-commit (get "address"))) - - :cljs - (if platform/BROWSER - (when-let [head-commit (read-address data-atom ledger-alias)] - (memory-address head-commit)) - (throw (ex-info (str "Cannot lookup ledger address with memory connection: " - ledger-alias) - {:status 500 :error :db/invalid-ledger})))))) - -(defn ledger-list - [state-atom opts] - (go (-> @state-atom keys))) - -(defn address - [ledger-alias {:keys [branch] :as _opts}] - (go (memory-address (str ledger-alias "/" (name branch) "/head")))) - -(defrecord MemoryNameService - [state-atom sync?] - ns-proto/Publisher - (-push [_ commit-data] (push! state-atom commit-data)) - - ns-proto/iNameService - (-lookup [_ ledger-alias] (lookup state-atom ledger-alias)) - (-lookup [_ ledger-alias opts] (lookup state-atom ledger-alias)) ;; TODO - doesn't support branches yet - (-sync? [_] sync?) - (-address [_ ledger-alias opts] - (address ledger-alias opts)) - (-alias [_ ledger-address] - (-> (address-path ledger-address) - (str/split #"/") - (->> (drop 2) - (str/join "/")))) - (-close [nameservice] (reset! state-atom {}))) - - -(defn initialize - [state-atom] - (map->MemoryNameService {:state-atom state-atom - :sync? true})) diff --git a/src/clj/fluree/db/nameservice/proto.cljc b/src/clj/fluree/db/nameservice/proto.cljc deleted file mode 100644 index aae675c87..000000000 --- a/src/clj/fluree/db/nameservice/proto.cljc +++ /dev/null @@ -1,17 +0,0 @@ -(ns fluree.db.nameservice.proto - (:refer-clojure :exclude [-lookup])) - - -(defprotocol iNameService - (-lookup [nameservice ledger-address] [nameservice ledger-alias opts] "Performs lookup operation on ledger alias and returns map of latest commit and other metadata") - (-sync? [nameservice] "Indicates if nameservice updates should be performed synchronously, before commit is finalized. Failure will cause commit to fail") - (-close [nameservice] "Closes all resources for this nameservice") - (-alias [nameservice ledger-address] "Given a ledger address, returns ledger's default alias name else nil, if not avail") - (-address [nameservice ledger-alias key] "Returns full nameservice address/iri which will get published in commit. If 'private', return nil.")) - -(defprotocol Publisher - (-push [nameservice commit-data] "Pushes new commit to nameservice.")) - -(defprotocol Publication - (-subscribe [nameservice ledger-alias callback] "Creates a subscription to nameservice(s) for ledger events. Will call callback with event data as received.") - (-unsubscribe [nameservice ledger-alias] "Unsubscribes to nameservice(s) for ledger events")) diff --git a/src/clj/fluree/db/nameservice/remote.cljc b/src/clj/fluree/db/nameservice/remote.cljc index 9d693fe32..ce6c1b4de 100644 --- a/src/clj/fluree/db/nameservice/remote.cljc +++ b/src/clj/fluree/db/nameservice/remote.cljc @@ -1,5 +1,5 @@ (ns fluree.db.nameservice.remote - (:require [fluree.db.nameservice.proto :as ns-proto] + (:require [fluree.db.nameservice :as nameservice] [fluree.db.method.remote.core :as remote] [clojure.core.async :as async :refer [go go-loop]] [fluree.db.util.core :as util #?(:clj :refer :cljs :refer-macros) [try* catch*]] @@ -68,7 +68,7 @@ (defrecord RemoteNameService [conn-state server-state sync? msg-in msg-out] - ns-proto/iNameService + nameservice/iNameService (-lookup [_ ledger-address] (remote-lookup conn-state server-state ledger-address)) (-lookup [_ ledger-address opts] (remote-lookup conn-state server-state ledger-address)) ;; TODO - doesn't support branch yet (-sync? [_] sync?) @@ -82,7 +82,7 @@ (async/close! msg-in) (async/close! msg-out)) - ns-proto/Publication + nameservice/Publication (-subscribe [_ ledger-alias callback] (subscribe conn-state ledger-alias callback)) (-unsubscribe [_ ledger-alias] (unsubscribe conn-state ledger-alias))) @@ -98,5 +98,5 @@ :sync? true}) websocket (async/> (map #(get % "id") nameservices) - (some #(when (re-matches #"^fluree:s3:.+" %) %))) - commit-path (s3/address-path s3-bucket s3-prefix commit-address false) - head-path (s3/address-path s3-bucket s3-prefix my-ns-iri)] - (->> (.getBytes ^String commit-path) - (s3/write-s3-data s3-client s3-bucket s3-prefix head-path) - :address)))) - -(defn lookup-alias - [s3-client s3-bucket s3-prefix ledger-alias] - (go (s3/s3-address s3-bucket s3-prefix ( ledger-address (->> (s3/address-path s3-bucket s3-prefix)) (str/split #"/") - (->> (drop-last 2) (str/join #"/")))) - (-close [_] true)) - - -(defn initialize - [s3-client s3-bucket s3-prefix] - (map->S3NameService {:s3-client s3-client - :s3-bucket s3-bucket - :s3-prefix s3-prefix - :sync? true})) diff --git a/src/clj/fluree/db/nameservice/storage_backed.cljc b/src/clj/fluree/db/nameservice/storage_backed.cljc new file mode 100644 index 000000000..6dc852e15 --- /dev/null +++ b/src/clj/fluree/db/nameservice/storage_backed.cljc @@ -0,0 +1,45 @@ +(ns fluree.db.nameservice.storage-backed + (:require [clojure.core.async :refer [go]] + [fluree.db.storage :as storage] + [fluree.db.nameservice :as nameservice] + [fluree.db.util.async :refer [StorageBackedNameService address-prefix store sync?)) diff --git a/src/clj/fluree/db/query/api.cljc b/src/clj/fluree/db/query/api.cljc index 160ebbfb9..e297a9576 100644 --- a/src/clj/fluree/db/query/api.cljc +++ b/src/clj/fluree/db/query/api.cljc @@ -16,9 +16,8 @@ [fluree.db.query.fql.syntax :as syntax] [fluree.db.util.core :as util :refer [try* catch*]] [fluree.db.util.async :refer [ root + (full-path path) + (fs/write-file bytes))) + + (read-bytes [_ path] + (-> root + (full-path path) + fs/read-file))) (defn open [root-path] diff --git a/src/clj/fluree/db/storage/memory.cljc b/src/clj/fluree/db/storage/memory.cljc index 4a70ff913..23b09a13c 100644 --- a/src/clj/fluree/db/storage/memory.cljc +++ b/src/clj/fluree/db/storage/memory.cljc @@ -42,7 +42,16 @@ (exists? [_ address] (go (let [path (:local (storage/parse-address address))] - (contains? @contents path))))) + (contains? @contents path)))) + + storage/ByteStore + (write-bytes [_ path bytes] + (go + (swap! contents assoc path bytes))) + + (read-bytes [_ path] + (go + (get @contents path)))) (defn create [] diff --git a/src/clj/fluree/db/storage/s3.clj b/src/clj/fluree/db/storage/s3.clj index 99e321a3b..bc2430645 100644 --- a/src/clj/fluree/db/storage/s3.clj +++ b/src/clj/fluree/db/storage/s3.clj @@ -36,11 +36,20 @@ (exists? [_ address] (s3/s3-key-exists? client bucket prefix address)) + ;; TODO: Implement `list` and `delete` methods. We should never throw + ;; exceptions for protocol implementations (list [_ prefix] (throw (ex-info "Unsupported operation S3Store method: list." {:prefix prefix}))) (delete [_ address] - (throw (ex-info "Unsupported operation S3Store method: delete." {:prefix prefix})))) + (throw (ex-info "Unsupported operation S3Store method: delete." {:prefix prefix}))) + + storage/ByteStore + (write-bytes [_ path bytes] + (s3/write-s3-data client bucket prefix path bytes)) + + (read-bytes [_ path] + (s3/read-s3-data client bucket prefix path))) (defn open ([bucket prefix] diff --git a/src/clj/fluree/db/util/filesystem.cljc b/src/clj/fluree/db/util/filesystem.cljc index c8e31a06b..7efd5297c 100644 --- a/src/clj/fluree/db/util/filesystem.cljc +++ b/src/clj/fluree/db/util/filesystem.cljc @@ -23,8 +23,7 @@ (with-open [out (io/output-stream (io/file path))] (.write out val)) (catch Exception e - (log/error (str "Unable to create storage directory: " path - " with error: " (.getMessage e) ".")) + (log/error e "Unable to create storage directory:" path ".") (log/error (str "Fatal Error, shutting down!")) (System/exit 1)))) (catch Exception e (throw e)))) @@ -39,8 +38,7 @@ (try (fs/writeFileSync path val) (catch :default e - (log/error (str "Unable to write file to path " path - " with error: " ^String (.-message e) ".")) + (log/error e "Unable to write file to path" path ".") (log/error (str "Fatal Error, shutting down! " {"errno" ^String (.-errno e) "syscall" ^String (.-syscall e) @@ -48,8 +46,7 @@ "path" (.-path e)})) (js/process.exit 1))) (catch :default e - (log/error (str "Unable to create storage directory: " path - " with error: " ^String (.-message e) ".")) + (log/error e "Unable to create storage directory:" path ".") (log/error (str "Fatal Error, shutting down!")) (js/process.exit 1))) (throw (ex-info "Error writing file." diff --git a/test/fluree/db/query/misc_queries_test.clj b/test/fluree/db/query/misc_queries_test.clj index d4e1a0e31..0f7570c7b 100644 --- a/test/fluree/db/query/misc_queries_test.clj +++ b/test/fluree/db/query/misc_queries_test.clj @@ -176,40 +176,34 @@ (is (= [["fluree:db:sha256:bvktsmao5ivreittrb4scd3hkc4qkefhqg42va3npk64dbmss4qt" :f/address "fluree:memory://9269ae5eb352ef74fb9c78c0c8b18740f8ac497262e6dbb015fdec89e8bc7a1e"] - ["fluree:db:sha256:bvktsmao5ivreittrb4scd3hkc4qkefhqg42va3npk64dbmss4qt" - :f/flakes - 11] + ["fluree:db:sha256:bvktsmao5ivreittrb4scd3hkc4qkefhqg42va3npk64dbmss4qt" :f/flakes 11] ["fluree:db:sha256:bvktsmao5ivreittrb4scd3hkc4qkefhqg42va3npk64dbmss4qt" :f/previous "fluree:db:sha256:beuoec4c6zqxfjglld3evwjdtavsdktncoh6bbxiz677cc4zz3qr"] - ["fluree:db:sha256:bvktsmao5ivreittrb4scd3hkc4qkefhqg42va3npk64dbmss4qt" - :f/size - 1076] - ["fluree:db:sha256:bvktsmao5ivreittrb4scd3hkc4qkefhqg42va3npk64dbmss4qt" - :f/t - 1] - ["fluree:commit:sha256:bccenzjhhlj634hgtkl6iamyxisxooxhw4xafoujdnsagituu3wr" + ["fluree:db:sha256:bvktsmao5ivreittrb4scd3hkc4qkefhqg42va3npk64dbmss4qt" :f/size 1076] + ["fluree:db:sha256:bvktsmao5ivreittrb4scd3hkc4qkefhqg42va3npk64dbmss4qt" :f/t 1] + ["fluree:commit:sha256:bbvx22pr244fz6p3d35qmlxrrekzzspvbzobi6mael5q5trr63jet" "https://www.w3.org/2018/credentials#issuer" "did:fluree:TfCzWTrXqF16hvKGjcYiLxRoYJ1B8a6UMH6"] - ["fluree:commit:sha256:bccenzjhhlj634hgtkl6iamyxisxooxhw4xafoujdnsagituu3wr" + ["fluree:commit:sha256:bbvx22pr244fz6p3d35qmlxrrekzzspvbzobi6mael5q5trr63jet" :f/address - "fluree:memory://af10694c6008358ec9070a52dc8246c99981f82511f207f42dfd3990630f117b"] - ["fluree:commit:sha256:bccenzjhhlj634hgtkl6iamyxisxooxhw4xafoujdnsagituu3wr" + "fluree:memory://620f646cc34bde06470c84b5caa03bd67b164daab7382b4e6e3e826b72e0abfc"] + ["fluree:commit:sha256:bbvx22pr244fz6p3d35qmlxrrekzzspvbzobi6mael5q5trr63jet" :f/alias "query/everything"] - ["fluree:commit:sha256:bccenzjhhlj634hgtkl6iamyxisxooxhw4xafoujdnsagituu3wr" + ["fluree:commit:sha256:bbvx22pr244fz6p3d35qmlxrrekzzspvbzobi6mael5q5trr63jet" :f/branch "main"] - ["fluree:commit:sha256:bccenzjhhlj634hgtkl6iamyxisxooxhw4xafoujdnsagituu3wr" + ["fluree:commit:sha256:bbvx22pr244fz6p3d35qmlxrrekzzspvbzobi6mael5q5trr63jet" :f/data "fluree:db:sha256:bvktsmao5ivreittrb4scd3hkc4qkefhqg42va3npk64dbmss4qt"] - ["fluree:commit:sha256:bccenzjhhlj634hgtkl6iamyxisxooxhw4xafoujdnsagituu3wr" + ["fluree:commit:sha256:bbvx22pr244fz6p3d35qmlxrrekzzspvbzobi6mael5q5trr63jet" :f/previous - "fluree:commit:sha256:bvvou3uvnd6ffhehsrw23mw4w3fux5jbpacko2ecosb2nzxkfu5v"] - ["fluree:commit:sha256:bccenzjhhlj634hgtkl6iamyxisxooxhw4xafoujdnsagituu3wr" + "fluree:commit:sha256:bbyuz7tgv5akbruljy4czxu47izkeanawa5fqyt7kwezhckp3g5ew"] + ["fluree:commit:sha256:bbvx22pr244fz6p3d35qmlxrrekzzspvbzobi6mael5q5trr63jet" :f/time 720000] - ["fluree:commit:sha256:bccenzjhhlj634hgtkl6iamyxisxooxhw4xafoujdnsagituu3wr" + ["fluree:commit:sha256:bbvx22pr244fz6p3d35qmlxrrekzzspvbzobi6mael5q5trr63jet" :f/v 1] [:ex/alice :type :ex/User] diff --git a/test/fluree/db/query/stable_hashes_test.clj b/test/fluree/db/query/stable_hashes_test.clj index 391e95dd4..6939df9b9 100644 --- a/test/fluree/db/query/stable_hashes_test.clj +++ b/test/fluree/db/query/stable_hashes_test.clj @@ -28,10 +28,10 @@ :schema/age 30}]}) db1 @(fluree/commit! ledger db0)] (testing "stable commit id" - (is (= "fluree:commit:sha256:bb5oiv3ppsasnxmhralghjf5q4ow3llo2nncn2ju47t3ttlh24sg5" + (is (= "fluree:commit:sha256:bbj46ne3quoemnp4n6owbms43bs422hm5q2jvrteixowuqztcqdn3" (get-in db1 [:commit :id])))) (testing "stable commit address" - (is (= "fluree:memory://35087de56968027e9c6cdb1ecef6351e21e9252884210f3e84ad83f3fff64378" + (is (= "fluree:memory://3726ea22c42670b6a41244490426960902d29b2b01d61f22cbbe9ddc980140e8" (get-in db1 [:commit :address])))) (testing "stable db id" (is (= "fluree:db:sha256:bvktsmao5ivreittrb4scd3hkc4qkefhqg42va3npk64dbmss4qt"