Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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 ∷ ∀ blk. GetPrevHash blk ⇒ DBModel blk → Either (VolatileDBError blk) (ChainHash blk → Set (HeaderHash blk))
- garbageCollectModel ∷ ∀ blk. HasHeader blk ⇒ SlotNo → DBModel blk → Either (VolatileDBError blk) (DBModel blk)
- getBlockComponentModel ∷ ∀ blk b. (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 ∷ ∀ blk. 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
DBModel | |
|
Instances
Generic (DBModel blk) Source # | |
(Show blk, Show (CodecConfig blk)) ⇒ Show (DBModel blk) Source # | |
(ToExpr blk, ToExpr (CodecConfig blk)) ⇒ ToExpr (DBModel blk) Source # | |
type Rep (DBModel blk) Source # | |
Defined in Test.Ouroboros.Storage.VolatileDB.Model type Rep (DBModel blk) = D1 ('MetaData "DBModel" "Test.Ouroboros.Storage.VolatileDB.Model" "ouroboros-consensus-0.21.0.0-inplace-storage-test" 'False) (C1 ('MetaCons "DBModel" 'PrefixI 'True) ((S1 ('MetaSel ('Just "blocksPerFile") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BlocksPerFile) :*: S1 ('MetaSel ('Just "open") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)) :*: (S1 ('MetaSel ('Just "fileIndex") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map FileId (BlocksInFile blk))) :*: S1 ('MetaSel ('Just "codecConfig") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (CodecConfig blk))))) |
initDBModel ∷ BlocksPerFile → CodecConfig blk → DBModel blk Source #
Basic API
closeModel ∷ DBModel blk → DBModel blk Source #
filterByPredecessorModel ∷ ∀ blk. GetPrevHash blk ⇒ DBModel blk → Either (VolatileDBError blk) (ChainHash blk → Set (HeaderHash blk)) Source #
garbageCollectModel ∷ ∀ blk. HasHeader blk ⇒ SlotNo → DBModel blk → Either (VolatileDBError blk) (DBModel blk) Source #
getBlockComponentModel ∷ ∀ blk b. (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 ∷ ∀ blk. 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.
BlocksInFile | |
|
Instances
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 #