ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Registry.Sweep.Walk

Description

Bounded name-prefix walks with resumable bucket cursors. Listings have no stable order. Oversized buckets split until the depth bound.

Synopsis

Documentation

bucketNameBudget :: Int Source #

Maximum distinct package names held in one bucket across its target inventories.

bucketDepthLimit :: Int Source #

How far a bucket may be narrowed. Past it the names share a prefix this long and narrowing has stopped dividing them, so the walk reports rather than descending without end.

walkBuckets :: NameAlphabet -> [NamePrefix] Source #

The buckets a walk covers, in the order it covers them.

resumeAfter :: Maybe NamePrefix -> [NamePrefix] -> [NamePrefix] Source #

The buckets still to cover, given the one last completed. A bucket the record falls inside is kept, because the walk stopped part way through that bucket's own split.

data BucketNames fault a Source #

What reading one bucket's listing produced.

Constructors

BucketRead [a]

The bucket was read whole, its names sorted.

BucketOverflowed (NonEmpty NamePrefix)

The bucket outgrew the budget, so these narrower ones cover it instead.

BucketUnsplittable

The bucket outgrew the budget and nothing narrows it further.

BucketFaulted fault

The listing stopped on a fault, and nothing was read.

Instances

Instances details
Functor (BucketNames fault) Source # 
Instance details

Defined in Ecluse.Core.Registry.Sweep.Walk

Methods

fmap :: (a -> b) -> BucketNames fault a -> BucketNames fault b #

(<$) :: a -> BucketNames fault b -> BucketNames fault a #

collectBucketWith :: NameAlphabet -> NamePrefix -> (a -> a -> a) -> ConduitT () [(PackageName, a)] IO (Maybe fault) -> IO (BucketNames fault (PackageName, a)) Source #

Merge one bucket's listing pages under the distinct-name bound, keeping each name's evidence.

insertInventory :: Ord key => Int -> (value -> value -> value) -> Map key value -> (key, value) -> Maybe (Map key value) Source #

Refuse a new inventory identity before insertion would cross the bound. Existing ones merge.