Options - laforge49/aatree GitHub Wiki
The options map is used for deserializing EDN data, configuring AATree structures and databases. Note that the opts map is NOT serialized, so generally the same opts map should be specified for both creation and loading.
- Read String Options
- AATree Structure Options
- Closer Options
- Db-file Options
- Null Db Cache Options
- LRU Db Cache Options
- Db-agent Options
- Db-chan Options
- Calf Database Options
- Yearling Database Options
Read String Options
:readers
Use the :readers key to specify a map of tag symbols to data-reader functions to be considered before default-data-readers. When not supplied, only the default-data-readers will be used. This is used when deserializing the contents of a lazy data structure. (A read-string option.)
:default
Use the :default key to specify a function of two args that will, if present and no reader is found for a tag, be called with the tag and the value. This is used when deserializing the contents of a lazy data structure. (A read-string option.)
AATree Structure Options
The function (aatree.core.aa-opts aa) returns the options map that an aa structure is bound to.
:comparator
Sorted structures are, by default, sorted in native order using clojure.lang.RT/DEFAULT_COMPARATOR. This can be overridden with a java.util.Comparator passed in the opts map with the :comparator key. The effect is similar to the comparator parameter when calling sorted-map-by.
Only one comparator can be specified, even when nesting sorted structures within other structures.
:factory-registry
Serialization and deserialization are controlled by a registry of factories. The default registry is aatree.lazy-nodes.default-factory-registry. This can be overridden with an aatree.lazy-nodes.factory-registry passed in the opts map with the :factory-registry key. This is an advanced feature requiring a good understanding of aatree-lazy-nodes.
:aacontext
Used internally to provide serialization / deserialization logic specific to structures like AAVector and AAMap.
:new-sorted-map
A factory function for creating sorted maps.
:new-vector
A factory function for creating vectors.
:new-sorted-set
A factory function for creating sorted sets.
:byte-length
A function which returns the size, in bytes, of an aa structure.
:node-read
A function to deserialize a node from a byte buffer.
:load-vector
A function to load a vector.
:load-sorted-map
A function to load a sorted map.
:load-sorted-set
A function to load a sorted set.
:as-reference
A function which converts a node into a reference to a disk block.
Closer Options
These are the options defined by the Closer trait:
:closer-fsa
An atom holding a list of close functions.
Db-file Options
These are the options defined by the Db File trait:
:db-file-channel
The open FileChannel used by the database.
:db-file
The File object naming the database file.
:db-file-empty?
Returns true if the file is empty.
:db-file-read
A function to read from the file.
:db-file-write
A function to write to the file.
:db-file-write-root
A function which does a force/write/force to the file.
:db-file-force
A function which forces write completion.
Null Db Cache Options
These are the options defined by the Null Db Cache trait:
:block-read
A function that reads a block.
LRU Db Cache Options
These are the options defined by the LRU Db Cache trait:
:block-read
A function that returns a byte-buffer held in cache or otherwise reads the block from disk.
:block-cache-atom
An atom holding the lru cache.
:threshold
Used to configure the lru cache. Default value is 32.
:block-write
A function that writes a block and adds the byte-buffer holding it to the lru cache.
:block-clear
A function that removes a block from the lru cache.
Db-agent Options
These are the options defined by the Db Agent trait:
:create-db-chan
Creates the db agent.
:db-get-state
Returns the state of the database.
:db-agent
The agent used to manage database updates.
:db-update-vstate
A volatile which holds the working state of the database during an update operation.
:send-update-timeout
The timeout value, in milliseconds, passed to await-for when waiting for the completion of a database update. But if no timeout value is given, then await is used instead.
:db-agent-options
A vector of options to be used when creating the db agent. If not present, an empty vector is used.
:db-send
A function to send an update function to the database actor.
:db-update
A function which sends an update function and then waits for completion.
Db-chan Options
These are the options defined by the Db Chan trait:
:create-db-chan
Creates the db agent.
:db-get-state
Returns the state of the database.
:db-state-atom
The atom used to manage database state.
:db-chan
The asynchronous channel used to send requests to the database.
:db-update-vstate
A volatile which holds the working state of the database during an update operation.
:send-update-timeout
The timeout value, in milliseconds, passed to await-for when waiting for the completion of a database update. But if no timeout value is given, then await is used instead.
:db-buf-or-n
An optional specification of the asynchronous channel buffer. See https://clojuredocs.org/clojure.core.async/chan
:db-send
A function to send an update function to the database actor.
:db-update
A function which sends an update function and then waits for completion.
Calf Database Options
These are the options defined by the Calf database.
:db-updater
The function which updates the database.
:db-block-size
The size of a block.
:transaction-count-atom
The atom which holds the transaction count.
Yearling Database Options
These are the options defined by the Yearling database.
:db-updater
The function which updates the database.
:max-db-size
Upper limit on the size of the database file. Defaults to 100,000,000,000.
:db-block-size
The size of a block.
:transaction-count-atom
The atom which holds the transaction count.
:last-node-id-atom
The atom which holds the last generated node id.
:time-millis-volatile
The time when the current transaction started.
:allocated-bit-set
A mutable BitSet for tracking allocated blocks.
:db-allocated
A function which returns the number of allocated blocks.
:db-allocate
A function which allocates a disk block.
:db-release-pending
A function which returns an aavector holding the allocated blocks which have been released but which are not yet available for reuse.
:db-release
A function used to release a disk block for subsequent, but not immediate, reuse.
:db-process-pending
A function used to free released blocks of a given age for immediate reuse.
:db-pending-age
How old a released block must be, in milliseconds, before being made available for reuse. Defaults to 0.
:db-pending-count
The number of updates which must be processed before a released block can be made available for reuse. Defaults to 2.
:db-new-node-id
A function which generates a unique durable node id.