|
||||||||||
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. NOTE: At 1MBps, the tunnel IVV will see an unacceptable false positive rate of almost 0.1% with the current m and k values; however using DHS instead will use 30MB. Further analysis and tweaking for the tunnel IVV may be required.
Field Summary | |
---|---|
protected long |
_currentDuplicates
|
Constructor Summary | |
---|---|
DecayingBloomFilter()
noop for DHS |
|
DecayingBloomFilter(I2PAppContext context,
int durationMs,
int entryBytes)
Create a bloom filter that will decay its entries over time. |
|
DecayingBloomFilter(I2PAppContext context,
int durationMs,
int entryBytes,
String name)
|
|
DecayingBloomFilter(I2PAppContext context,
int durationMs,
int entryBytes,
String name,
int m)
|
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(String[] args)
This filter is used only for participants and OBEPs, not IBGWs, so depending on your assumptions of avg. |
void |
stopDecaying()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected long _currentDuplicates
Constructor Detail |
---|
public DecayingBloomFilter()
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.public DecayingBloomFilter(I2PAppContext context, int durationMs, int entryBytes, String name)
name
- just for logging / debugging / statspublic DecayingBloomFilter(I2PAppContext context, int durationMs, int entryBytes, String name, int m)
m
- filter size exponentMethod 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(String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |