Storr driver using TileDB storage engine.
Usage
driver_tiledb(uri, context = NULL, init = FALSE, ...)
driver_tiledb_create(uri, hash_algorithm = NULL, compression_level = -7,
context = NULL)Arguments
- uri
The URI path of storr.
- context
Optional tiledb_ctx object.
- init
Should the driver be created if not exist? Default is
FALSE.- ...
Other arguments passed to driver's create method when
init = TRUE. Valid arguments:hash_algorithm,compression_levelandkeep_open.- hash_algorithm
Select a hash algorithm supported by digest: 'md5', 'sha1', 'crc32', 'sha256', 'sha512', 'xxhash32', 'xxhash64', 'murmur32', 'spookyhash', 'blake3', 'crc32c', 'xxh3_64', 'xxh3_128'. If not given, the default is 'md5'.
- compression_level
Set an integer value for ZSTD compression level.
Value
driver_tiledb() returns a TileDBDriver object.
driver_tiledb_create() returns logical
TRUEinvisibly, for successful driver creation.
Details
driver_tiledb() returns the TileDB driver given a URI path. You can create
a new driver using init argument or with driver_tiledb_create().
Note that storr_tiledb() abstracts the driver creation, so it's the preferred way unless
you want to pass the driver onto storr.
Class Methods Summary
For complete definitions, see Methods section in TileDBDriver and its parent class CAS.
Active Fields
hash_algorithm- Property for managing the hash algorithm (read/write)members_instantiated- Property indicating instantiation status (read-only)size- Get storr size (read-only)
Lifecycle
open()- Opens the driver for read/write operationscreate()- Create a new driver objectclose()- Closes the driverdestroy()- Destroy/delete the driver
Hash Management
get_hash()andmget_hash()- Retrieve hash values for a given key and namespaceset_hash()andmset_hash()- Set hash values with metadata like expiry date-times and notesexists_hash()- Verify the existence of specific keys, namespacesdel_hash()- Remove key-namespace pairsdelete_namespaces()- Clear namespaces or delete specified oneslist_namespaces(),list_keys()- Retrieve all namespaces or keys for a given namespace
Object Management
get_object()andmget_object()- Fetch serialized R objects using hash valuesset_object()andmset_object()- Store serialized R objectsexists_object()- Verify the existence of specific objectsdel_object()- Remove serialized objects.delete_unused_hashes()- Remove hashes that are not in active uselist_hashes()- Retrieve all hasheslist_unused_hashes()- Identify unused hashes
Key-Namespace Metadata
get_keymeta(),set_keymeta(), andmset_keymeta()- Manage metadata such as expiry times and notes for key-namespace pairs
Expiration Management
keys_with_expirationandkeys_without_expiration- Retrieve the key namespace pairs with or without expiration timestampsexpired_keys()andunexpired_keys()- Retrieve the (un)expired key namespace pairsdelete_expired_keys()- Delete all expired keys or for specific namespacesnum_expired_keys()andnum_unexpired_keys()- Get the number of (un)expired keys or for specific namespaceshas_expired_keys()andhas_unexpired_keys()- Verify the existence of (un)expired keys or for specific namespaces
Export Utilities
export_tdb()- Export objects to another TileDB storr
Directory Methods
dir_tree()- Displays directory structuredump()- Outputs a string representation of storr structure
Data Model
The underlying structure is similar to driver_dbi(); a content-addressed database that consists of two (array) tables.
Specifically, the driver storage is a TileDB Group with two member Arrays which are stored relative to Group's URI path. The next sub-sections describe the group structure and array data models.
Group
Members
tbl_keys(array): maps key-namespace pairs to hashes (and to expiry and/or notes, optional)tbl_data(array): maps hashes to values (serialised R objects)
Metadata
hash_algo: The name of hash algorithm.type: Group identifier,"storr"
Arrays
tbl_keys - A 2D sparse array that maps key-namespace pairs to hashes and key-metadata.
Dimensions:
namespace(ASCII) andkey(ASCII)Attributes:
hash(ASCII),expires_at(DATETIME_MS) andnotes(UTF8)
tbl_data - A 1D sparse array that maps hashes to object values.
Dimensions:
hash(ASCII)Attributes:
value(ASCII)
TileDB datatypes in parentheses.
Examples
if (FALSE) { # \dontrun{
# URI path
uri <- tempfile()
# create driver
dr <- driver_tiledb(uri, init = TRUE)
dr$print()
# R6Class: <TileDBDriver>
# → URI Basename: file6bb0182c1362
# • Arrays: "tbl_keys" and "tbl_data"
# members
dr$names()
# "tbl_keys" "tbl_data"
} # }