countmin-0.1.0.0: A Count Min sketch implementation

Safe HaskellNone
LanguageHaskell2010

Types

Synopsis

Documentation

bs2i :: ByteString -> Integer Source #

Helper function to convert bytestrings to integers (borrowed from https://hackage.haskell.org/package/crypto-api-0.13.3)

type BSHashFn = ByteString -> Integer Source #

Alias for hash functions that are usable in a CountMin sketch

data HashMeta Source #

For use internally in CountMinSketch implementations

Constructors

HM 

Fields

Instances
Eq HashMeta Source #

EQ instance for HashMeta that does nothing more than hash names ideally this should also check initialization vectors/other parameters if a hash allows it

Instance details

Defined in Types

Show HashMeta Source #

EQ instance for HashMeta is just the name of the hash

Instance details

Defined in Types

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