Documentation ¶
Overview ¶
Package dejavu offers quick detection of already witnessed data.
Limited memory of witnessed data, oldest are forgotten. Library is thread safe. Offers deterministic and probabilistic (over an order of magnatude less memory consuming) implementation.
Index ¶
Constants ¶
const Version string = "1.0.0"
Version information
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DejaVu ¶
type DejaVu interface { // Witness data and add to memory. Returns true if previously seen. Witness(data []byte) bool // WitnessDigest is equivalent to the Winness method but bypasses // hashing the data. Use this to improve performance if you already // happen to have the sha256 digest. WitnessDigest(digest [sha256.Size]byte) bool }
DejaVu witnesses data and recalls if seen before.
func New ¶
New creates a probabilistic or deterministic DejaVu memory with given entrie limit and false positive ratio (only used for probabilistic).
func NewDeterministic ¶
NewDeterministic creates a deterministic DejaVu memory. Will remember most recent entries within given entrie limit and forget older entries.
func NewProbabilistic ¶
NewProbabilistic creates a probabilistic DejaVu memory. Probably remembers most recent entries within given entrie limit and false positive ratio. False positive ratio should be between 0.0 and 1.0.