An R6 class that represents a storr interface for TileDB driver.
TileDBStorr replicates the storr interface but also enhances
it with additional new features:
notes and key expiration timestamps
asynchronous writes
Note that the following methods from storr are not supported by
TileDBStorr: $archive_import, $archive_export,
$check and $repair.
This class is not intended to be used directly and the preferred
usage is through storr_tiledb().
Public fields
envirThe object hash table.
envir_metadataThe key metadata hash table.
default_namespaceThe default namespace.
traitsDriver traits.
hash_rawThe hash function.
serialize_objectThe serialisation function.
Methods
TileDBStorr$new()
Initialise TileDBStorr.
Usage
TileDBStorr$new(driver, default_namespace, async = FALSE)Arguments
driverA TileDB driver, see
driver_tiledb().default_namespaceThe default namespace.
asyncShould the mirai daemons be enabled for async functions? Default is
FALSE.
TileDBStorr$set()
Set a key value pair.
Usage
TileDBStorr$set(key, value, namespace = self$default_namespace, expires_at,
notes, use_cache = getOption("storr.tiledb.cache", TRUE))TileDBStorr$mset()
Set multiple key value pairs.
Usage
TileDBStorr$mset(key, value, namespace = self$default_namespace, expires_at,
notes, use_cache = getOption("storr.tiledb.cache", TRUE))Arguments
keyA character vector of key names.
valueA vector of values to store.
namespaceA character vector of namespaces.
expires_atA vector of date-times of class
POSIXct(optional).notesA character vector of notes (optional).
use_cacheShould the cache be used? Default is
TRUE.
TileDBStorr$set_async()
Set a key value pair asynchronously.
Usage
TileDBStorr$set_async(key, value, namespace = self$default_namespace,
expires_at, notes, use_cache = getOption("storr.tiledb.cache", TRUE),
cfg = NULL)Arguments
keyA scalar character of key name.
valueAn R object to store.
namespaceA scalar character of namespace name.
expires_atA date-time object of class
POSIXct(optional).notesA scalar string of notes (optional).
use_cacheShould the cache be used? Default is
TRUE.cfgPass a
tiledb::config()object to override context's configuration.
Returns
Invisibly, a named list with two elements:
mirai: a named list of twomirai()objects,objandkey;objrefers to object table andkeyto key table. Both return logicalTRUEif an evaluation is successful.hash: the hash value
TileDBStorr$mset_async()
Set multiple key value pairs asynchronously.
Usage
TileDBStorr$mset_async(key, value, namespace = self$default_namespace,
expires_at, notes, use_cache = getOption("storr.tiledb.cache", TRUE),
cfg = NULL)Arguments
keyA character vector of key names.
valueA vector of values to store.
namespaceA character vector of namespaces.
expires_atA vector of date-times of class
POSIXct(optional).notesA character vector of notes (optional).
use_cacheShould the cache be used? Default is
TRUE.cfgPass a
tiledb::config()object to override context's configuration.
Details
The arguments key and namespace can be recycled if any of them is a
scalar character and the other is a vector. No other recycling rule is permitted.
Returns
Invisibly, a named list with two elements:
mirai: a named list of twomirai()objects,objandkey;objrefers to object table andkeyto key table. Both return logicalTRUEif an evaluation is successful.hash: a vector with hash values
TileDBStorr$set_by_value()
Set a key value pair using its hash as key.
Usage
TileDBStorr$set_by_value(value, namespace = self$default_namespace,
expires_at, notes, use_cache = getOption("storr.tiledb.cache", TRUE))TileDBStorr$mset_by_value()
Set multiple key value pairs using their hashes as keys.
Usage
TileDBStorr$mset_by_value(value, namespace = self$default_namespace,
expires_at, notes, use_cache = getOption("storr.tiledb.cache", TRUE))TileDBStorr$set_by_value_async()
Set a key value pair using its hash as key, asynchronously.
Usage
TileDBStorr$set_by_value_async(value, namespace = self$default_namespace,
expires_at, notes, use_cache = getOption("storr.tiledb.cache", TRUE),
cfg = NULL)Arguments
valueAn R object to store.
namespaceA scalar character of namespace name.
expires_atA date-time object of class
POSIXct(optional).notesA scalar string of notes (optional).
use_cacheShould the cache be used? Default is
TRUE.cfgPass a
tiledb::config()object to override context's configuration.
Returns
Invisibly, a named list with two elements:
mirai: a named list of twomirai()objects,objandkey;objrefers to object table andkeyto key table. Both return logicalTRUEif an evaluation is successful.hash: the hash value
TileDBStorr$mset_by_value_async()
Set multiple key value pairs using their hashes as keys, asynchronously.
Usage
TileDBStorr$mset_by_value_async(value, namespace = self$default_namespace,
expires_at, notes, use_cache = getOption("storr.tiledb.cache", TRUE),
cfg = NULL)Arguments
valueA vector of values to store.
namespaceA character vector of namespaces.
expires_atA vector of date-times of class
POSIXct(optional).notesA character vector of notes (optional).
use_cacheShould the cache be used? Default is
TRUE.cfgPass a
tiledb::config()object to override context's configuration.
Details
The arguments key and namespace can be recycled if any of them is a
scalar character and the other is a vector. No other recycling rule is permitted.
Returns
Invisibly, a named list with two elements:
mirai: a named list of twomirai()objects,objandkey;objrefers to object table andkeyto key table. Both return logicalTRUEif an evaluation is successful.hash: a vector with hash values
TileDBStorr$set_value()
Add an R object without key.
This is used internally.
Usage
TileDBStorr$set_value(value, use_cache = getOption("storr.tiledb.cache",
TRUE))TileDBStorr$mset_value()
Add a vector of R objects.
This is used internally.
Usage
TileDBStorr$mset_value(values, use_cache = getOption("storr.tiledb.cache",
TRUE))TileDBStorr$get()
Get an object given a key-namespace pair.
Usage
TileDBStorr$get(key, namespace = self$default_namespace,
use_cache = getOption("storr.tiledb.cache", TRUE))TileDBStorr$mget()
Get multiple objects.
Usage
TileDBStorr$mget(key, namespace = self$default_namespace,
use_cache = getOption("storr.tiledb.cache", TRUE), missing = NULL)Arguments
keyA character vector of key names.
namespaceA character vector of namespaces.
use_cacheShould the cache be used? Default is
TRUE.missingValue to use for missing elements.
TileDBStorr$mget_hash()
Get hash values.
TileDBStorr$get_value()
Get an object given its hash.
Usage
TileDBStorr$get_value(hash, use_cache = getOption("storr.tiledb.cache",
TRUE))TileDBStorr$mget_value()
Get multiple objects given their hashes.
Usage
TileDBStorr$mget_value(hash, use_cache = getOption("storr.tiledb.cache",
TRUE), missing = NULL)TileDBStorr$get_all()
Get an object and its metadata given a key-namespace pair.
Usage
TileDBStorr$get_all(key, namespace = self$default_namespace,
use_cache = getOption("storr.tiledb.cache", TRUE))TileDBStorr$mget_all()
Get multiple objects and their metadata.
Usage
TileDBStorr$mget_all(key, namespace = self$default_namespace,
use_cache = getOption("storr.tiledb.cache", TRUE), missing = NULL)Arguments
keyA character vector of key names.
namespaceA character vector of namespaces.
use_cacheShould the cache be used? Default is
TRUE.missingValue to use for missing elements.
TileDBStorr$update()
Update a key value pair.
Usage
TileDBStorr$update(key, value, namespace = self$default_namespace,
create = FALSE, expires_at, notes,
use_cache = getOption("storr.tiledb.cache", TRUE))Arguments
keyA scalar character of key name.
valueAn R object to store.
namespaceA scalar character of namespace name.
createShould the key be created, if not found. Default is
FALSEraising anKeyError. Otherwise, create a new key.expires_at, notesA scalar string of notes and/or a date-time object of class
POSIXct(optional). Applies only ifcreate = TRUE.use_cacheShould the cache be used? Default is
TRUE.
TileDBStorr$mupdate()
Update multiple key value pairs.
Usage
TileDBStorr$mupdate(key, value, namespace = self$default_namespace,
create = FALSE, fail_fast = TRUE, expires_at, notes,
use_cache = getOption("storr.tiledb.cache", TRUE))Arguments
keyA scalar character of key name.
valueAn R object to store.
namespaceA scalar character of namespace name.
createShould the key be created, if not found. Default is
FALSEraising anKeyError. Otherwise, create a new key.fail_fastShould abort on missing keys, default is
TRUE. UseFALSEfor skipping keys and emit a warning for missing items. The argument has no effect when upsert is used viacreate = TRUE.expires_at, notesA scalar string of notes and/or a date-time object of class
POSIXct(optional). Applies only ifcreate = TRUE.use_cacheShould the cache be used? Default is
TRUE.
TileDBStorr$update_async()
Update a key value pair asynchronously.
Usage
TileDBStorr$update_async(key, value, namespace = self$default_namespace,
create = FALSE, expires_at, notes,
use_cache = getOption("storr.tiledb.cache", TRUE), cfg = NULL)Arguments
keyA scalar character of key name.
valueAn R object to store.
namespaceA scalar character of namespace name.
createShould the key be created, if not found. Default is
FALSEraising anKeyError. Otherwise, create a new key.expires_at, notesA scalar string of notes and/or a date-time object of class
POSIXct(optional). Applies only ifcreate = TRUE.use_cacheShould the cache be used? Default is
TRUE.cfgPass a
tiledb::config()object to override context's configuration.
Details
This method updates a key-namespace value while retaining
its key-metadata. If a key is not found, it raises an error by default;
otherwise, set create argument to TRUE to set a new key and optionally
add key metadata with expires_at,notes arguments.
Returns
Invisibly, a named list with two elements:
mirai: a named list of twomirai()objects,objandkey;objrefers to object table andkeyto key table. Both return logicalTRUEif an evaluation is successful.hash: the hash value
TileDBStorr$mupdate_async()
Update multiple key value pairs asynchronously.
Usage
TileDBStorr$mupdate_async(key, value, namespace = self$default_namespace,
create = FALSE, fail_fast = TRUE, expires_at, notes,
use_cache = getOption("storr.tiledb.cache", TRUE), cfg = NULL)Arguments
keyA scalar character of key name.
valueAn R object to store.
namespaceA scalar character of namespace name.
createShould the key be created, if not found. Default is
FALSEraising anKeyError. Otherwise, create a new key.fail_fastShould abort on missing keys, default is
TRUE. UseFALSEfor skipping keys and emit a warning for missing items. The argument has no effect when upsert is used viacreate = TRUE.expires_at, notesA scalar string of notes and/or a date-time object of class
POSIXct(optional). Applies only ifcreate = TRUE.use_cacheShould the cache be used? Default is
TRUE.cfgPass a
tiledb::config()object to override context's configuration.
Details
This works similar to $update but for multiple key pairs and with
more control about missing keys; use fail_fast to abort (default) or
skip with warning.
Returns
Invisibly, a named list with two elements:
mirai: a named list of twomirai()objects,objandkey;objrefers to object table andkeyto key table. Both return logicalTRUEif an evaluation is successful.hash: a vector with hash values
TileDBStorr$set_keymeta()
Set key metadata.
Usage
TileDBStorr$set_keymeta(key, namespace = self$default_namespace, expires_at,
notes, use_cache = getOption("storr.tiledb.cache", TRUE))Arguments
keyA scalar character of key name.
namespaceA scalar character of namespace name.
expires_atA date-time object of class
POSIXct(optional).notesA scalar string of notes (optional).
use_cacheShould the cache be used to retrieve the metadata? Default is
TRUE. If a key:namespace not found in the cache, it will be fetched from database. Note that when settingFALSE, the cache will always be cleared for this key-namespace; this is to avoid mismatch between cache and database when reading back withuse_cache = TRUE.
TileDBStorr$mset_keymeta()
Set multiple key metadata.
Usage
TileDBStorr$mset_keymeta(key, namespace = self$default_namespace, expires_at,
notes, use_cache = getOption("storr.tiledb.cache", TRUE))Arguments
keyA character vector of key names.
namespaceA character vector of namespaces.
expires_atA vector of date-times of class
POSIXct(optional).notesA character vector of notes (optional).
use_cacheShould the cache be used to retrieve the metadata? Default is
TRUE. If a key:namespace not found in the cache, it will be fetched from database. Note that when settingFALSE, the cache will always be cleared for this key-namespace; this is to avoid mismatch between cache and database when reading back withuse_cache = TRUE.
TileDBStorr$set_keymeta_async()
Set key metadata asynchronously.
Usage
TileDBStorr$set_keymeta_async(key, namespace = self$default_namespace,
expires_at, notes, use_cache = getOption("storr.tiledb.cache", TRUE),
cfg = NULL)Arguments
keyA scalar character of key name.
namespaceA scalar character of namespace name.
expires_atA date-time object of class
POSIXct(optional).notesA scalar string of notes (optional).
use_cacheShould the cache be used to retrieve the metadata? Default is
TRUE. If a key:namespace not found in the cache, it will be fetched from database. Note that when settingFALSE, the cache will always be cleared for this key-namespace; this is to avoid mismatch between cache and database when reading back withuse_cache = TRUE.cfgPass a
tiledb::config()object to override context's configuration.
TileDBStorr$mset_keymeta_async()
Set multiple key metadata.
Usage
TileDBStorr$mset_keymeta_async(key, namespace = self$default_namespace,
expires_at, notes, use_cache = getOption("storr.tiledb.cache", TRUE),
cfg = NULL)Arguments
keyA character vector of key names.
namespaceA character vector of namespaces.
expires_atA vector of date-times of class
POSIXct(optional).notesA character vector of notes (optional).
use_cacheShould the cache be used to retrieve the metadata? Default is
TRUE. If a key:namespace not found in the cache, it will be fetched from database. Note that when settingFALSE, the cache will always be cleared for this key-namespace; this is to avoid mismatch between cache and database when reading back withuse_cache = TRUE.cfgPass a
tiledb::config()object to override context's configuration.
TileDBStorr$get_keymeta()
Get key's metadata.
Usage
TileDBStorr$get_keymeta(key, namespace = self$default_namespace,
use_cache = getOption("storr.tiledb.cache", TRUE))TileDBStorr$mget_keymeta()
Get multiple key metadata.
Usage
TileDBStorr$mget_keymeta(key, namespace = self$default_namespace,
use_cache = getOption("storr.tiledb.cache", TRUE), missing = NULL)Arguments
keyA character vector with keys to get metadata values from.
namespaceA character vector of namespaces to look the keys within.
use_cacheShould the cache be used? Default is
TRUE.missingFill value for missing keys. Default is
NULL.
TileDBStorr$get_keymeta_expires_at()
Get key's expiration metadata.
Usage
TileDBStorr$get_keymeta_expires_at(key, namespace = self$default_namespace,
use_cache = getOption("storr.tiledb.cache", TRUE))Arguments
keyThe key name to get metadata values from.
namespaceThe namespace to look the key within.
use_cacheShould it be retrieved from cache? Default is
TRUE.
TileDBStorr$get_keymeta_notes()
Get key's notes metadata.
Usage
TileDBStorr$get_keymeta_notes(key, namespace = self$default_namespace,
use_cache = getOption("storr.tiledb.cache", TRUE))Arguments
keyThe key name to get metadata values from.
namespaceThe namespace to look the key within.
use_cacheShould it be retrieved from cache? Default is
TRUE.
TileDBStorr$mget_keymeta_expires_at()
Get expiration metadata for multiple keys.
Usage
TileDBStorr$mget_keymeta_expires_at(key, namespace = self$default_namespace,
use_cache = getOption("storr.tiledb.cache", TRUE), missing = NULL)Arguments
keyA character vector with keys to get metadata values from.
namespaceA character vector of namespaces to look the keys within.
use_cacheShould the cache be used? Default is
TRUE.missingFill value for missing keys. Default is
NULL.
Details
An efficient method compared to $mget_keymeta() for fetching expiration
values only.
The arguments key and namespace can be recycled if any of them is a
scalar character and the other is a vector. No other recycling rule is permitted.
Note that use_cache will only fetch the metadata but not cache it if
retrieved from database.
TileDBStorr$mget_keymeta_notes()
Get notes metadata for multiple keys.
Usage
TileDBStorr$mget_keymeta_notes(key, namespace = self$default_namespace,
use_cache = getOption("storr.tiledb.cache", TRUE), missing = NULL)Arguments
keyA character vector with keys to get metadata values from.
namespaceA character vector of namespaces to look the keys within.
use_cacheShould the cache be used? Default is
TRUE.missingFill value for missing keys. Default is
NULL.
Details
An efficient method compared to $mget_keymeta() for fetching notes
values only.
The arguments key and namespace can be recycled if any of them is a
scalar character and the other is a vector. No other recycling rule is permitted.
Note that use_cache will only fetch the metadata but not cache it if
retrieved from database.
TileDBStorr$clear_keymeta()
Remove key metadata.
Usage
TileDBStorr$clear_keymeta(key, namespace = self$default_namespace,
use_cache = getOption("storr.tiledb.cache", TRUE))Arguments
keyA character vector of key names.
namespaceA character vector of namespaces.
use_cacheShould the cache be used to retrieve the metadata? Default is
TRUE. If a key:namespace not found in the cache, it will be fetched from database. Note that when settingFALSE, the cache will always be cleared for this key-namespace; this is to avoid mismatch between cache and database when reading back withuse_cache = TRUE.
Details
This method is a convenient wrapper around set_keymeta() and mset_keymeta()
and sets the key metadata fields to NA values, i.e., as.POSIXct(NA) and
NA_character.
The arguments key and namespace can be recycled if any of them is a
scalar character and the other is a vector. No other recycling rule is permitted.
TileDBStorr$clear_keymeta_async()
Remove key metadata asynchronously.
Usage
TileDBStorr$clear_keymeta_async(key, namespace = self$default_namespace,
use_cache = getOption("storr.tiledb.cache", TRUE), cfg = NULL)Arguments
keyA character vector of key names.
namespaceA character vector of namespaces.
use_cacheShould the cache be used to retrieve the metadata? Default is
TRUE. If a key:namespace not found in the cache, it will be fetched from database. Note that when settingFALSE, the cache will always be cleared for this key-namespace; this is to avoid mismatch between cache and database when reading back withuse_cache = TRUE.cfgPass a
tiledb::config()object to override context's configuration.
Details
This method is a convenient wrapper around set_keymeta_async() and mset_keymeta_async()
and sets the key metadata fields to NA values, i.e., as.POSIXct(NA) and
NA_character.
The arguments key and namespace can be recycled if any of them is a
scalar character and the other is a vector. No other recycling rule is permitted.
TileDBStorr$fill()
Set one or more keys to the same value.
Usage
TileDBStorr$fill(key, value, namespace = self$default_namespace,
use_cache = getOption("storr.tiledb.cache", TRUE))Arguments
keyA character vector of key names.
valueAn R object to store.
namespaceA character vector of namespaces.
use_cacheShould the cache be used? Default is
TRUE.
TileDBStorr$duplicate()
Duplicate a set of keys.
Usage
TileDBStorr$duplicate(key_src, key_dest, namespace = self$default_namespace,
namespace_src = namespace, namespace_dest = namespace)Arguments
key_srcA character vector of source keys.
key_destA character vector of destination keys.
namespaceThe namespace to copy keys within (used only when
namespace_srcandnamespace_destare not provided).namespace_srcThe source namespace - use this where keys are duplicated across namespaces.
namespace_destThe destination namespace - use this where keys are duplicated across namespaces.
TileDBStorr$exists()
Check a key-namespace pair exists.
TileDBStorr$del()
Delete an object from the storr.
Details
This will delete only the key-namespace pointers(s) and not the underlying
data. Explicit use of $gc() is required to remove the actual object
when its hash is not associated with any key-namespace pair.
The arguments key and namespace can be recycled if any of them is a
scalar character and the other is a vector. No other recycling rule is permitted.
TileDBStorr$keys_with_expiration()
Get the key-namespace pairs with expiration timestamps.
TileDBStorr$expired_keys()
Get the expired key-namespace pairs.
TileDBStorr$is_key_expired()
Check a key-namespace for expiration.
Usage
TileDBStorr$is_key_expired(key, namespace = self$default_namespace,
use_cache = getOption("storr.tiledb.cache", TRUE), check = TRUE)Arguments
keyA scalar character of key name.
namespaceA scalar character of namespace name.
use_cacheShould the cache be used? Default is
TRUE.checkCheck key-namespace pair exists before query about expiration (default). Set
FALSEto skip check; on this occasion when a key-namespace not found, it returnsFALSE- useful whenTRUEvalue only matters to user.
TileDBStorr$keys_with_notes()
Get the key-namespace pairs with notes.
TileDBStorr$list_notes()
List notes given a namespace.
TileDBStorr$gc()
Garbage collect the storr.
TileDBStorr$import()
Import objects to storr.
Usage
TileDBStorr$import(src, list = NULL, namespace = self$default_namespace,
skip_missing = FALSE)Arguments
srcA source to import objects from. It can be a storr, list, or environment.
listNames of objects to import (or
NULLfor all objects) . If given it must be a character vector. If named, the names of the character vector will be the names of the objects as created in the storr.namespaceNamespace to get objects from, and to put objects into. If
NULL, all namespaces fromsrcwill be imported. If named, then the same rule is followed aslist;namespace = c(a = b)will import the contents of namespacebas namespacea.skip_missingLogical, indicating if missing keys (specified in
list) should be skipped over, rather than being treated as an error (the default).
TileDBStorr$export()
Export objects from storr.
Use list() to export to a brand new list, or use as.list(object) for a shorthand.
Usage
TileDBStorr$export(dest, list = NULL, namespace = self$default_namespace,
skip_missing = FALSE)Arguments
destA destination to export objects to. It can be a storr, list, or environment.
listNames of objects to export (or
NULLfor all objects) . If given it must be a character vector. If named, the names of the character vector will be the names of the objects as created in the storr.namespaceNamespace to get objects from, and to put objects into. If
NULL, then this will export namespaces from this (source) storr into the destination; if there is more than one namespace, this is only possible ifdestis a storr (otherwise there will be an error).skip_missingLogical, indicating if missing keys (specified in
list) should be skipped over, rather than being treated as an error (the default).
TileDBStorr$index_import()
Import an index of objects from a storr.
TileDBStorr$export_tdb()
Export objects from storr to another TileDB storr.
Usage
TileDBStorr$export_tdb(key = character(0),
namespace = self$default_namespace, uri_dest, context_dest = NULL)Arguments
keyA character vector of source keys.
namespaceA character vector of namespaces or
NULLfor all namespaces.uri_destThe URI path of destination storr.
context_destOptional tiledb_ctx object for destination storr.