Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data VolatileDB m blk = VolatileDB {
- closeDB ∷ HasCallStack ⇒ m ()
- getBlockComponent ∷ ∀ 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
- newtype ApiMisuse = ClosedDBError (Maybe SomeException)
- data UnexpectedFailure blk
- = FileSystemError FsError
- | ParseError FsPath (RealPoint blk) DeserialiseFailure
- | TrailingDataError FsPath (RealPoint blk) ByteString
- | MissingBlockError (HeaderHash blk)
- | CorruptBlockError (HeaderHash blk)
- data VolatileDBError blk
- getIsMember ∷ Functor (STM m) ⇒ VolatileDB m blk → STM m (HeaderHash blk → Bool)
- getKnownBlockComponent ∷ (MonadThrow m, HasHeader blk) ⇒ VolatileDB m blk → BlockComponent blk b → HeaderHash blk → m b
- getPredecessor ∷ Functor (STM m) ⇒ VolatileDB m blk → STM m (HeaderHash blk → Maybe (ChainHash blk))
- withDB ∷ (HasCallStack, MonadThrow m) ⇒ m (VolatileDB m blk) → (VolatileDB m blk → m a) → m a
API
data VolatileDB m blk Source #
VolatileDB | |
|
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.
BlockInfo | |
|
Instances
Errors
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 blk Source #
FileSystemError FsError | |
ParseError FsPath (RealPoint blk) DeserialiseFailure | A block failed to parse |
TrailingDataError FsPath (RealPoint blk) ByteString | When parsing a block we got some trailing data |
MissingBlockError (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 |
CorruptBlockError (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
(Typeable blk, StandardHash blk) ⇒ Show (UnexpectedFailure blk) Source # | |
Defined in Ouroboros.Consensus.Storage.VolatileDB.API showsPrec ∷ Int → UnexpectedFailure blk → ShowS # show ∷ UnexpectedFailure blk → String # showList ∷ [UnexpectedFailure blk] → ShowS # |
data VolatileDBError blk Source #
Errors which might arise when working with this database.
ApiMisuse ApiMisuse | An error thrown because of incorrect usage of the VolatileDB by the user. |
UnexpectedFailure (UnexpectedFailure blk) | An unexpected failure thrown because something went wrong. |
Instances
(StandardHash blk, Typeable blk) ⇒ Exception (VolatileDBError blk) Source # | |
Defined in Ouroboros.Consensus.Storage.VolatileDB.API toException ∷ VolatileDBError blk → SomeException # fromException ∷ SomeException → Maybe (VolatileDBError blk) # displayException ∷ VolatileDBError blk → String # | |
(StandardHash blk, Typeable blk) ⇒ Show (VolatileDBError blk) Source # | |
Defined in Ouroboros.Consensus.Storage.VolatileDB.API showsPrec ∷ Int → VolatileDBError blk → ShowS # show ∷ VolatileDBError blk → String # showList ∷ [VolatileDBError blk] → ShowS # |
Derived functionality
getIsMember ∷ Functor (STM m) ⇒ VolatileDB m blk → STM m (HeaderHash blk → Bool) Source #
getKnownBlockComponent ∷ (MonadThrow m, HasHeader blk) ⇒ VolatileDB m blk → BlockComponent blk b → HeaderHash blk → m b Source #
getPredecessor ∷ Functor (STM m) ⇒ VolatileDB m blk → STM m (HeaderHash blk → Maybe (ChainHash blk)) Source #
∷ (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.