(array-list-write-cursor wal i)Returns a cursor to slot i in the array list. Throws if index is out of bounds.
Returns a cursor to slot i in the array list. Throws if index is out of bounds.
(clojure-key-hashing? jdb)True when the header of jdb says its keys use the Clojure encoding (clj1).
Any other header means the raw string hashing shared with other languages.
True when the header of `jdb` says its keys use the Clojure encoding (clj1). Any other header means the raw string hashing shared with other languages.
(coll->ArrayListCursor! cursor coll)Converts a Clojure collection to a XitDB ArrayList cursor. Handles nested maps and collections recursively. Returns the cursor of the created WriteArrayList.
Sorted maps/sets and XITDB wrappers are also map?/set?/sequential?,
so they are delegated to v->slot! (which checks those types first) before
the generic hash branches.
Converts a Clojure collection to a XitDB ArrayList cursor. Handles nested maps and collections recursively. Returns the cursor of the created WriteArrayList. Sorted maps/sets and XITDB wrappers are also `map?`/`set?`/`sequential?`, so they are delegated to `v->slot!` (which checks those types first) before the generic hash branches.
(db-key-hash jdb v)Returns the stable hash of key v, using an independent engine digest.
The file's header picks the hashing. A file that is not clj1 (see
clojure-key-hashing?) hashes a string as its raw UTF-8 bytes, as the Java
library's put(String) does, and throws IllegalArgumentException for
everything else, since other languages could not look such a key up.
In a clj1 file, nil hashes to all-zero bytes. Collections and doubles use the
canonical encoding in xitdb.util.key-hash, which is type-aware and independent
of printer settings and iteration order. The remaining scalar key types hash
their format tag followed by a text form: epoch milliseconds for Date and
str for everything else. Throws IllegalArgumentException for other types.
Returns the stable hash of key `v`, using an independent engine digest. The file's header picks the hashing. A file that is not clj1 (see `clojure-key-hashing?`) hashes a string as its raw UTF-8 bytes, as the Java library's `put(String)` does, and throws IllegalArgumentException for everything else, since other languages could not look such a key up. In a clj1 file, nil hashes to all-zero bytes. Collections and doubles use the canonical encoding in `xitdb.util.key-hash`, which is type-aware and independent of printer settings and iteration order. The remaining scalar key types hash their format tag followed by a text form: epoch milliseconds for Date and `str` for everything else. Throws IllegalArgumentException for other types.
(db-lookup-hash jdb v)The hash for reading or removing key v, or nil when the file cannot hold it.
Only a non-string key in a compat file gives nil, so those lookups find nothing
and those removals do nothing. In a clj1 file this is exactly db-key-hash,
including its IllegalArgumentException for unsupported types.
The hash for reading or removing key `v`, or nil when the file cannot hold it. Only a non-string key in a compat file gives nil, so those lookups find nothing and those removals do nothing. In a clj1 file this is exactly `db-key-hash`, including its IllegalArgumentException for unsupported types.
(default-sorted-comparator? coll)True if coll (a PersistentTreeMap or PersistentTreeSet) is ordered in a way
the engine can honour with its fixed unsigned byte ordering: either Clojure's
natural ordering (no custom comparator) or sorted-key/key-comparator, which
is that byte ordering and is what materialize stamps onto the collections
it rebuilds. Any other custom comparator is rejected.
True if `coll` (a PersistentTreeMap or PersistentTreeSet) is ordered in a way the engine can honour with its fixed unsigned byte ordering: either Clojure's natural ordering (no custom comparator) or `sorted-key/key-comparator`, which *is* that byte ordering and is what `materialize` stamps onto the collections it rebuilds. Any other custom comparator is rejected.
(keypath-cursor cursor keypath)Recursively goes to keypath and returns the write cursor
Recursively goes to keypath and returns the write cursor
(list->LinkedArrayListCursor! cursor coll)Converts a Clojure list or seq-like collection to a XitDB LinkedArrayList cursor. Optimized for sequential access collections rather than random access ones.
Sorted maps/sets and XITDB wrappers are also map?/set?/sequential?,
so they are delegated to v->slot! (which checks those types first) before
the generic hash branches.
Converts a Clojure list or seq-like collection to a XitDB LinkedArrayList cursor. Optimized for sequential access collections rather than random access ones. Sorted maps/sets and XITDB wrappers are also `map?`/`set?`/`sequential?`, so they are delegated to `v->slot!` (which checks those types first) before the generic hash branches.
(map->WriteHashMapCursor! cursor m)Writes a Clojure map to a XitDB WriteHashMap.
The map is counted in a clj1 file and plain otherwise, since plain is what other
languages' ReadHashMap expects. Returns the cursor of the created WriteHashMap.
Writes a Clojure map to a XitDB WriteHashMap. The map is counted in a clj1 file and plain otherwise, since plain is what other languages' `ReadHashMap` expects. Returns the cursor of the created WriteHashMap.
(map-write-cursor whm key)Gets a write cursor for the specified key in a WriteHashMap. Creates the key if it doesn't exist.
Gets a write cursor for the specified key in a WriteHashMap. Creates the key if it doesn't exist.
(map-write-cursor-storing-key! whm key)Like map-write-cursor, but also stores key itself when the entry is
new. The hash-only putCursor never writes the key, so without this a
keypath write to an absent key would leave a keyless entry behind.
Like `map-write-cursor`, but also stores `key` itself when the entry is new. The hash-only `putCursor` never writes the key, so without this a keypath write to an absent key would leave a keyless entry behind.
(primitive-for v)Converts a Clojure primitive value to its corresponding XitDB representation. Handles strings, keywords, integers, booleans, and floats. Throws an IllegalArgumentException for unsupported types.
Converts a Clojure primitive value to its corresponding XitDB representation. Handles strings, keywords, integers, booleans, and floats. Throws an IllegalArgumentException for unsupported types.
(read-bytes-with-format-tag cursor)Reads a BYTES value (as a string) at cursor and converts it to a Clojure type.
Checks the formatTag at cursor to determine the type encoded in the bytes object and
converts the value to the respective Clojure type (eg. keyword, boolean, instant, date).
Supported types are in the global constant fmt-tag-value.
If there is no format tag (or it is unknown), returns the value as a string.
The value and the format tag are decoded as UTF-8, the encoding they are
written in, never with the JVM default charset.
Reads a `BYTES` value (as a string) at `cursor` and converts it to a Clojure type. Checks the `formatTag` at cursor to determine the type encoded in the bytes object and converts the value to the respective Clojure type (eg. keyword, boolean, instant, date). Supported types are in the global constant `fmt-tag-value`. If there is no format tag (or it is unknown), returns the value as a string. The value and the format tag are decoded as UTF-8, the encoding they are written in, never with the JVM default charset.
(set->WriteCursor! cursor s)Writes a Clojure set s to a XitDB WriteHashSet.
The set is counted in a clj1 file and plain otherwise, since plain is what other
languages' ReadHashSet expects. Returns the cursor of the created WriteHashSet.
Writes a Clojure set `s` to a XitDB WriteHashSet. The set is counted in a clj1 file and plain otherwise, since plain is what other languages' `ReadHashSet` expects. Returns the cursor of the created WriteHashSet.
(sorted-map->WriteSortedMapCursor! cursor m)Writes a Clojure sorted map m to a XitDB WriteSortedMap.
Keys are encoded with the order-preserving codec; values are written
recursively via v->slot!. Returns the cursor of the created WriteSortedMap.
Writes a Clojure sorted map `m` to a XitDB WriteSortedMap. Keys are encoded with the order-preserving codec; values are written recursively via `v->slot!`. Returns the cursor of the created WriteSortedMap.
(sorted-set->WriteSortedSetCursor! cursor s)Writes a Clojure sorted set s to a XitDB WriteSortedSet.
Members are encoded with the order-preserving codec. Returns the cursor of the
created WriteSortedSet.
Writes a Clojure sorted set `s` to a XitDB WriteSortedSet. Members are encoded with the order-preserving codec. Returns the cursor of the created WriteSortedSet.
(v->slot! cursor v)Converts a value to a XitDB slot. Handles WriteArrayList and WriteHashMap instances directly. Recursively processes Clojure maps and collections. Falls back to primitive conversion for other types.
Branch order matters. XITDB* wrapper types are also map?/set?/
sequential?, so they are unwrapped to the underlying Slotted first or they
would be deep-copied through the generic branches (and a sorted map/set would
come back as a hash one). Likewise a sorted map/set is checked before the
generic hash-map/hash-set branch that would otherwise shadow it.
Converts a value to a XitDB slot. Handles WriteArrayList and WriteHashMap instances directly. Recursively processes Clojure maps and collections. Falls back to primitive conversion for other types. Branch order matters. XITDB* wrapper types are also `map?`/`set?`/ `sequential?`, so they are unwrapped to the underlying Slotted first or they would be deep-copied through the generic branches (and a sorted map/set would come back as a hash one). Likewise a sorted map/set is checked before the generic hash-map/hash-set branch that would otherwise shadow it.
(write-cursor-for-key cursor current-key)Returns a write cursor to current-key inside the collection at cursor,
creating the entry when it is absent (for hash maps the key itself is stored
too, see map-write-cursor-storing-key!).
Sets have no member cursor: a set member is its own key. A hash-set member lives under the hash of its value and a sorted-set member is an immutable B-tree key, so writing a different value through a member cursor would leave the member filed under the wrong hash/key. Both throw IllegalArgumentException; membership changes go through conj/disj on the set itself.
Returns a write cursor to `current-key` inside the collection at `cursor`, creating the entry when it is absent (for hash maps the key itself is stored too, see `map-write-cursor-storing-key!`). Sets have no member cursor: a set member is its own key. A hash-set member lives under the hash of its value and a sorted-set member is an immutable B-tree key, so writing a different value through a member cursor would leave the member filed under the wrong hash/key. Both throw IllegalArgumentException; membership changes go through conj/disj on the set itself.
(xit-tag->keyword tag)Converts a XitDB Tag enum to a corresponding Clojure keyword.
Converts a XitDB Tag enum to a corresponding Clojure keyword.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |