|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.tangosol.util.Base
com.tangosol.io.nio.BinaryMap.Block
public class BinaryMap.Block
A Block is the unit of storage within a Buffer. There are free blocks and Entry blocks (that store key/value pairs).
Field Summary | |
---|---|
static int |
ENTRY
State of a block that holds an Entry object's data. |
static int |
FREE
State of a block that is available for use. |
static int |
MIN_ENTRY
Minimum size of an Entry block. |
static int |
MIN_FREE
Minimum size of a free block. |
static int |
MIN_SPLIT
Minimum size of a block to split off a free block. |
static int |
NONE
Initial state, also state of an allocated block that has not been linked. |
static int |
OFFSET_HASH
Offset of the key's hash within an Entry block. |
static int |
OFFSET_KEY
Offset of the key data within an Entry block. |
static int |
OFFSET_VALUE
Offset (not counting key length) of the value data within an Entry block. |
Constructor Summary | |
---|---|
BinaryMap.Block()
Construct a Block. |
Method Summary | |
---|---|
void |
allocate(int cb)
Allocate this free block (or at least a specified number of bytes of this block) as an Entry block. |
void |
clear()
Zero the block. |
void |
clearValue()
Zero the value portion of the block. |
void |
close()
Close the Block object, flushing any pending changes, resetting its contents and recycling the object. |
void |
discard()
Recycle the Block object, discarding any changes, resetting its contents and recycling the object. |
protected boolean |
finishUse()
Decrement the use count for this block and check if it is now zero. |
void |
flush()
Close the Block object by resetting its contents and recycling the object. |
void |
free()
Free this Entry block. |
int |
getFillLength()
Get the size of the fill in the block. |
Binary |
getKey()
Get the Entry key in the block, lazy loading it if necessary. |
int |
getKeyHash()
Get the hash code for the Entry block. |
int |
getKeyLength()
Get the length of the Entry key in the block. |
int |
getLength()
Determine the length of the block. |
int |
getNextBlockOffset()
Determine the offset of the next Block in the Buffer. |
int |
getNextNodeOffset()
Determine the offset of the next Block in the linked list. |
int |
getOffset()
Determine the offset of this Block in the Buffer. |
int |
getPrevBlockOffset()
Determine the offset of the previous Block in the Buffer. |
int |
getPrevNodeOffset()
Determine the offset of the previous Block in the linked list. |
int |
getSizeCode()
Determine the "free block size code" for a block of this size. |
int |
getType()
Determine the current Block type. |
Binary |
getValue()
Get the Entry value in the block, lazy loading it if necessary. |
int |
getValueLength()
Get the length of the Entry value in the block. |
void |
init(int of)
Configure the Block object to point to a specific offset within the Buffer. |
boolean |
isEntry()
Determine if the Block is marked as an Entry. |
boolean |
isFree()
Determine if the Block is marked as free. |
int |
length()
Determine the length of the block. |
void |
link()
Link this block (either an Entry or free block) into the appropriate data structures (either the hash bucket or the free list.) |
void |
merge()
Merge a free block with any free blocks that it borders. |
void |
readHeader()
Read a block's header data from the Buffer. |
void |
readKey()
Read the "key" portion of an Entry block. |
void |
readValue()
Read the "value" portion of an Entry block. |
void |
reset()
Reset the Block object so that it doesn't point into the Buffer. |
void |
setKey(Binary bin)
Update the Entry key in the block. |
void |
setNextBlockOffset(int ofBlock)
Specify the offset of the next Block in the Buffer. |
void |
setNextNodeOffset(int ofBlock)
Specify the offset of the next Block in the linked list. |
void |
setOffset(int ofBlock)
Specify the offset of this Block in the Buffer. |
void |
setPrevBlockOffset(int ofBlock)
Specify the offset of the previous Block in the Buffer. |
void |
setPrevNodeOffset(int ofBlock)
Specify the offset of the previous Block in the linked list. |
void |
setType(int nType)
Set the Block type. |
void |
setValue(Binary bin)
Update the Entry value in the block. |
void |
split(int cbRetain)
If possible, chop a free block into two free blocks, or chop the end of an Entry block to make a free block. |
void |
unlink()
Unlink this block (either an Entry or free block) from the appropriate data structures (either the hash bucket or the free list.) |
protected void |
use()
Increment the use count for this block. |
void |
writeHeader()
Write the block's data to the Buffer. |
void |
writeKey()
Write the "key" portion of an Entry block, including the key hash. |
void |
writeValue()
Write the "value" portion of an Entry block. |
Field Detail |
---|
public static final int NONE
public static final int FREE
public static final int ENTRY
public static final int OFFSET_HASH
public static final int OFFSET_KEY
public static final int OFFSET_VALUE
public static final int MIN_SPLIT
public static final int MIN_FREE
public static final int MIN_ENTRY
Constructor Detail |
---|
public BinaryMap.Block()
Method Detail |
---|
public void init(int of)
of
- the offset of the Block within the Bufferprotected void use()
protected boolean finishUse()
public void reset()
public void flush()
public void close()
public void discard()
public void clear()
public void clearValue()
public int getType()
public void setType(int nType)
nType
- the new Block typepublic boolean isFree()
public boolean isEntry()
public int getOffset()
public void setOffset(int ofBlock)
ofBlock
- the offset of this Blockpublic int getLength()
public int length()
public int getSizeCode()
public int getNextBlockOffset()
public void setNextBlockOffset(int ofBlock)
ofBlock
- the offset of the next contiguous Blockpublic int getPrevBlockOffset()
public void setPrevBlockOffset(int ofBlock)
ofBlock
- the offset of the previous contiguous Blockpublic int getNextNodeOffset()
public void setNextNodeOffset(int ofBlock)
ofBlock
- the offset of the next Block in the linked list of
Blockspublic int getPrevNodeOffset()
public void setPrevNodeOffset(int ofBlock)
ofBlock
- the offset of the previous Block in the linked list
of blockspublic int getKeyHash()
public int getKeyLength()
public Binary getKey()
public void setKey(Binary bin)
bin
- the Entry keypublic int getValueLength()
public Binary getValue()
public void setValue(Binary bin)
bin
- the Entry valuepublic int getFillLength()
public void readHeader()
public void writeHeader()
public void readKey()
public void writeKey()
public void readValue()
public void writeValue()
public void link()
public void unlink()
public void split(int cbRetain)
cbRetain
- the number of bytes to allocate to the first of
the two free blockspublic void merge()
public void allocate(int cb)
cb
- the minimum number of bytes required for the Entry blockpublic void free()
|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |