Safe Haskell | None |
---|---|
Language | Haskell2010 |
Test.Ouroboros.Storage.VolatileDB.Model
Description
In-memory model implementation of VolatileDB
Synopsis
- data DBModel blk = DBModel {
- blocksPerFile ∷ BlocksPerFile
- open ∷ Bool
- fileIndex ∷ Map FileId (BlocksInFile blk)
- codecConfig ∷ CodecConfig blk
- initDBModel ∷ BlocksPerFile → CodecConfig blk → DBModel blk
- closeModel ∷ DBModel blk → DBModel blk
- filterByPredecessorModel ∷ GetPrevHash blk ⇒ DBModel blk → Either (VolatileDBError blk) (ChainHash blk → Set (HeaderHash blk))
- garbageCollectModel ∷ HasHeader blk ⇒ SlotNo → DBModel blk → Either (VolatileDBError blk) (DBModel blk)
- getBlockComponentModel ∷ (HasHeader blk, GetHeader blk, HasBinaryBlockInfo blk, EncodeDisk blk blk, HasNestedContent Header blk) ⇒ BlockComponent blk b → HeaderHash blk → DBModel blk → Either (VolatileDBError blk) (Maybe b)
- getBlockInfoModel ∷ (GetPrevHash blk, HasBinaryBlockInfo blk) ⇒ DBModel blk → Either (VolatileDBError blk) (HeaderHash blk → Maybe (BlockInfo blk))
- getMaxSlotNoModel ∷ HasHeader blk ⇒ DBModel blk → Either (VolatileDBError blk) MaxSlotNo
- isOpenModel ∷ DBModel blk → Bool
- putBlockModel ∷ HasHeader blk ⇒ blk → DBModel blk → Either (VolatileDBError blk) (DBModel blk)
- reOpenModel ∷ DBModel blk → DBModel blk
- runCorruptionsModel ∷ EncodeDisk blk blk ⇒ Corruptions → DBModel blk → DBModel blk
- newtype BlocksInFile blk = BlocksInFile {
- getBlocksInFile ∷ [blk]
- blockHashes ∷ HasHeader blk ⇒ DBModel blk → [HeaderHash blk]
- blockIndex ∷ HasHeader blk ⇒ DBModel blk → Map (HeaderHash blk) blk
- getCurrentFile ∷ DBModel blk → FsPath
- getDBFileIds ∷ DBModel blk → [FileId]
- getDBFiles ∷ DBModel blk → [FsPath]
Documentation
Constructors
DBModel | |
Fields
|
Instances
initDBModel ∷ BlocksPerFile → CodecConfig blk → DBModel blk Source #
Basic API
closeModel ∷ DBModel blk → DBModel blk Source #
filterByPredecessorModel ∷ GetPrevHash blk ⇒ DBModel blk → Either (VolatileDBError blk) (ChainHash blk → Set (HeaderHash blk)) Source #
garbageCollectModel ∷ HasHeader blk ⇒ SlotNo → DBModel blk → Either (VolatileDBError blk) (DBModel blk) Source #
getBlockComponentModel ∷ (HasHeader blk, GetHeader blk, HasBinaryBlockInfo blk, EncodeDisk blk blk, HasNestedContent Header blk) ⇒ BlockComponent blk b → HeaderHash blk → DBModel blk → Either (VolatileDBError blk) (Maybe b) Source #
getBlockInfoModel ∷ (GetPrevHash blk, HasBinaryBlockInfo blk) ⇒ DBModel blk → Either (VolatileDBError blk) (HeaderHash blk → Maybe (BlockInfo blk)) Source #
getMaxSlotNoModel ∷ HasHeader blk ⇒ DBModel blk → Either (VolatileDBError blk) MaxSlotNo Source #
isOpenModel ∷ DBModel blk → Bool Source #
putBlockModel ∷ HasHeader blk ⇒ blk → DBModel blk → Either (VolatileDBError blk) (DBModel blk) Source #
reOpenModel ∷ DBModel blk → DBModel blk Source #
Corruptions
runCorruptionsModel ∷ EncodeDisk blk blk ⇒ Corruptions → DBModel blk → DBModel blk Source #
Exported for testing purposes
newtype BlocksInFile blk Source #
The blocks in a file, in the same order as they would be written to the file in the real implementation.
Constructors
BlocksInFile | |
Fields
|
Instances
Generic (BlocksInFile blk) Source # | |||||
Defined in Test.Ouroboros.Storage.VolatileDB.Model Associated Types
Methods from ∷ BlocksInFile blk → Rep (BlocksInFile blk) x # to ∷ Rep (BlocksInFile blk) x → BlocksInFile blk # | |||||
Show blk ⇒ Show (BlocksInFile blk) Source # | |||||
Defined in Test.Ouroboros.Storage.VolatileDB.Model Methods showsPrec ∷ Int → BlocksInFile blk → ShowS # show ∷ BlocksInFile blk → String # showList ∷ [BlocksInFile blk] → ShowS # | |||||
ToExpr blk ⇒ ToExpr (BlocksInFile blk) Source # | |||||
Defined in Test.Ouroboros.Storage.VolatileDB.Model | |||||
type Rep (BlocksInFile blk) Source # | |||||
Defined in Test.Ouroboros.Storage.VolatileDB.Model type Rep (BlocksInFile blk) = D1 ('MetaData "BlocksInFile" "Test.Ouroboros.Storage.VolatileDB.Model" "ouroboros-consensus-0.26.0.0-inplace-storage-test" 'True) (C1 ('MetaCons "BlocksInFile" 'PrefixI 'True) (S1 ('MetaSel ('Just "getBlocksInFile") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [blk]))) |
blockHashes ∷ HasHeader blk ⇒ DBModel blk → [HeaderHash blk] Source #
blockIndex ∷ HasHeader blk ⇒ DBModel blk → Map (HeaderHash blk) blk Source #
getCurrentFile ∷ DBModel blk → FsPath Source #
getDBFileIds ∷ DBModel blk → [FileId] Source #
getDBFiles ∷ DBModel blk → [FsPath] Source #