mirror of https://github.com/voidlizard/hbs2
wip
This commit is contained in:
parent
8ea7958f08
commit
eb0dfe0b2d
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue