lsm-tree-0.1.0.0: Log-structured merge-trees
Safe HaskellSafe-Inferred
LanguageGHC2021

Database.LSMTree.Internal.Index.CompactAcc

Description

Incremental construction of a compact index yields chunks of the primary array that can be serialised incrementally.

Incremental construction is an ST computation that can be started using new, returning an IndexCompactAcc structure that accumulates internal state. appending new pages to the IndexCompactAcc might yield Chunks. Incremental construction can be finalised with unsafeEnd, which yields both a Chunk (possibly) and the IndexCompact.

Synopsis

Construction

data IndexCompactAcc s Source #

A mutable version of IndexCompact. See incremental construction.

Constructors

IndexCompactAcc 

Fields

new :: Int -> ST s (IndexCompactAcc s) Source #

new maxcsize creates a new mutable index with a maximum chunk size of maxcsize.

PRECONDITION: maxcsize > 0

Note: after initialisation, maxcsize can no longer be changed.

newWithDefaults :: ST s (IndexCompactAcc s) Source #

For a specification of this operation, see the documentation of its type-agnostic version.

appendSingle :: forall s. (SerialisedKey, SerialisedKey) -> IndexCompactAcc s -> ST s (Maybe Chunk) Source #

For a specification of this operation, see the documentation of its type-agnostic version.

appendMulti :: forall s. (SerialisedKey, Word32) -> IndexCompactAcc s -> ST s [Chunk] Source #

For a specification of this operation, see the documentation of its type-agnostic version.

unsafeEnd :: IndexCompactAcc s -> ST s (Maybe Chunk, IndexCompact) Source #

For a specification of this operation, see the documentation of its type-agnostic version.

Internal: exported for testing and benchmarking

data SMaybe a Source #

Constructors

SNothing 
SJust !a 

Instances

Instances details
Show a => Show (SMaybe a) Source # 
Instance details

Defined in Database.LSMTree.Internal.Index.CompactAcc

Methods

showsPrec :: Int -> SMaybe a -> ShowS #

show :: SMaybe a -> String #

showList :: [SMaybe a] -> ShowS #

Eq a => Eq (SMaybe a) Source # 
Instance details

Defined in Database.LSMTree.Internal.Index.CompactAcc

Methods

(==) :: SMaybe a -> SMaybe a -> Bool #

(/=) :: SMaybe a -> SMaybe a -> Bool #

unsafeWriteRange :: Unbox a => MVector s a -> Bound Int -> Bound Int -> a -> ST s () Source #

vectorLowerBound :: Bound Int -> Int Source #

Map a Bound to the equivalent inclusive lower bound.

mvectorUpperBound :: MVector v a => v s a -> Bound Int -> Int Source #

Map a Bound to the equivalent inclusive upper bound.