moto-0.0.4: General purpose migrations library

Safe HaskellNone
LanguageHaskell2010

Moto.File

Contents

Description

This module exports a Store that stores Backup data as files in the filesystem, as well as a Registry backed by a file in the filesystem and related tools.

Please import as:

import qualified Moto.File
Synopsis

Registry

registryConf :: RegistryConf Source #

Command-line configuration for a Registry stored as a file in the filesystem using withRegistry.

withRegistry Source #

Arguments

:: (MonadIO m, MonadMask m) 
=> Df1 
-> FilePath

File where to store the registry logs.

An exclusive lock will be set on the this file (see hLock), which will stay open until this function returns. This is to prevent other programs to interact with this file while this program is running.

-> (Registry -> m a) 
-> m a 

Obtain a Registry backed by an append-only file storage, using moto's own file format.

Store

store Source #

Arguments

:: FilePath

Path to a directory where the files are or will be stored.

-> Store (Producer ByteString IO ()) 

A Store that keeps data stored as files (one per MigId) in a filesystem directory.

For maximum memory consumption efficiency, the data is written and read in a streaming fasion using a Producer.

jsonStore :: (FromJSON x, ToJSON x) => FilePath -> Store x Source #

Like store, but serializes data in a JSON format.

WARNING: This holds all of x in memory, so avoid using jsonStore if your data is too large.