public class SlashdotStore<T extends StorableBlock> extends java.lang.Object implements FreenetStore<T>
FreenetStore.StoreType| Constructor and Description |
|---|
SlashdotStore(StoreCallback<T> callback,
int maxKeys,
long maxLifetime,
long purgePeriod,
Ticker ticker,
TempBucketFactory tbf) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
T |
fetch(byte[] routingKey,
byte[] fullKey,
boolean dontPromote,
boolean canReadClientCache,
boolean canReadSlashdotCache,
boolean ignoreOldBlocks,
BlockMetadata meta)
Retrieve a block.
|
long |
getBloomFalsePositive() |
java.lang.Long |
getLifetime() |
long |
getMaxKeys() |
StoreAccessStats |
getSessionAccessStats() |
StoreAccessStats |
getTotalAccessStats() |
FreenetStore<T> |
getUnderlyingStore() |
long |
hits() |
long |
keyCount() |
long |
misses() |
boolean |
probablyInStore(byte[] routingKey)
Check if a routing key probably
|
protected void |
purgeOldData() |
protected void |
purgeOldData(ByteArrayWrapper key,
freenet.store.SlashdotStore.DiskBlock addFirst) |
void |
put(T block,
byte[] data,
byte[] header,
boolean overwrite,
boolean isOldBlock)
Store a block.
|
void |
setLifetime(java.lang.Long val) |
void |
setMaxKeys(long maxStoreKeys,
boolean shrinkNow)
Change the store size.
|
void |
setUserAlertManager(UserAlertManager userAlertManager) |
boolean |
start(Ticker ticker,
boolean longStart) |
long |
writes() |
public SlashdotStore(StoreCallback<T> callback, int maxKeys, long maxLifetime, long purgePeriod, Ticker ticker, TempBucketFactory tbf)
public T fetch(byte[] routingKey, byte[] fullKey, boolean dontPromote, boolean canReadClientCache, boolean canReadSlashdotCache, boolean ignoreOldBlocks, BlockMetadata meta) throws java.io.IOException
FreenetStorefetch in interface FreenetStore<T extends StorableBlock>meta - IGNORED!routingKey - The routing key i.e. the database key under which the block is stored.dontPromote - If true, don't promote the block to the top of the LRU.canReadClientCache - Whether we can read the client-cache, for purposes of finding
the pubkey for an SSK.java.io.IOException - If a disk I/O error occurs.public long getBloomFalsePositive()
getBloomFalsePositive in interface FreenetStore<T extends StorableBlock>public long getMaxKeys()
getMaxKeys in interface FreenetStore<T extends StorableBlock>public long hits()
hits in interface FreenetStore<T extends StorableBlock>public long keyCount()
keyCount in interface FreenetStore<T extends StorableBlock>public long misses()
misses in interface FreenetStore<T extends StorableBlock>public boolean probablyInStore(byte[] routingKey)
FreenetStoreprobablyInStore in interface FreenetStore<T extends StorableBlock>false only if the key does not exist in store.public void put(T block, byte[] data, byte[] header, boolean overwrite, boolean isOldBlock) throws java.io.IOException, KeyCollisionException
FreenetStoreput in interface FreenetStore<T extends StorableBlock>isOldBlock - Ignored, we don't distinguish between stuff that should be cached and
stuff that shouldn't be cached; really it's all in the latter category anyway here!overwrite - If true, overwrite old content rather than throwing a
KeyCollisionException.KeyCollisionException - If the key already exists and callback.collisionPossible() is
true.java.io.IOExceptionpublic void setMaxKeys(long maxStoreKeys,
boolean shrinkNow)
throws java.io.IOException
FreenetStoresetMaxKeys in interface FreenetStore<T extends StorableBlock>maxStoreKeys - The maximum number of keys to be cached.shrinkNow - If false, don't shrink the store immediately.java.io.IOExceptionpublic long writes()
writes in interface FreenetStore<T extends StorableBlock>protected void purgeOldData()
protected void purgeOldData(ByteArrayWrapper key, freenet.store.SlashdotStore.DiskBlock addFirst)
public java.lang.Long getLifetime()
public void setLifetime(java.lang.Long val)
public StoreAccessStats getSessionAccessStats()
getSessionAccessStats in interface FreenetStore<T extends StorableBlock>public StoreAccessStats getTotalAccessStats()
getTotalAccessStats in interface FreenetStore<T extends StorableBlock>public boolean start(Ticker ticker, boolean longStart) throws java.io.IOException
start in interface FreenetStore<T extends StorableBlock>java.io.IOExceptionpublic void setUserAlertManager(UserAlertManager userAlertManager)
setUserAlertManager in interface FreenetStore<T extends StorableBlock>public FreenetStore<T> getUnderlyingStore()
getUnderlyingStore in interface FreenetStore<T extends StorableBlock>public void close()
close in interface FreenetStore<T extends StorableBlock>close in interface java.io.Closeableclose in interface java.lang.AutoCloseable