diff --git a/hbs2-storage-simple/hbs2-storage-simple.cabal b/hbs2-storage-simple/hbs2-storage-simple.cabal index 4eccfd58..59dfc310 100644 --- a/hbs2-storage-simple/hbs2-storage-simple.cabal +++ b/hbs2-storage-simple/hbs2-storage-simple.cabal @@ -59,6 +59,7 @@ library import: shared-properties exposed-modules: HBS2.Storage.Simple , HBS2.Storage.Simple.Extra + , HBS2.Storage.Compact -- other-modules: -- other-extensions: build-depends: base, hbs2-core @@ -84,6 +85,7 @@ library , unordered-containers , temporary , filepattern + , unliftio hs-source-dirs: lib diff --git a/hbs2-storage-simple/lib/HBS2/Storage/Compact.hs b/hbs2-storage-simple/lib/HBS2/Storage/Compact.hs new file mode 100644 index 00000000..48e4fb71 --- /dev/null +++ b/hbs2-storage-simple/lib/HBS2/Storage/Compact.hs @@ -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 + +