This commit is contained in:
Dmitry Zuikov 2024-05-29 12:04:13 +03:00
parent 8ea7958f08
commit eb0dfe0b2d
2 changed files with 51 additions and 0 deletions

View File

@ -59,6 +59,7 @@ library
import: shared-properties import: shared-properties
exposed-modules: HBS2.Storage.Simple exposed-modules: HBS2.Storage.Simple
, HBS2.Storage.Simple.Extra , HBS2.Storage.Simple.Extra
, HBS2.Storage.Compact
-- other-modules: -- other-modules:
-- other-extensions: -- other-extensions:
build-depends: base, hbs2-core build-depends: base, hbs2-core
@ -84,6 +85,7 @@ library
, unordered-containers , unordered-containers
, temporary , temporary
, filepattern , filepattern
, unliftio
hs-source-dirs: lib hs-source-dirs: lib

View File

@ -0,0 +1,49 @@
module HBS2.Storage.Compact
( CompactStorage
) where
import Data.Word
import Data.ByteString
import Data.Coerce
import Codec.Serialise
import GHC.Generics
import System.IO
import UnliftIO
-- compact storage
-- for the off-tree data representation
-- may be it will be faster, than Simple storage
-- who knows
newtype EntryOffset = EntryOffset Word64
deriving newtype (Ord,Eq,Num,Enum,Real)
deriving stock Generic
newtype EntrySize = EntrySize Word64
deriving newtype (Ord,Eq,Num,Enum,Real)
deriving stock Generic
data IndexEntry =
IndexEntry
{ idxEntryPrev :: Maybe Word64
, idxEntryOffset :: EntryOffset
, idxEntrySize :: EntrySize
, idxEntryKey :: ByteString
}
deriving stock Generic
data CompactStorage =
CompactStorage
{ csHandle :: Handle
}
type ForCompactStorage m = MonadIO m
compactStorageOpen :: ForCompactStorage m => FilePath -> m CompactStorage
compactStorageOpen fp = undefined