These functions are not used directly; rather, they are used by
unitize to get and set the unitizer objects.
You should only need to understand these functions if you are
looking to implement a special storage mechanism for the unitizer
objects.
set_unitizer(store.id, unitizer)get_unitizer(store.id)
# S3 method for character
get_unitizer(store.id)
# S3 method for default
get_unitizer(store.id)
# S3 method for unitizer_result
get_unitizer(store.id)
# S3 method for unitizer_results
get_unitizer(store.id)
a filesystem path to the store (an .rds file)
a unitizer-class object containing the store
data
set_unitizer TRUE if unitizer storing worked, error otherwise
get_unitizer a unitizer-class object, FALSE
if store.id doesn't exist yet, or error otherwise; note that
the unitizer_results method returns a list
By default, only a character method is defined, which will interpret its inputs as a filesystem path.
You may write your own methods for special storage situations (
e.g SQL database, ftp server, etc) with the understanding that the
getting method may only accept one argument, the store.id, and
the setting method only two arguments, the store.id and the
unitizer.
S3 dispatch will be on store.id, and store.id may
be any R object that identifies the unitizer. For example, a potential
SQL implementation where the unitizers get stored in blobs may look
like so:
my.sql.store.id <- structure(
list(
server="myunitizerserver.mydomain.com:3306",
database="unitizers",
table="project1",
id="cornercasetests"
),
class="sql_unitizer"
)
get_unitizer.sql_unitizer <- function(store.id) { # FUNCTION BODY }
set_unitizer.sql_unitizer <- function(store.id, unitizer) { # FUNCTION BODY }unitize("unitizer/cornertestcases.R", my.sql.store.id)
Make sure you also define an as.character method for your object to
produce a human readable identifying string.
For inspirations for the bodies of the _store functions look at the source
code for unitizer:::get_unitizer.character and
unitizer:::set_unitizer.character.
Expectations for the functions are as follows. get_unitizer must:
return a unitizer-class object if store.id
exists and contains a valid object
return FALSE if the object doesn't exist (e.g. first time run-through, so reference copy doesn't exist yet)
stop on error
set_unitizer must:
return TRUE on success
stop on error