|
ozone core API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ozoneDB.core.storage.gammaStore.IndexNode
Index nodes are the nodes that make up the tree used for storing information on where objects can be found (cluster + location). Because memory is limited, it is impossible to have all index nodes in memory under all circumstances. Therefor there are no hard references to other index nodes but only ids are stored.
There is not much logic here, most logic is in IndexManager
.
Field Summary | |
private boolean |
dirty
indicates a change which requires a write to storage when finalized |
private IndexManager |
indexManager
Index manager this instance is in. |
private static java.lang.String |
INDEXNODENAMESUFFIX
used for StorageFactory instances |
private int |
invoked
|
protected static java.util.logging.Logger |
log
|
static long |
LONGNULL
alternative null value |
static long |
MAXOBJECTID
|
private int |
maxSize
maximum number of subnodes or object entries |
static long |
MINOBJECTID
|
private static int |
NAMECONVERTRADIX
Used to name indexfiles. |
private long |
nextNodeId
sibling node in the tree |
private long |
nodeId
our id |
private long |
parentNodeId
parent in the tree |
private long |
prevNodeId
sibling node in the tree |
private static java.lang.ThreadLocal |
readBufHolder
Read buffer for instantiating new index nodes from storage. |
private static long |
serialVersionUID
|
Constructor Summary | |
protected |
IndexNode(IndexManager indexManager)
Constructor for an index node. |
Method Summary | |
(package private) void |
endInvoke()
|
protected void |
finalize()
|
protected IndexManager |
getIndexManager()
Returns the index manager that is 'managing' this tree. |
(package private) abstract long |
getMaxObjectId()
Returns the maximum object id that can be found be in this node |
(package private) int |
getMaxSize()
|
(package private) abstract long |
getMinObjectId()
Returns the minimum object id that can be found be in this node |
(package private) IndexNode |
getNextNode()
|
(package private) long |
getNextNodeId()
|
(package private) long |
getNodeId()
|
(package private) IndexBranchNode |
getParentNode()
|
(package private) long |
getParentNodeId()
|
(package private) IndexNode |
getPrevNode()
|
(package private) long |
getPrevNodeId()
|
java.lang.String |
getStorageName()
Returnes the filename that this node can be saved to, or to be more precise: the name that can be used by a StorageFactory to
create a unique Storable . |
(package private) boolean |
isDirty()
Indicates if this node has changed since last call to write() . |
protected boolean |
isFull()
Returns true if there is no more room for new elements,
false otherwise |
protected boolean |
isFull(int withExtraElements)
Returns true if there is no more room for new elements after
the specified number of elements were added,
false otherwise |
(package private) boolean |
isInvoked()
|
(package private) static java.lang.String |
nodeIdToStorageName(long nodeId)
Converts a node id to corresponding (file)name for a node. |
(package private) static IndexNode |
read(IndexManager indexManager,
long nodeId)
Factory method to create a node by reading it from the storage used for index nodes by the specified index manager. |
(package private) float |
relSize()
Returns the relative size of this node, on a scale of [0 .. 1] |
(package private) void |
setDirty()
|
(package private) void |
setDirty(boolean dirty)
|
protected void |
setIndexManager(IndexManager indexManager)
Sets the index manager that is 'managing' this tree. |
protected void |
setMaxSize(int maxSize)
|
(package private) void |
setNextNode(IndexNode next)
|
(package private) void |
setNextNodeId(long nextNodeId)
|
(package private) void |
setParentNode(IndexBranchNode parent)
Only ment to be called from IndexBranchNode.putChildNode(IndexNode). |
(package private) void |
setParentNodeId(long parentNodeId)
|
(package private) void |
setPrevNode(IndexNode prev)
|
(package private) void |
setPrevNodeId(long prevNodeId)
|
protected abstract int |
size()
Returns the number of elements in this node. |
(package private) void |
startInvoke()
|
(package private) static long |
storageNameToNodeId(java.lang.String indexFilename)
Converts an index (file)name to its corresponding node id |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private static final long serialVersionUID
protected static final java.util.logging.Logger log
public static final long LONGNULL
null
value
public static final long MINOBJECTID
public static final long MAXOBJECTID
private static final java.lang.String INDEXNODENAMESUFFIX
StorageFactory
instances
private static final int NAMECONVERTRADIX
Used to name indexfiles. We could take any value from 2 to
Character.MAX_RADIX
(36) here, but we settle for 16 because
it looks nice and nerdy. 36 would look less nice because that would
inevitably lead to filenames with very nasty words in them, like
fuck.idxnode
and microsoft.idxnode
.
Before you know it, someone sues you for trademark infringement.
Insiders joke: CAFEBABE is not a trademark, is she?
private static java.lang.ThreadLocal readBufHolder
private long nodeId
private long parentNodeId
private int maxSize
private transient boolean dirty
private long prevNodeId
private long nextNodeId
private transient IndexManager indexManager
read()
factory method.
private transient int invoked
Constructor Detail |
protected IndexNode(IndexManager indexManager)
indexManager
- manages this instanceMethod Detail |
protected IndexManager getIndexManager()
protected void setIndexManager(IndexManager indexManager)
indexManager
- manager this instance is inpublic java.lang.String toString()
final boolean isDirty()
write()
.
final void setDirty(boolean dirty)
final void setDirty()
static java.lang.String nodeIdToStorageName(long nodeId)
static long storageNameToNodeId(java.lang.String indexFilename)
public java.lang.String getStorageName()
StorageFactory
to
create a unique Storable
.
getStorageName
in interface Storable
static IndexNode read(IndexManager indexManager, long nodeId) throws java.io.IOException
indexManager
- index manager that manages this instancenodeId
- id of the node to be read
java.io.IOException
protected abstract int size()
protected final boolean isFull()
true
if there is no more room for new elements,
false
otherwise
true
if this node is full, false
otherwiseprotected final boolean isFull(int withExtraElements)
true
if there is no more room for new elements after
the specified number of elements were added,
false
otherwise
true
if this node (+ specified extra) is full,
false
otherwisefinal float relSize()
protected final void setMaxSize(int maxSize)
java.lang.IllegalStateException
- when called for the second timefinal int getMaxSize()
abstract long getMinObjectId()
abstract long getMaxObjectId()
final long getNodeId()
final long getParentNodeId()
final void setParentNodeId(long parentNodeId)
final void setParentNode(IndexBranchNode parent)
final IndexBranchNode getParentNode()
final long getPrevNodeId()
final IndexNode getPrevNode()
final void setPrevNodeId(long prevNodeId)
final void setPrevNode(IndexNode prev)
final long getNextNodeId()
final IndexNode getNextNode()
final void setNextNodeId(long nextNodeId)
final void setNextNode(IndexNode next)
final void startInvoke()
final void endInvoke()
final boolean isInvoked()
protected void finalize() throws java.lang.Throwable
java.lang.Throwable
|
ozone core API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |