|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.util.DecayingBloomFilter
public class DecayingBloomFilter
Series of bloom filters which decay over time, allowing their continual use for time sensitive data. This has a fixed size (currently 1MB per decay period, using two periods overall), allowing this to pump through hundreds of entries per second with virtually no false positive rate. Down the line, this may be refactored to allow tighter control of the size necessary for the contained bloom filters, but a fixed 2MB overhead isn't that bad.
Constructor Summary | |
---|---|
DecayingBloomFilter(I2PAppContext context,
int durationMs,
int entryBytes)
Create a bloom filter that will decay its entries over time. |
Method Summary | |
---|---|
boolean |
add(byte[] entry)
return true if the entry added is a duplicate |
boolean |
add(byte[] entry,
int off,
int len)
|
boolean |
add(long entry)
return true if the entry added is a duplicate. |
void |
clear()
|
long |
getCurrentDuplicateCount()
|
double |
getFalsePositiveRate()
|
int |
getInsertedCount()
|
boolean |
isKnown(long entry)
return true if the entry is already known. |
static void |
main(java.lang.String[] args)
|
void |
stopDecaying()
|
static void |
testByBytes(int kbps,
int numRuns)
|
static void |
testByLong(int kbps,
int numRuns)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DecayingBloomFilter(I2PAppContext context, int durationMs, int entryBytes)
durationMs
- entries last for at least this long, but no more than twice this longentryBytes
- how large are the entries to be added? if this is less than 32 bytes,
the entries added will be expanded by concatenating their XORing
against with sufficient random values.Method Detail |
---|
public long getCurrentDuplicateCount()
public int getInsertedCount()
public double getFalsePositiveRate()
public boolean add(byte[] entry)
public boolean add(byte[] entry, int off, int len)
public boolean add(long entry)
public boolean isKnown(long entry)
public void clear()
public void stopDecaying()
public static void main(java.lang.String[] args)
public static void testByLong(int kbps, int numRuns)
public static void testByBytes(int kbps, int numRuns)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |