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

KMerge.LoserTree

Synopsis

Documentation

data MutableLoserTree s a Source #

Mutable Loser Tree.

newLoserTree :: forall a m. (PrimMonad m, Ord a) => NonEmpty a -> m (MutableLoserTree (PrimState m) a, a) Source #

Create new MutableLoserTree.

The second half of a pair is the winner value (only losers are stored in the tree).

replace :: forall a m. (PrimMonad m, Ord a) => MutableLoserTree (PrimState m) a -> a -> m a Source #

Fill the winner "hole" with a new element. Return a new tournament winner.

remove :: forall a m. (PrimMonad m, Ord a) => MutableLoserTree (PrimState m) a -> m (Maybe a) Source #

Don't fill the winner "hole". Return a next winner of (smaller) tournament.