Skip to content

Commit 636f233

Browse files
committed
Document leftover credits
1 parent 8a324d4 commit 636f233

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

prototypes/ScheduledMerges.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,10 @@ newtype UnionCredits = UnionCredits Credit
877877
-- debt will be reduced by /at least/ the number of supplied union credits. It
878878
-- is therefore advisable to query 'remainingUnionDebt' every once in a while to
879879
-- see what the current debt is.
880+
--
881+
-- This function returns any surplus of union credits as /leftover/ credits when
882+
-- a union has finished. In particular, if the returned number of credits is
883+
-- non-negative, then the union is finished.
880884
supplyUnionCredits :: LSM s -> UnionCredits -> ST s UnionCredits
881885
supplyUnionCredits (LSMHandle scr lsmr) (UnionCredits credits)
882886
| credits <= 0 = return (UnionCredits 0)

src/Database/LSMTree/Monoidal.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,10 @@ remainingUnionDebt (Internal.MonoidalTable t) =
721721
-- debt will be reduced by /at least/ the number of supplied union credits. It
722722
-- is therefore advisable to query @remainingUnionDebt@ every once in a while to
723723
-- see what the current debt is.
724+
--
725+
-- This function returns any surplus of union credits as /leftover/ credits when
726+
-- a union has finished. In particular, if the returned number of credits is
727+
-- non-negative, then the union is finished.
724728
supplyUnionCredits ::
725729
IOLike m
726730
=> Table m k v

src/Database/LSMTree/Normal.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,10 @@ remainingUnionDebt (Internal.NormalTable t) =
841841
-- debt will be reduced by /at least/ the number of supplied union credits. It
842842
-- is therefore advisable to query @remainingUnionDebt@ every once in a while to
843843
-- see what the current debt is.
844+
--
845+
-- This function returns any surplus of union credits as /leftover/ credits when
846+
-- a union has finished. In particular, if the returned number of credits is
847+
-- non-negative, then the union is finished.
844848
supplyUnionCredits ::
845849
IOLike m
846850
=> Table m k v b

0 commit comments

Comments
 (0)