moto-0.0.2: General purpose migrations library

Safe HaskellNone
LanguageHaskell2010

Moto.Registry

Contents

Description

This module exports tools for implementing a registry that moto can use in order to keep track of the migrations that have been run so far.

It's unlikely that you'll need to concern yourself with this module as an end user of moto.

Please import as:

import qualified Moto.Registry as Moto
Synopsis

Command-line support

data RegistryConf where #

Constructors

RegistryConf 

Fields

Registry

newAppendOnlyRegistry Source #

Arguments

:: State

Initial registry state obtained by reading Logs from the backing append-only storage and running updateState on them.

-> (Log -> IO ())

How to store a newly generated Log in the backing append-only storage.

If this function throws an exception, then the execption will propagated as usual, but also, this registry will be marked as tained and each subsequent operation on it will throw Err_Tainted.

-> IO Registry 

Create a Registry backed by an append-only Log storage.

This registry maintains its internal State in memory as long as it is possible to successfuly store all the changes in the underlying append-only storage. If at some point this fails unrecoverably, then Err_Tainted will be thrown by the functions acting on this Registry.

It's important to acquire some kind of exclusive lock on the underlying storage, so that other applications can't poke it while our Registry is running.

State

data State #

Instances
Eq State 
Instance details

Defined in Moto.Internal

Methods

(==) :: State -> State -> Bool #

(/=) :: State -> State -> Bool #

Show State 
Instance details

Defined in Moto.Internal

Methods

showsPrec :: Int -> State -> ShowS #

show :: State -> String #

showList :: [State] -> ShowS #

data Log #

Instances
Eq Log 
Instance details

Defined in Moto.Internal

Methods

(==) :: Log -> Log -> Bool #

(/=) :: Log -> Log -> Bool #

Read Log 
Instance details

Defined in Moto.Internal

Show Log 
Instance details

Defined in Moto.Internal

Methods

showsPrec :: Int -> Log -> ShowS #

show :: Log -> String #

showList :: [Log] -> ShowS #

Errors

data Err_Tainted Source #

The Registry is tainted, meaning our last attempt to interact with the registry's backing storage failed. We can't be certain about the current state of the Registry.

Constructors

Err_Tainted