databrary-1: Databrary

Safe HaskellNone
LanguageHaskell2010

Store.Service

Synopsis

Documentation

initStorage Source #

Arguments

:: Either String StorageLocationConfig

Either the set of paths to use for storage, or a message explaining why storage isn't available. This Either will collapse very soon, once use sites of initStorage are rewritten.

-> IO (Maybe Transcoder)

An action that might produce a transcoder. I kept this is IO to keep the implementation identical, without reordering error messages. I highly suspect that is overkill, and this will get moved out of IO.

-> IO Storage

The Storage resource (presuming no exceptions were thrown).

Initialize the configured storage location. It checks for the existence of certain directories and adds subdirectories. Primarily, this allows us to interface with third party services (NYU HPC) that have set up certain directories for us to use.

This may throw a variety of unchecked exceptions, which is probably the right thing to do for initialization.

TODO: * Combine initCache and initTemp, which are doing the same thing with quite different implementations: appending a subdirectory, and creating it if it doesn't exist * Commit to reordering execution steps, purifying the second arg * Use throwIO instead of error

data StorageLocationConfig Source #

Locations used by Storage. This is almost identical to Storage, except in how it's used and what it represents. Future work might merge the two types.