Safe Haskell | None |
---|---|
Language | Haskell2010 |
Lib
Synopsis
- buildSketch :: [HashMeta] -> Maybe Sketch
- buildNotASketch :: NotASketch
- buildBetterSketch :: [HashMeta] -> Maybe BetterSketch
- buildBestSketch :: [HashMeta] -> IO (Maybe BestSketch)
- data Sketch
- data NotASketch
- data BetterSketch
- data BestSketch
- class CountMin sketch where
- increment :: sketch -> ByteString -> sketch
- incrementStr :: sketch -> String -> sketch
- count :: sketch -> ByteString -> Integer
- hashFunctions :: sketch -> [HashMeta]
- totalCount :: sketch -> Integer
- class CountMin sketch => DynamicCountMin sketch where
- addHashMeta :: sketch -> HashMeta -> sketch
- removeHashMeta :: sketch -> HashMeta -> sketch
- class CountMinM m sketch where
- incrementM :: sketch -> ByteString -> m ()
- incrementStrM :: sketch -> String -> m ()
- countM :: sketch -> ByteString -> m Integer
- hashFunctionsM :: sketch -> m [HashMeta]
- totalCountM :: sketch -> m Integer
- class CountMinM m sketch => DynamicCountMinM m sketch where
- addHashMetaM :: sketch -> HashMeta -> m sketch
- removeHashMetaM :: sketch -> HashMeta -> m sketch
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 NotASketch Source #
A sketch that isn't one, but instead uses the naive just-put-the-value-in-a-map approach
Instances
CountMin NotASketch Source # | |
Defined in Lib Methods increment :: NotASketch -> ByteString -> NotASketch Source # incrementStr :: NotASketch -> String -> NotASketch Source # count :: NotASketch -> ByteString -> Integer Source # hashFunctions :: NotASketch -> [HashMeta] Source # totalCount :: NotASketch -> Integer Source # |
data BetterSketch Source #
A sketch that isn't one, but instead uses the naive just-put-the-value-in-a-map approach
Instances
DynamicCountMin BetterSketch Source # | |
Defined in Lib Methods addHashMeta :: BetterSketch -> HashMeta -> BetterSketch Source # removeHashMeta :: BetterSketch -> HashMeta -> BetterSketch Source # | |
CountMin BetterSketch Source # | |
Defined in Lib Methods increment :: BetterSketch -> ByteString -> BetterSketch Source # incrementStr :: BetterSketch -> String -> BetterSketch Source # count :: BetterSketch -> ByteString -> Integer Source # hashFunctions :: BetterSketch -> [HashMeta] Source # totalCount :: BetterSketch -> Integer Source # |
data BestSketch Source #
A sketch that isn't one, but instead uses the naive just-put-the-value-in-a-map approach
Instances
DynamicCountMinM IO BestSketch Source # | |
Defined in Lib Methods addHashMetaM :: BestSketch -> HashMeta -> IO BestSketch Source # removeHashMetaM :: BestSketch -> HashMeta -> IO BestSketch Source # | |
CountMinM IO BestSketch Source # | |
Defined in Lib Methods incrementM :: BestSketch -> ByteString -> IO () Source # incrementStrM :: BestSketch -> String -> IO () Source # countM :: BestSketch -> ByteString -> IO Integer Source # hashFunctionsM :: BestSketch -> IO [HashMeta] Source # totalCountM :: BestSketch -> IO Integer Source # |
class CountMin sketch where Source #
Typeclass that captures minimal set of functionality for a CountMin sketch implementation
Minimal complete definition
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
Instances
CountMin BetterSketch Source # | |
Defined in Lib Methods increment :: BetterSketch -> ByteString -> BetterSketch Source # incrementStr :: BetterSketch -> String -> BetterSketch Source # count :: BetterSketch -> ByteString -> Integer Source # hashFunctions :: BetterSketch -> [HashMeta] Source # totalCount :: BetterSketch -> Integer Source # | |
CountMin NotASketch Source # | |
Defined in Lib Methods increment :: NotASketch -> ByteString -> NotASketch Source # incrementStr :: NotASketch -> String -> NotASketch Source # count :: NotASketch -> ByteString -> Integer Source # hashFunctions :: NotASketch -> [HashMeta] Source # totalCount :: NotASketch -> Integer Source # | |
CountMin Sketch Source # | Implement CountMin for sketch |
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
Instances
DynamicCountMin BetterSketch Source # | |
Defined in Lib Methods addHashMeta :: BetterSketch -> HashMeta -> BetterSketch Source # removeHashMeta :: BetterSketch -> HashMeta -> BetterSketch Source # | |
DynamicCountMin Sketch Source # | |
class CountMinM m sketch where Source #
Maximum performance sketches that reside in some monad m (likely IO)
Minimal complete definition
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
Instances
CountMinM IO BestSketch Source # | |
Defined in Lib Methods incrementM :: BestSketch -> ByteString -> IO () Source # incrementStrM :: BestSketch -> String -> IO () Source # countM :: BestSketch -> ByteString -> IO Integer Source # hashFunctionsM :: BestSketch -> IO [HashMeta] Source # totalCountM :: BestSketch -> IO Integer Source # |
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
Instances
DynamicCountMinM IO BestSketch Source # | |
Defined in Lib Methods addHashMetaM :: BestSketch -> HashMeta -> IO BestSketch Source # removeHashMetaM :: BestSketch -> HashMeta -> IO BestSketch Source # |