|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.thimbleware.jmemcached.storage.bytebuffer.ByteBufferBlockStore
public class ByteBufferBlockStore
Memory mapped block storage mechanism with a free-list maintained by TreeMap Allows memory for storage to be mapped outside of the VM's main memory, and outside the purvey of the GC. Should offer O(Log(N)) search and free of blocks.
| Nested Class Summary | |
|---|---|
static class |
ByteBufferBlockStore.BadAllocationException
Exception thrown on inability to allocate a new block |
static class |
ByteBufferBlockStore.ByteBufferBlockStoreFactory
|
| Field Summary | |
|---|---|
protected org.jboss.netty.buffer.ChannelBuffer |
storageBuffer
|
| Constructor Summary | |
|---|---|
protected |
ByteBufferBlockStore(int blockSizeBytes)
Constructor used only be subclasses, allowing them to provide their own buffer. |
| Method Summary | |
|---|---|
Region |
alloc(int desiredSize,
org.jboss.netty.buffer.ChannelBuffer data)
Allocate a region in the block storage |
void |
clear()
|
void |
close()
Close the store, destroying all data and closing the backing file |
void |
free(Region region)
|
protected void |
freeResources()
|
org.jboss.netty.buffer.ChannelBuffer |
get(Region region)
|
int |
getBlockSizeBytes()
|
static BlockStoreFactory |
getFactory()
|
long |
getFreeBytes()
|
long |
getStoreSizeBytes()
|
protected void |
initialize(int storeSizeBytes)
|
static long |
roundUp(long size,
long blockSize)
Rounds up a requested size to the nearest block width. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected org.jboss.netty.buffer.ChannelBuffer storageBuffer
| Constructor Detail |
|---|
protected ByteBufferBlockStore(int blockSizeBytes)
| Method Detail |
|---|
public static BlockStoreFactory getFactory()
protected void initialize(int storeSizeBytes)
public static long roundUp(long size,
long blockSize)
size - the requested sizeblockSize - the block size to use
public void close()
throws java.io.IOException
java.io.IOException - thrown on failure to close file
protected void freeResources()
throws java.io.IOException
java.io.IOException
public Region alloc(int desiredSize,
org.jboss.netty.buffer.ChannelBuffer data)
desiredSize - size (in bytes) desired for the regiondata - initial data to place in it
public org.jboss.netty.buffer.ChannelBuffer get(Region region)
public void free(Region region)
public void clear()
public long getStoreSizeBytes()
public int getBlockSizeBytes()
public long getFreeBytes()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||