firesale

Data Store for 'fiery' web servers

https://github.com/thomasp85/firesale

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.3%) to scientific vocabulary
Last synced: 11 months ago · JSON representation

Repository

Data Store for 'fiery' web servers

Basic Info
  • Host: GitHub
  • Owner: thomasp85
  • License: other
  • Language: R
  • Default Branch: main
  • Size: 89.8 KB
Statistics
  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • Open Issues: 1
  • Releases: 1
Created about 1 year ago · Last pushed 12 months ago
Metadata Files
Readme License Code of conduct

README.Rmd

---
output: github_document
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
```

# firesale


[![R-CMD-check](https://github.com/thomasp85/firesale/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/thomasp85/firesale/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/thomasp85/firesale/graph/badge.svg)](https://app.codecov.io/gh/thomasp85/firesale)


firesale is a plugin for [fiery](https://fiery.data-imaginist.com/) that provides
a (potentially persistent) data store based on path parameters and client id.

It builds upon the [storr](https://richfitz.github.io/storr/) package and thus
provides a multitude of storage backends to suit your need while providing the
same interface for your server logic.

## Installation

``` r
# You can install marquee from CRAN
pak::pak("firesale")

# Or get the development version from Github
pak::pak("thomasp85/firesale")
```

## Example
Using firesale is quite simple. You initialise the plugin and then attach it to
your fiery server:

```{r}
library(firesale)

ds <- FireSale$new(storr::driver_environment())

ds
```

Once created you attach it like any other plugin

```{r}
app <- fiery::Fire$new()

app$attach(ds)

app
```

Now, your request handlers will have access to a `datastore` element in their
`arg_list` argument which will grant you access to the datastore. The
`datastore` will itself contain two elements: `global` and `session`. The former
gives access to a datastore shared by all sessions, while the latter is scoped
to the session of the request being handled

```{r}
app$on("request", function(request, response, arg_list, ...) {
  response$status <- 200L

  # Use `session` to see if this is the first time
  if (!isFALSE(arg_list$datastore$session$first)) {
    # Store number of unique visitors in `global`
    arg_list$datastore$global$count <- (arg_list$datastore$global$count %||% 0) + 1

    response$body <- paste0(
      "This is your first visit\n",
      "You are visiter number ",
      arg_list$datastore$global$count
    )
    arg_list$datastore$session$first <- FALSE
  } else {
    response$body <- "You've been here before"
  }
})
```

As can be seen, the `datastore` and its element are list-like and you can treat
`session` and `global` pretty much how you would a normal list in terms of
getting and setting values.

Owner

  • Name: Thomas Lin Pedersen
  • Login: thomasp85
  • Kind: user
  • Location: Copenhagen
  • Company: @posit-pbc, part of @tidyverse team

Maker of tools focusing on data science and data visualisation

GitHub Events

Total
  • Create event: 2
  • Release event: 1
  • Issues event: 1
  • Push event: 9
Last Year
  • Create event: 2
  • Release event: 1
  • Issues event: 1
  • Push event: 9

Committers

Last synced: 12 months ago

All Time
  • Total Commits: 9
  • Total Committers: 1
  • Avg Commits per committer: 9.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 9
  • Committers: 1
  • Avg Commits per committer: 9.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Thomas Lin Pedersen t****5@g****m 9

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 1
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 1
  • Total pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • thomasp85 (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads: unknown
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 1
  • Total maintainers: 1
cran.r-project.org: firesale

Datastore for 'fiery' Web Servers

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 0 Last month
Rankings
Dependent packages count: 25.7%
Dependent repos count: 31.5%
Average: 47.5%
Downloads: 85.4%
Maintainers (1)
Last synced: 11 months ago

Dependencies

.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v4 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml actions
  • JamesIves/github-pages-deploy-action v4.5.0 composite
  • actions/checkout v4 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pr-commands.yaml actions
  • actions/checkout v4 composite
  • r-lib/actions/pr-fetch v2 composite
  • r-lib/actions/pr-push v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v4 composite
  • actions/upload-artifact v4 composite
  • codecov/codecov-action v5 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
DESCRIPTION cran
  • R6 * imports
  • cli * imports
  • rlang * imports
  • storr * imports
  • fiery >= 1.2.1.9000 suggests
  • testthat >= 3.0.0 suggests