Skip to content
Permalink
Browse files

Fixup + some docs

  • Loading branch information...
Anviking committed Nov 8, 2019
1 parent 793819d commit 528ee67e62f0ed2c04ceb8a95cdf91d67867a445
Showing with 16 additions and 1 deletion.
  1. +16 −1 lib/core/src/Cardano/Pool/DB.hs
@@ -1,4 +1,5 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}

@@ -20,9 +21,10 @@ import Prelude

import Cardano.Wallet.Primitive.Types
( BlockHeader, EpochNo (..), PoolId, SlotId (..) )
import Control.Monad.Fail
( MonadFail )
import Control.Monad.Trans.Except
( ExceptT )
import Control.Monad.Fail (MonadFail)
import Data.Map.Strict
( Map )
import Data.Quantity
@@ -31,6 +33,16 @@ import Data.Word
( Word64 )

-- | A Database interface for storing pool production in DB.
--
-- To use it, you will need the NamedFieldPuns extension and wrap operations
-- with @atomically@:
--
-- Example:
-- >>> :set -XNamedFieldPuns
-- >>> DBLayer{atomically,putPoolProduction} = db
-- >>> atomically $ putPoolProduction blockHeader pool
--
-- This gives you the power to also run /multiple/ operations atomically.
data DBLayer m2 = forall m. MonadFail m => DBLayer
{ putPoolProduction
:: BlockHeader
@@ -74,6 +86,9 @@ data DBLayer m2 = forall m. MonadFail m => DBLayer
-- ^ Clean a database
, atomically
:: forall a. m a -> m2 a
-- ^ Run an operation.
--
-- For a Sqlite DB, this would be "run a query inside a transaction".
}

-- | Forbidden operation was executed on an already existing slot

0 comments on commit 528ee67

Please sign in to comment.
You can’t perform that action at this time.