countmin-0.1.0.0: A Count Min sketch implementation

Safe HaskellNone
LanguageHaskell2010

Lib

Synopsis

Documentation

buildSketch :: [HashMeta] -> Maybe Sketch Source #

Create a sketch with the given functions and an empty vector of maps for the hash outputs

Examples:

>>> buildSketch []
Nothing
>>> import Hashes.FarmHash (hFarmHash)
>>> isJust $ buildSketch [hFarmHash]
True

buildNotASketch :: NotASketch Source #

Constructor for building a non sketch

buildBetterSketch :: [HashMeta] -> Maybe BetterSketch Source #

Constructor for building the better sketch

buildBestSketch :: [HashMeta] -> IO (Maybe BestSketch) Source #

Constructor for building the best sketch

data Sketch Source #

Instances
Show Sketch Source # 
Instance details

Defined in Lib

DynamicCountMin Sketch Source # 
Instance details

Defined in Lib

CountMin Sketch Source #

Implement CountMin for sketch

Instance details

Defined in Lib

data NotASketch Source #

A sketch that isn't one, but instead uses the naive just-put-the-value-in-a-map approach

data BetterSketch Source #

A sketch that isn't one, but instead uses the naive just-put-the-value-in-a-map approach

data BestSketch Source #

A sketch that isn't one, but instead uses the naive just-put-the-value-in-a-map approach

class CountMin sketch where Source #

Typeclass that captures minimal set of functionality for a CountMin sketch implementation

Minimal complete definition

increment, count, hashFunctions, totalCount

Methods

increment :: sketch -> ByteString -> sketch Source #

Increment the count of a given key

incrementStr :: sketch -> String -> sketch Source #

Helper for incrementing with a regular string

count :: sketch -> ByteString -> Integer Source #

Get the count of items seen for a given key

hashFunctions :: sketch -> [HashMeta] Source #

Retrieve the hash functions in use

totalCount :: sketch -> Integer Source #

Retrieve the total count of events that this sketch has seen

class CountMin sketch => DynamicCountMin sketch where Source #

Dynamic sketches allow for re-configuration of hash functions at any time

Methods

addHashMeta :: sketch -> HashMeta -> sketch Source #

Add a hash function for use with sketch

removeHashMeta :: sketch -> HashMeta -> sketch Source #

Remove a hash function for use with the sketch

class CountMinM m sketch where Source #

Maximum performance sketches that reside in some monad m (likely IO)

Minimal complete definition

incrementM, countM, hashFunctionsM, totalCountM

Methods

incrementM :: sketch -> ByteString -> m () Source #

Increment the count of a given key

incrementStrM :: sketch -> String -> m () Source #

Helper for incrementing with a regular string

countM :: sketch -> ByteString -> m Integer Source #

Get the count of items seen for a given key

hashFunctionsM :: sketch -> m [HashMeta] Source #

Retrieve the hash functions in use

totalCountM :: sketch -> m Integer Source #

Retrieve the total count of events that this sketch has seen

class CountMinM m sketch => DynamicCountMinM m sketch where Source #

Maximum performance dynamic sketches which allow for re-configuration of hash functions at any time

Methods

addHashMetaM :: sketch -> HashMeta -> m sketch Source #

Add a hash function for use with sketch

removeHashMetaM :: sketch -> HashMeta -> m sketch Source #

Remove a hash function for use with the sketch