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

Database.LSMTree.Internal.MergingTree.Lookup

Synopsis

Documentation

data LookupTree a Source #

A simplified representation of the shape of a MergingTree.

Constructors

LookupBatch !a 
LookupNode

Use mkLookupNode to construct this.

Fields

Instances

Instances details
Foldable LookupTree Source # 
Instance details

Defined in Database.LSMTree.Internal.MergingTree.Lookup

Methods

fold :: Monoid m => LookupTree m -> m #

foldMap :: Monoid m => (a -> m) -> LookupTree a -> m #

foldMap' :: Monoid m => (a -> m) -> LookupTree a -> m #

foldr :: (a -> b -> b) -> b -> LookupTree a -> b #

foldr' :: (a -> b -> b) -> b -> LookupTree a -> b #

foldl :: (b -> a -> b) -> b -> LookupTree a -> b #

foldl' :: (b -> a -> b) -> b -> LookupTree a -> b #

foldr1 :: (a -> a -> a) -> LookupTree a -> a #

foldl1 :: (a -> a -> a) -> LookupTree a -> a #

toList :: LookupTree a -> [a] #

null :: LookupTree a -> Bool #

length :: LookupTree a -> Int #

elem :: Eq a => a -> LookupTree a -> Bool #

maximum :: Ord a => LookupTree a -> a #

minimum :: Ord a => LookupTree a -> a #

sum :: Num a => LookupTree a -> a #

product :: Num a => LookupTree a -> a #

mapMStrict :: Monad m => (a -> m b) -> LookupTree a -> m (LookupTree b) Source #

Deriving Traversable leads to functions that are not strict in the elements of the vector of children. This function avoids that issue.

mkLookupNode :: TreeMergeType -> Vector (LookupTree a) -> LookupTree a Source #

Asserts that the vector is non-empty. Collapses singleton nodes.

buildLookupTree :: (PrimMonad m, MonadMVar m, MonadMask m) => ActionRegistry m -> Ref (MergingTree m h) -> m (LookupTree (Vector (Ref (Run m h)))) Source #

Create a LookupTree of batches of runs, e.g. to do lookups on. The entries within each batch are to be combined using MergeLevel.

Assumes that the merging tree is not isStructurallyEmpty.

This function duplicates the references to all the tree's runs. These references later need to be released.

foldLookupTree :: MonadAsync m => ResolveSerialisedValue -> LookupTree (Async m (LookupAcc m h)) -> m (LookupAcc m h) Source #

Combine a tree of accs into a single one, using the TreeMergeType of each node.