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

Database.LSMTree.Extras.Generators

Synopsis

WithSerialised

data WithSerialised k Source #

Cache serialised keys

Also useful for failing tests that have keys as inputs, because the printed WithSerialised values will show both keys and their serialised form.

A (logical/true) page

A true page

data TruePageSummary k Source #

A summary of minmax information for keys on a true/ page.

A true page corresponds directly to a disk page. See LogicalPageSummary for contrast.

Constructors

TruePageSummary 

Fields

A logical page

data LogicalPageSummary k Source #

A summary of minmax information for keys on a logical/ page.

A key/operation pair can fit onto a single page, or the operation is so large that its bytes flow over into subsequent pages. A logical page makes this overflow explicit. Making these cases explicit in the representation makes generating and shrinking test cases easier.

Constructors

OnePageOneKey k 
OnePageManyKeys k k 
MultiPageOneKey k Word32

number of overflow pages

Instances

Instances details
Functor LogicalPageSummary Source # 
Instance details

Defined in Database.LSMTree.Extras.Generators

(Arbitrary k, Ord k) => Arbitrary (LogicalPageSummaries k) Source # 
Instance details

Defined in Database.LSMTree.Extras.Generators

Generic (LogicalPageSummary k) Source # 
Instance details

Defined in Database.LSMTree.Extras.Generators

Associated Types

type Rep (LogicalPageSummary k) :: Type -> Type #

Show k => Show (LogicalPageSummary k) Source # 
Instance details

Defined in Database.LSMTree.Extras.Generators

NFData k => NFData (LogicalPageSummary k) Source # 
Instance details

Defined in Database.LSMTree.Extras.Generators

Methods

rnf :: LogicalPageSummary k -> () #

type Rep (LogicalPageSummary k) Source # 
Instance details

Defined in Database.LSMTree.Extras.Generators

Sequences of (logical/true) pages

newtype Pages fp k Source #

Sequences of (logical/true) pages

INVARIANT: The sequence consists of multiple pages in sorted order (keys are sorted within a page and across pages).

Constructors

Pages 

Fields

Instances

Instances details
(Arbitrary k, Ord k) => Arbitrary (LogicalPageSummaries k) Source # 
Instance details

Defined in Database.LSMTree.Extras.Generators

Functor fp => Functor (Pages fp) Source # 
Instance details

Defined in Database.LSMTree.Extras.Generators

Methods

fmap :: (a -> b) -> Pages fp a -> Pages fp b #

(<$) :: a -> Pages fp b -> Pages fp a #

Generic (Pages fp k2) Source # 
Instance details

Defined in Database.LSMTree.Extras.Generators

Associated Types

type Rep (Pages fp k2) :: Type -> Type #

Methods

from :: Pages fp k2 -> Rep (Pages fp k2) x #

to :: Rep (Pages fp k2) x -> Pages fp k2 #

Show (fp k2) => Show (Pages fp k2) Source # 
Instance details

Defined in Database.LSMTree.Extras.Generators

Methods

showsPrec :: Int -> Pages fp k2 -> ShowS #

show :: Pages fp k2 -> String #

showList :: [Pages fp k2] -> ShowS #

NFData (fp k2) => NFData (Pages fp k2) Source # 
Instance details

Defined in Database.LSMTree.Extras.Generators

Methods

rnf :: Pages fp k2 -> () #

type Rep (Pages fp k2) Source # 
Instance details

Defined in Database.LSMTree.Extras.Generators

type Rep (Pages fp k2) = D1 ('MetaData "Pages" "Database.LSMTree.Extras.Generators" "lsm-tree-0.1.0.0-inplace-extras" 'True) (C1 ('MetaCons "Pages" 'PrefixI 'True) (S1 ('MetaSel ('Just "getPages") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [fp k2])))

Sequences of true pages

Sequences of logical pages

genPages Source #

Arguments

:: (Arbitrary k, Ord k) 
=> Double

Probability of a value being larger-than-page

-> Gen Word32

Number of overflow pages for a larger-than-page value

-> Double

Probability of generating a page with only one key and value, which does not span multiple pages.

-> Gen (LogicalPageSummaries k) 

mkPages Source #

Arguments

:: forall k. Ord k 
=> Double

Probability of a value being larger-than-page

-> Gen Word32

Number of overflow pages for a larger-than-page value

-> Double

Probability of generating a page with only one key and value, which does not span multiple pages.

-> [k] 
-> Gen (LogicalPageSummaries k) 

Chunking size

Serialised keys/values/blobs

newtype KeyForIndexCompact Source #

helpers

shrinkVec :: Prim a => (a -> [a]) -> Vector a -> [Vector a] Source #

Based on QuickCheck's shrinkList (behaves identically, see tests).

Orphan instances

Arbitrary BlobSpan Source # 
Instance details

Arbitrary NumEntries Source # 
Instance details

Arbitrary LevelMergeType Source # 
Instance details

Arbitrary MergeType Source # 
Instance details

Arbitrary TreeMergeType Source # 
Instance details

Arbitrary PageNo Source # 
Instance details

Arbitrary RawBytes Source # 
Instance details

Arbitrary SerialisedBlob Source # 
Instance details

Arbitrary SerialisedKey Source # 
Instance details

Arbitrary SerialisedValue Source # 
Instance details

Arbitrary1 Update Source # 
Instance details

Methods

liftArbitrary :: Gen a -> Gen (Update a) Source #

liftShrink :: (a -> [a]) -> Update a -> [Update a] Source #

Arbitrary2 Update Source # 
Instance details

Methods

liftArbitrary2 :: Gen a -> Gen b -> Gen (Update a b) Source #

liftShrink2 :: (a -> [a]) -> (b -> [b]) -> Update a b -> [Update a b] Source #

Arbitrary2 Entry Source # 
Instance details

Methods

liftArbitrary2 :: Gen a -> Gen b -> Gen (Entry a b) Source #

liftShrink2 :: (a -> [a]) -> (b -> [b]) -> Entry a b -> [Entry a b] Source #

Arbitrary2 Update Source # 
Instance details

Methods

liftArbitrary2 :: Gen a -> Gen b -> Gen (Update a b) Source #

liftShrink2 :: (a -> [a]) -> (b -> [b]) -> Update a b -> [Update a b] Source #

(Arbitrary k, Ord k) => Arbitrary (Range k) Source # 
Instance details

Methods

arbitrary :: Gen (Range k) Source #

shrink :: Range k -> [Range k] Source #

Arbitrary v => Arbitrary (Update v) Source # 
Instance details

Methods

arbitrary :: Gen (Update v) Source #

shrink :: Update v -> [Update v] Source #

(Arbitrary v, Arbitrary b) => Arbitrary (Update v b) Source # 
Instance details

Methods

arbitrary :: Gen (Update v b) Source #

shrink :: Update v b -> [Update v b] Source #

(Arbitrary v, Arbitrary b) => Arbitrary (Entry v b) Source # 
Instance details

Methods

arbitrary :: Gen (Entry v b) Source #

shrink :: Entry v b -> [Entry v b] Source #

Arbitrary (Unsliced SerialisedKey) Source # 
Instance details

(Arbitrary v, Arbitrary b) => Arbitrary (Update v b) Source # 
Instance details

Methods

arbitrary :: Gen (Update v b) Source #

shrink :: Update v b -> [Update v b] Source #