| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Ouroboros.Consensus.Storage.VolatileDB.API
Synopsis
- data VolatileDB m blk = VolatileDB {
- closeDB :: HasCallStack => m ()
- getBlockComponent :: forall b. HasCallStack => BlockComponent blk b -> HeaderHash blk -> m (Maybe b)
- putBlock :: HasCallStack => blk -> m ()
- filterByPredecessor :: HasCallStack => STM m (ChainHash blk -> Set (HeaderHash blk))
- getBlockInfo :: HasCallStack => STM m (HeaderHash blk -> Maybe (BlockInfo blk))
- garbageCollect :: HasCallStack => SlotNo -> m ()
- getMaxSlotNo :: HasCallStack => STM m MaxSlotNo
- data BlockInfo blk = BlockInfo {
- biHash :: !(HeaderHash blk)
- biSlotNo :: !SlotNo
- biBlockNo :: !BlockNo
- biPrevHash :: !(ChainHash blk)
- biIsEBB :: !IsEBB
- biHeaderOffset :: !Word16
- biHeaderSize :: !Word16
- data VolatileDBError
- data ApiMisuse = ClosedDBError (Maybe SomeException)
- data UnexpectedFailure
- = FileSystemError FsError
- | forall blk.(Typeable blk, StandardHash blk) => ParseError FsPath (RealPoint blk) DeserialiseFailure
- | forall blk.(Typeable blk, StandardHash blk) => TrailingDataError FsPath (RealPoint blk) ByteString
- | forall blk.(Typeable blk, StandardHash blk) => MissingBlockError (Proxy blk) (HeaderHash blk)
- | forall blk.(Typeable blk, StandardHash blk) => CorruptBlockError (Proxy blk) (HeaderHash blk)
- withDB :: (HasCallStack, MonadThrow m) => m (VolatileDB m blk) -> (VolatileDB m blk -> m a) -> m a
- getIsMember :: Functor (STM m) => VolatileDB m blk -> STM m (HeaderHash blk -> Bool)
- getPredecessor :: Functor (STM m) => VolatileDB m blk -> STM m (HeaderHash blk -> Maybe (ChainHash blk))
- getKnownBlockComponent :: (MonadThrow m, HasHeader blk) => VolatileDB m blk -> BlockComponent blk b -> HeaderHash blk -> m b
API
data VolatileDB m blk Source #
Constructors
| VolatileDB | |
Fields
| |
Instances
| NoThunks (VolatileDB m blk) Source # | |
Defined in Ouroboros.Consensus.Storage.VolatileDB.API | |
Types
The information that the user has to provide for each new block.
Constructors
| BlockInfo | |
Fields
| |
Instances
Errors
data VolatileDBError Source #
Errors which might arise when working with this database.
Constructors
| ApiMisuse ApiMisuse | An error thrown because of incorrect usage of the VolatileDB by the user. |
| UnexpectedFailure UnexpectedFailure | An unexpected failure thrown because something went wrong. |
Instances
| Show VolatileDBError Source # | |
Defined in Ouroboros.Consensus.Storage.VolatileDB.API Methods showsPrec :: Int -> VolatileDBError -> ShowS # show :: VolatileDBError -> String # showList :: [VolatileDBError] -> ShowS # | |
| Exception VolatileDBError Source # | |
Defined in Ouroboros.Consensus.Storage.VolatileDB.API Methods toException :: VolatileDBError -> SomeException # | |
Constructors
| ClosedDBError (Maybe SomeException) | The VolatileDB was closed. In case it was automatically closed because an unexpected error was thrown during a read operation or any exception was thrown during a write operation, that exception is embedded. |
data UnexpectedFailure Source #
Constructors
| FileSystemError FsError | |
| forall blk.(Typeable blk, StandardHash blk) => ParseError FsPath (RealPoint blk) DeserialiseFailure | A block failed to parse |
| forall blk.(Typeable blk, StandardHash blk) => TrailingDataError FsPath (RealPoint blk) ByteString | When parsing a block we got some trailing data |
| forall blk.(Typeable blk, StandardHash blk) => MissingBlockError (Proxy blk) (HeaderHash blk) | Block missing This exception gets thrown when a block that we know it should be in the VolatileDB, nonetheless was not found. This exception will be thrown by |
| forall blk.(Typeable blk, StandardHash blk) => CorruptBlockError (Proxy blk) (HeaderHash blk) | A (parsed) block did not pass the integrity check. This exception gets thrown when a block doesn't pass the integrity check
done for NOTE: we do not check the integrity of a block when it is added to the VolatileDB. While this exception typically means the block has been corrupted, it could also mean the block didn't pass the check at the time it was added. |
Instances
| Show UnexpectedFailure Source # | |
Defined in Ouroboros.Consensus.Storage.VolatileDB.API Methods showsPrec :: Int -> UnexpectedFailure -> ShowS # show :: UnexpectedFailure -> String # showList :: [UnexpectedFailure] -> ShowS # | |
Derived functionality
Arguments
| :: (HasCallStack, MonadThrow m) | |
| => m (VolatileDB m blk) | How to open the database |
| -> (VolatileDB m blk -> m a) | Action to perform using the database |
| -> m a |
Open the database using the given function, perform the given action
using the database, and closes the database using its closeDB function,
in case of success or when an exception was raised.
getIsMember :: Functor (STM m) => VolatileDB m blk -> STM m (HeaderHash blk -> Bool) Source #
getPredecessor :: Functor (STM m) => VolatileDB m blk -> STM m (HeaderHash blk -> Maybe (ChainHash blk)) Source #
getKnownBlockComponent :: (MonadThrow m, HasHeader blk) => VolatileDB m blk -> BlockComponent blk b -> HeaderHash blk -> m b Source #