public class CachingFreenetStore<T extends StorableBlock> extends ProxyFreenetStore<T>
FreenetStore.StoreType
backDatastore
Constructor and Description |
---|
CachingFreenetStore(StoreCallback<T> callback,
FreenetStore<T> backDatastore,
CachingFreenetStoreTracker tracker) |
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.
|
boolean |
probablyInStore(byte[] routingKey)
Check if a routing key probably
|
void |
put(T block,
byte[] data,
byte[] header,
boolean overwrite,
boolean isOldBlock)
Store a block.
|
boolean |
start(Ticker ticker,
boolean longStart) |
getBloomFalsePositive, getMaxKeys, getSessionAccessStats, getTotalAccessStats, getUnderlyingStore, hits, keyCount, misses, setMaxKeys, setUserAlertManager, writes
public CachingFreenetStore(StoreCallback<T> callback, FreenetStore<T> backDatastore, CachingFreenetStoreTracker tracker)
public T fetch(byte[] routingKey, byte[] fullKey, boolean dontPromote, boolean canReadClientCache, boolean canReadSlashdotCache, boolean ignoreOldBlocks, BlockMetadata meta) throws java.io.IOException
FreenetStore
fetch
in interface FreenetStore<T extends StorableBlock>
fetch
in class ProxyFreenetStore<T extends StorableBlock>
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 boolean probablyInStore(byte[] routingKey)
FreenetStore
probablyInStore
in interface FreenetStore<T extends StorableBlock>
probablyInStore
in class ProxyFreenetStore<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
FreenetStore
put
in interface FreenetStore<T extends StorableBlock>
put
in class ProxyFreenetStore<T extends StorableBlock>
overwrite
- If true, overwrite old content rather than throwing a
KeyCollisionException
.isOldBlock
- If true, the block really shouldn't be in the datastore, but we are storing
it anyway; it should not have the new block flag, so it should be excluded
from Bloom filter sharing.KeyCollisionException
- If the key already exists and callback.collisionPossible()
is
true
.java.io.IOException
public boolean start(Ticker ticker, boolean longStart) throws java.io.IOException
start
in interface FreenetStore<T extends StorableBlock>
start
in class ProxyFreenetStore<T extends StorableBlock>
java.io.IOException
public void close()
close
in interface FreenetStore<T extends StorableBlock>
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class ProxyFreenetStore<T extends StorableBlock>