ouroboros-consensus-0.1.0.0: Consensus layer for the Ouroboros blockchain protocol
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Consensus.Storage.VolatileDB.Impl.Util

Synopsis

FileId utilities

parseAllFds :: [FsPath] -> ([(FileId, FsPath)], [FsPath]) Source #

Parses the FileId of each FsPath and zips them together. Returns the results sorted on the FileId.

Return separately any FsPath which failed to parse.

findLastFd :: [FsPath] -> (Maybe FileId, [FsPath]) Source #

This also returns any FsPath which failed to parse.

Exception handling

wrapFsError :: MonadCatch m => m a -> m a Source #

tryVolatileDB :: forall m a. MonadCatch m => m a -> m (Either VolatileDBError a) Source #

Execute an action and catch the VolatileDBError and FsError that can be thrown by it, and wrap the FsError in an VolatileDBError using the FileSystemError constructor.

This should be used whenever you want to run an action on the VolatileDB and catch the VolatileDBError and the FsError (wrapped in the former) it may thrown.

Map of Set utilities

insertMapSet :: forall k v. (Ord k, Ord v) => k -> v -> Map k (Set v) -> Map k (Set v) Source #

deleteMapSet :: forall k v. (Ord k, Ord v) => k -> v -> Map k (Set v) -> Map k (Set v) Source #