| DSLiteServer {DSLite} | R Documentation |
Lightweight DataSHIELD server-side component
Description
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.
Methods
Public methods
Method 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).
Usage
DSLiteServer$new( tables = list(), resources = list(), config = DSLite::defaultDSConfiguration(), strict = TRUE, home = file.path(tempdir(), ".dslite"), profile = "default" )
Arguments
tablesA named list of data.frames representing the harmonized tables.
resourcesA named list of
resourcer::Resourceobjects representing accessible data or computation resources.configThe DataSHIELD configuration. Default is to discover it from the DataSHIELD server-side R packages.
strictLogical to specify whether the DataSHIELD configuration must be strictly applied. Default is TRUE.
homeFolder location where are located the session work directory and where to read and dump workspace images.
profileThe 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.
Returns
A DSLiteServer object
Method config()
Get or set the DataSHIELD configuration.
Usage
DSLiteServer$config(value)
Arguments
valueThe DataSHIELD configuration: aggregate/assign methods in data frames and a named list of options.
Returns
The DataSHIELD configuration, if no parameter is provided.
Method profile()
Get or set the DataSHIELD profile name.
Usage
DSLiteServer$profile(value)
Arguments
valueThe DataSHIELD profile name.
Returns
The DataSHIELD profile, if no parameter is provided.
Method strict()
Get or set the level of strictness (stop when function call is not configured)
Usage
DSLiteServer$strict(value)
Arguments
valueThe
strictlogical field.
Returns
The strict field if no parameter is provided.
Method home()
Get or set the home folder location where are located the session work directories and where to read and dump workspace images.
Usage
DSLiteServer$home(value)
Arguments
valueThe path to the home folder.
Returns
The home folder path if no parameter is provided.
Method workspaces()
List the saved workspaces in the home folder.
Usage
DSLiteServer$workspaces(prefix = NULL)
Arguments
prefixFilter workspaces starting with provided prefix (optional).
Method workspace_save()
Save the session's workspace image identified by the sid identifier
with the provided name in the home folder.
Usage
DSLiteServer$workspace_save(sid, name)
Arguments
sid,Session ID
nameThe name to be given to the workspace's image.
Method 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.
Usage
DSLiteServer$workspace_restore(sid, name)
Arguments
sid,Session ID
nameThe name of the workspace's image to restore.
Method workspace_rm()
Remove the workspace image with the provided name from the home folder.
Usage
DSLiteServer$workspace_rm(name)
Arguments
nameThe name of the workspace.
Method aggregateMethods()
Get or set the aggregate methods.
Usage
DSLiteServer$aggregateMethods(value)
Arguments
valueA
data.framewith 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).
Returns
The aggregate methods when no parameter is provided.
Method aggregateMethod()
Get or set an aggregate method.
Usage
DSLiteServer$aggregateMethod(name, value)
Arguments
nameThe client function call.
valueThe translated server call: either a package function reference or function expression. Remove the method when
NULL.
Returns
The aggregate method when no value parameter is provided.
Method assignMethods()
Get or set the assign methods.
Usage
DSLiteServer$assignMethods(value)
Arguments
valueA
data.framewith 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).
Returns
The assign methods when no parameter is provided.
Method assignMethod()
Get or set an assign method.
Usage
DSLiteServer$assignMethod(name, value)
Arguments
nameThe client function call
valueThe translated server call: either a package function reference or function expression. Remove the method when
NULL.
Returns
The assign method when no value parameter is provided.
Method options()
Get or set the DataSHIELD R options that are applied when a new DataSHIELD session is started.
Usage
DSLiteServer$options(value)
Arguments
valueA named list of options.
Returns
The R options when no parameter is provided.
Method option()
Get or set a R option.
Usage
DSLiteServer$option(key, value)
Arguments
keyThe R option's name.
valueThe R option's value. Remove the option when
NULL.
Returns
The R option's value when only key parameter is provided.
Method 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.
Usage
DSLiteServer$newSession(restore = NULL, profile = NULL)
Arguments
restoreThe workspace image to be restored (optional).
profileThe requested profile name (optional). If provided, new session creation will fail in case it does not match the server's profile name.
Method hasSession()
Check a DataSHIELD session is alive.
Usage
DSLiteServer$hasSession(sid)
Arguments
sidThe session ID.
Method getSession()
Get the DataSHIELD session's environment.
Usage
DSLiteServer$getSession(sid)
Arguments
sidThe session ID.
Method getSessionIds()
Get the DataSHIELD session IDs.
Usage
DSLiteServer$getSessionIds()
Method getSessionData()
Get the symbol value from the DataSHIELD session's environment.
Usage
DSLiteServer$getSessionData(sid, symbol)
Arguments
sidThe session ID.
symbolThe symbol name.
Method closeSession()
Destroy DataSHIELD session and save workspace image if save workspace name argument is provided.
Usage
DSLiteServer$closeSession(sid, save = NULL)
Arguments
sidThe session ID.
saveThe name of the workspace image to be saved (optional).
Method tableNames()
List the names of the tables that can be assigned.
Usage
DSLiteServer$tableNames()
Method hasTable()
Check a table exists.
Usage
DSLiteServer$hasTable(name)
Arguments
nameThe table name to be looked for.
Method resourceNames()
List the names of the resources (resourcer::Resource objects) that can be assigned.
Usage
DSLiteServer$resourceNames()
Method hasResource()
Check a resource (resourcer::Resource object) exists.
Usage
DSLiteServer$hasResource(name)
Arguments
nameThe resource name to be looked for.
Method symbols()
List the symbols living in a DataSHIELD session.
Usage
DSLiteServer$symbols(sid)
Arguments
sidThe session ID.
Method symbol_rm()
Remove a symbol from a DataSHIELD session.
Usage
DSLiteServer$symbol_rm(sid, name)
Arguments
sidThe session ID.
nameThe symbol name.
Method assignTable()
Assign a table to a symbol in a DataSHIELD session. Filter table columns with the variables names provided.
Usage
DSLiteServer$assignTable(sid, symbol, name, variables = NULL, id.name = NULL)
Arguments
sidThe session ID.
symbolThe symbol to be assigned.
nameThe table's name.
variablesThe variable names to be filtered in (optional).
id.nameThe column name to be used for the entity's identifier (optional).
Method assignResource()
Assign a resource as a resourcer::ResourceClient object to a symbol in a DataSHIELD session.
Usage
DSLiteServer$assignResource(sid, symbol, name)
Arguments
sidThe session ID.
symbolThe symbol name.
nameThe name of the resource.
Method assignExpr()
Evaluate an assignment expression in a DataSHIELD session.
Usage
DSLiteServer$assignExpr(sid, symbol, expr)
Arguments
sidThe session ID.
symbolThe symbol name.
exprThe R expression to evaluate.
Method aggregate()
Evaluate an aggregate expression in a DataSHIELD session.
Usage
DSLiteServer$aggregate(sid, expr)
Arguments
sidThe session ID.
exprThe R expression to evaluate.
Method clone()
The objects of this class are cloneable with this method.
Usage
DSLiteServer$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
See Also
Other server-side items:
newDSLiteServer()