Implementation of the DataStorage R6 class to SQLite backend using a unified
API for read/write operations
Super class
shiny.telemetry::DataStorage -> DataStoragePlumber
Active bindings
event_read_endpointstring field that returns read action endpoint
event_insert_endpointstring field that returns insert action endpoint
Methods
Method new()
Initialize the data storage class
Usage
DataStoragePlumber$new(
hostname = "127.0.0.1",
port = 80,
protocol = "http",
path = NULL,
secret = NULL,
authorization = NULL
)Arguments
hostnamestring with hostname of plumber instance,
portnumeric value with port number of plumber instance.
protocolstring with protocol of the connection of the plumber instance.
pathstring with sub-path of plumber deployment.
secretstring with secret to sign communication with plumber (can be NULL for disabling communication signing).
authorizationstring to use in HTTP headers for authorization (for example: to authenticate to a plumber deployment behind a connect server).
Examples
if (FALSE) { # \dontrun{
# Make sure the PLUMBER_SECRET environment variable is valid before
# running these examples (NULL or a valid secret)
data_storage <- DataStoragePlumber$new(
hostname = "connect.appsilon.com",
path = "shiny_telemetry_plumber",
port = 443,
protocol = "https",
authorization = Sys.getenv("CONNECT_AUTHORIZATION_KEY"),
secret = Sys.getenv("PLUMBER_SECRET")
)
data_storage <- DataStoragePlumber$new(
hostname = "127.0.0.1",
path = NULL,
port = 8087,
protocol = "http",
secret = Sys.getenv("PLUMBER_SECRET")
)
data_storage$insert("example", "test_event", "session1")
data_storage$insert("example", "input", "s1", list(id = "id"))
data_storage$insert("example", "input", "s1", list(id = "id2", value = 32))
data_storage$insert(
"example", "test_event_3_days_ago", "session1",
time = lubridate::as_datetime(lubridate::today() - 3)
)
data_storage$read_event_data()
data_storage$read_event_data(Sys.Date() - 1, Sys.Date() + 1)
} # }