DSLiteServer mimics a DataSHIELD server by holding datasets and exposing DataSHIELD-like functions: aggregate and assign. A DataSHIELD session is a R environment where the assignment and the operations happen.
new()
Create new DSLiteServer instance. See defaultDSConfiguration function for including or excluding packages when discovering the DataSHIELD configuration from the DataSHIELD server-side packages (meta-data from the DESCRIPTION files).
DSLiteServer$new(
tables = list(),
resources = list(),
config = DSLite::defaultDSConfiguration(),
strict = TRUE,
home = file.path(tempdir(), ".dslite"),
profile = "default"
)
tables
A named list of data.frames representing the harmonized tables.
resources
A named list of resourcer::Resource
objects representing accessible data or computation resources.
config
The DataSHIELD configuration. Default is to discover it from the DataSHIELD server-side R packages.
strict
Logical to specify whether the DataSHIELD configuration must be strictly applied. Default is TRUE.
home
Folder location where are located the session work directory and where to read and dump workspace images.
profile
The DataSHIELD profile name, used to give a name to the DS configuration. Default is "default". Default is in a hidden folder of the R session's temporary directory.
A DSLiteServer object
config()
Get or set the DataSHIELD configuration.
DSLiteServer$config(value)
value
The DataSHIELD configuration: aggregate/assign methods in data frames and a named list of options.
The DataSHIELD configuration, if no parameter is provided.
value
The DataSHIELD profile name.
The DataSHIELD profile, if no parameter is provided.
strict()
Get or set the level of strictness (stop when function call is not configured)
DSLiteServer$strict(value)
value
The strict
logical field.
The strict field if no parameter is provided.
home()
Get or set the home folder location where are located the session work directories and where to read and dump workspace images.
DSLiteServer$home(value)
value
The path to the home folder.
The home folder path if no parameter is provided.
workspaces()
List the saved workspaces in the home
folder.
DSLiteServer$workspaces(prefix = NULL)
prefix
Filter workspaces starting with provided prefix (optional).
workspace_save()
Save the session's workspace image identified by the sid
identifier
with the provided name
in the home
folder.
DSLiteServer$workspace_save(sid, name)
sid,
Session ID
name
The name to be given to the workspace's image.
workspace_restore()
Restore a saved session's workspace image into the session identified by the sid
identifier
with the provided name
in the home
folder.
DSLiteServer$workspace_restore(sid, name)
sid,
Session ID
name
The name of the workspace's image to restore.
workspace_rm()
Remove the workspace image with the provided name
from the home
folder.
DSLiteServer$workspace_rm(name)
name
The name of the workspace.
aggregateMethods()
Get or set the aggregate methods.
DSLiteServer$aggregateMethods(value)
value
A data.frame
with columns: name
(the client function call),
value
(the translated server call), package
(relevant when extracted from a DataSHIELD server-side package),
version
(relevant when extracted from a DataSHIELD server-side package), type
("aggregate"),
class
("function" for package functions or "script" for custom scripts).
The aggregate methods when no parameter is provided.
aggregateMethod()
Get or set an aggregate method.
DSLiteServer$aggregateMethod(name, value)
name
The client function call.
value
The translated server call: either a package function reference or function expression. Remove the method when NULL
.
The aggregate method when no value
parameter is provided.
assignMethods()
Get or set the assign methods.
DSLiteServer$assignMethods(value)
value
A data.frame
with columns: name
(the client function call), value
(the translated server call),
package
(relevant when extracted from a DataSHIELD server-side package), version
(relevant when extracted from a DataSHIELD server-side package),
type
("assign"), class
("function" for package functions or "script" for custom scripts).
The assign methods when no parameter is provided.
assignMethod()
Get or set an assign method.
DSLiteServer$assignMethod(name, value)
name
The client function call
value
The translated server call: either a package function reference or function expression. Remove the method when NULL
.
The assign method when no value
parameter is provided.
options()
Get or set the DataSHIELD R options that are applied when a new DataSHIELD session is started.
DSLiteServer$options(value)
value
A named list of options.
The R options when no parameter is provided.
option()
Get or set a R option.
DSLiteServer$option(key, value)
key
The R option's name.
value
The R option's value. Remove the option when NULL
.
The R option's value when only key
parameter is provided.
newSession()
Create a new DataSHIELD session (contained execution environment), apply options that are defined
in the DataSHIELD configuration and restore workspace image if restore
workspace name argument is provided.
DSLiteServer$newSession(restore = NULL, profile = NULL)
restore
The workspace image to be restored (optional).
profile
The requested profile name (optional). If provided, new session creation will fail in case it does not match the server's profile name.
hasSession()
Check a DataSHIELD session is alive.
DSLiteServer$hasSession(sid)
sid
The session ID.
getSession()
Get the DataSHIELD session's environment.
DSLiteServer$getSession(sid)
sid
The session ID.
getSessionIds()
Get the DataSHIELD session IDs.
DSLiteServer$getSessionIds()
getSessionData()
Get the symbol value from the DataSHIELD session's environment.
DSLiteServer$getSessionData(sid, symbol)
sid
The session ID.
symbol
The symbol name.
closeSession()
Destroy DataSHIELD session and save workspace image if save
workspace name argument is provided.
DSLiteServer$closeSession(sid, save = NULL)
sid
The session ID.
save
The name of the workspace image to be saved (optional).
tableNames()
List the names of the tables that can be assigned.
DSLiteServer$tableNames()
hasTable()
Check a table exists.
DSLiteServer$hasTable(name)
name
The table name to be looked for.
resourceNames()
List the names of the resources (resourcer::Resource
objects) that can be assigned.
DSLiteServer$resourceNames()
hasResource()
Check a resource (resourcer::Resource
object) exists.
DSLiteServer$hasResource(name)
name
The resource name to be looked for.
sid
The session ID.
symbol_rm()
Remove a symbol from a DataSHIELD session.
DSLiteServer$symbol_rm(sid, name)
sid
The session ID.
name
The symbol name.
assignTable()
Assign a table to a symbol in a DataSHIELD session. Filter table columns with the variables names provided.
DSLiteServer$assignTable(sid, symbol, name, variables = NULL, id.name = NULL)
sid
The session ID.
symbol
The symbol to be assigned.
name
The table's name.
variables
The variable names to be filtered in (optional).
id.name
The column name to be used for the entity's identifier (optional).
assignResource()
Assign a resource as a resourcer::ResourceClient
object to a symbol in a DataSHIELD session.
DSLiteServer$assignResource(sid, symbol, name)
sid
The session ID.
symbol
The symbol name.
name
The name of the resource.
assignExpr()
Evaluate an assignment expression in a DataSHIELD session.
DSLiteServer$assignExpr(sid, symbol, expr)
sid
The session ID.
symbol
The symbol name.
expr
The R expression to evaluate.
aggregate()
Evaluate an aggregate expression in a DataSHIELD session.
DSLiteServer$aggregate(sid, expr)
sid
The session ID.
expr
The R expression to evaluate.
clone()
The objects of this class are cloneable with this method.
DSLiteServer$clone(deep = FALSE)
deep
Whether to make a deep clone.
Other server-side items:
newDSLiteServer()