|
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.IndexManager
Takes care of storing and caching all object locations. Because of the nature of generated object ids (a newly generated id is always one bigger than the id generated before) this class is very fast when adding new ids, but a bit slow when inserting ids in random order. Random order insertion will only take place during a crash recovery.
Field Summary | |
private WeakReferenceCache |
backupNodeCache
makes sure we have access to nodes that have been thrown out of the other caches but are still strongly referenced somwhere |
private int |
branchNodeMergeReach
|
static PropertyInfo |
BRANCHNODEMERGEREACH
|
private int |
branchNodeMergeSize
|
static PropertyInfo |
BRANCHNODEMERGESIZE
|
private static java.lang.String |
CONFIGNAME
(file)name to store / read configuration at shutdown / startup |
private java.lang.String |
dbDirectory
|
private Deleter |
deleter
takes care of deleting index nodes that have become empty and have been removed from the indexmanager |
static PropertyInfo |
DIRTYINDEXNODECACHE
|
private TrimmingCache |
dirtyNodeCache
holds all dirty nodes ("You dirty little nodes, you...") |
static PropertyInfo |
GENERALINDEXNODECACHE
|
private TrimmingCache |
generalNodeCache
holds most index nodes |
static PropertyInfo |
INDEXNODESTORAGEFACTORY
|
static PropertyInfo |
INDEXNODESTREAMFACTORY
|
static PropertyInfo |
INDEXSTREAMFACTORY
|
private int |
leafNodeMergeReach
|
static PropertyInfo |
LEAFNODEMERGEREACH
|
private int |
leafNodeMergeSize
|
static PropertyInfo |
LEAFNODEMERGESIZE
|
private static java.util.logging.Logger |
log
|
private int |
maxBranchNodeSize
|
static PropertyInfo |
MAXBRANCHNODESIZE
|
private int |
maxLeafNodeSize
|
static PropertyInfo |
MAXLEAFNODESIZE
|
static int |
MINMAXBRANCHNODESIZE
|
static int |
MINMAXLEAFNODESIZE
|
private IndexLeafNode |
newestLeafNode
provides fast access for when new objects are created |
private long |
nodeIdCounter
for generating unique ids; -1 so the first returned id will be 0 |
private long |
nodeLoaded
|
private long |
nodeLoadedCache
|
private long |
nodeLoadedDirect
|
private long |
nodeLoadedDisk
|
private long |
nodeLoadedSerializer
|
private Serializer |
nodeSerializer
|
private java.lang.String |
prefix
|
private IndexBranchNode |
rootNode
entry point for the tree containing all index nodes |
private long |
size
|
private StorageFactory |
storageFactory
factory needed for swapping index nodes in and out |
private StreamFactory |
streamFactory
factory needed for extra streams during (de)serialization |
Constructor Summary | |
IndexManager(java.util.Properties properties,
java.lang.String prefix,
boolean initialize)
initialize if true preform a full (re)initialization,
if false , tries to read config. |
Method Summary | |
(package private) void |
checkSerializerSize()
Checks the size of the serializer and suspends the current thread (sleep) if the serializer has too many nodes in it. |
private WeakReferenceCache |
getBackupNodeCache()
|
(package private) int |
getBranchNodeMergeReach()
|
(package private) int |
getBranchNodeMergeSize()
|
ContainerLocation |
getContainerLocation(long objectId)
|
(package private) Deleter |
getDeleter()
|
private TrimmingCache |
getDirtyNodeCache()
|
private TrimmingCache |
getGeneralNodeCache()
Keep in mind that dirty nodes may also be in this cache. |
private IndexLeafNode |
getLeafNode(long objectId)
|
private int |
getLeafNodeMergeDistance()
|
(package private) int |
getLeafNodeMergeReach()
|
private float |
getLeafNodeMergeThreshhold()
|
(package private) int |
getMaxBranchNodeSize()
|
(package private) int |
getMaxLeafNodeSize()
|
private IndexLeafNode |
getNewestLeafNode()
|
(package private) IndexNode |
getNode(long nodeId)
Returns the specified index node from the cache, or from disk. |
private int |
getNodeCacheSize()
|
private IndexNode |
getNodeFromCaches(java.lang.Long id)
|
private long |
getNodeIdCounter()
|
(package private) Serializer |
getNodeSerializer()
|
java.lang.String |
getPrefix()
|
java.util.Collection |
getPropertyInfos()
Returns a Collection with all the properties this instance
supports. |
private IndexBranchNode |
getRootNode()
|
long |
getSize()
Returns the number of container locations in this instance. |
(package private) StorageFactory |
getStorageFactory()
|
(package private) StreamFactory |
getStreamFactory()
|
private IndexNode |
loadNode(long nodeId)
Loads an indexnode from disk. |
(package private) long |
nextNodeId()
|
(package private) void |
nodeBecameDirty(IndexNode indexNode)
|
void |
putContainerLocation(long objectId,
ContainerLocation containerLocation)
|
(package private) void |
putInCaches(IndexNode indexNode)
|
void |
removeContainerLocation(long objectId)
|
(package private) void |
removeFromCaches(IndexNode indexNode)
|
(package private) void |
serialize(IndexNode indexNode)
|
private void |
setBranchNodeMergeReach(int branchNodeMergeReach)
|
private void |
setBranchNodeMergeSize(int branchNodeMergeSize)
|
private void |
setDirtyNodeCache(TrimmingCache dirtyNodeCache)
|
private void |
setGeneralNodeCache(TrimmingCache generalNodeCache)
|
private void |
setLeafNodeMergeReach(int leafNodeMergeReach)
|
private void |
setMaxBranchNodeSize(int maxBranchNodeSize)
|
private void |
setMaxLeafNodeSize(int maxLeafNodeSize)
|
(package private) void |
setNewestLeafNode(IndexLeafNode newestLeafNode)
|
private void |
setNodeIdCounter(long nodeIdCounter)
|
private void |
setNodeSerializer(Serializer nodeSerializer)
|
(package private) void |
setRootNode(IndexBranchNode rootNode)
|
private void |
setSize(long size)
|
private void |
setStorageFactory(StorageFactory storageFactory)
|
private void |
setStreamFactory(StreamFactory streamFactory)
|
void |
shutdown()
Shuts the indexmanager down; writes all data needed for the constructor when the initialize parameter is false |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static java.util.logging.Logger log
public static final int MINMAXBRANCHNODESIZE
public static final int MINMAXLEAFNODESIZE
public static final PropertyInfo INDEXSTREAMFACTORY
public static final PropertyInfo DIRTYINDEXNODECACHE
public static final PropertyInfo GENERALINDEXNODECACHE
public static final PropertyInfo MAXBRANCHNODESIZE
public static final PropertyInfo BRANCHNODEMERGEREACH
public static final PropertyInfo BRANCHNODEMERGESIZE
public static final PropertyInfo MAXLEAFNODESIZE
public static final PropertyInfo LEAFNODEMERGEREACH
public static final PropertyInfo LEAFNODEMERGESIZE
public static final PropertyInfo INDEXNODESTORAGEFACTORY
public static final PropertyInfo INDEXNODESTREAMFACTORY
private static final java.lang.String CONFIGNAME
private IndexLeafNode newestLeafNode
private IndexBranchNode rootNode
private long nodeIdCounter
private StorageFactory storageFactory
private StreamFactory streamFactory
private TrimmingCache dirtyNodeCache
private TrimmingCache generalNodeCache
private WeakReferenceCache backupNodeCache
private int maxLeafNodeSize
private int leafNodeMergeSize
private int leafNodeMergeReach
private int maxBranchNodeSize
private int branchNodeMergeSize
private int branchNodeMergeReach
private Serializer nodeSerializer
private Deleter deleter
private transient long nodeLoaded
private transient long nodeLoadedDirect
private transient long nodeLoadedSerializer
private transient long nodeLoadedCache
private transient long nodeLoadedDisk
private java.lang.String dbDirectory
private long size
private java.lang.String prefix
Constructor Detail |
public IndexManager(java.util.Properties properties, java.lang.String prefix, boolean initialize) throws java.io.IOException
true
preform a full (re)initialization,
if false
, tries to read config.
properties
- prefix
- initialize
- TODO: refactor with the new java.util.concurrent package in the 1.5 JDK
to make fully reentrantMethod Detail |
public void shutdown() throws java.io.IOException
initialize
parameter is false
java.io.IOException
IndexNode getNode(long nodeId)
nodeId
- the id of the node
null
when there is no such nodeprivate IndexNode loadNode(long nodeId)
org.ozoneDB.OzoneInternalException
- if error during readingvoid checkSerializerSize()
private IndexLeafNode getLeafNode(long objectId)
public ContainerLocation getContainerLocation(long objectId)
objectId
- id of the object for which the location is returned
ObjectNotFoundException
- if no container location can be found
for specified objectIdpublic void putContainerLocation(long objectId, ContainerLocation containerLocation)
public void removeContainerLocation(long objectId)
public long getSize()
long nextNodeId()
private long getNodeIdCounter()
private void setNodeIdCounter(long nodeIdCounter)
private void setSize(long size)
int getMaxLeafNodeSize()
private void setMaxLeafNodeSize(int maxLeafNodeSize)
int getMaxBranchNodeSize()
private void setMaxBranchNodeSize(int maxBranchNodeSize)
private float getLeafNodeMergeThreshhold()
private int getLeafNodeMergeDistance()
private int getNodeCacheSize()
private IndexBranchNode getRootNode()
void putInCaches(IndexNode indexNode)
void removeFromCaches(IndexNode indexNode)
private IndexNode getNodeFromCaches(java.lang.Long id)
void setRootNode(IndexBranchNode rootNode)
private IndexLeafNode getNewestLeafNode()
void setNewestLeafNode(IndexLeafNode newestLeafNode)
StorageFactory getStorageFactory()
StreamFactory getStreamFactory()
private void setStorageFactory(StorageFactory storageFactory)
private void setStreamFactory(StreamFactory streamFactory)
private TrimmingCache getDirtyNodeCache()
private void setDirtyNodeCache(TrimmingCache dirtyNodeCache)
private TrimmingCache getGeneralNodeCache()
private void setGeneralNodeCache(TrimmingCache generalNodeCache)
private WeakReferenceCache getBackupNodeCache()
void serialize(IndexNode indexNode)
Serializer getNodeSerializer()
Deleter getDeleter()
private void setNodeSerializer(Serializer nodeSerializer)
public java.util.Collection getPropertyInfos()
PropertyConfigurable
Returns a Collection
with all the properties this instance
supports.
getPropertyInfos
in interface PropertyConfigurable
PropertyInfo
elementsint getLeafNodeMergeReach()
private void setLeafNodeMergeReach(int leafNodeMergeReach)
int getBranchNodeMergeSize()
private void setBranchNodeMergeSize(int branchNodeMergeSize)
int getBranchNodeMergeReach()
private void setBranchNodeMergeReach(int branchNodeMergeReach)
void nodeBecameDirty(IndexNode indexNode)
public java.lang.String getPrefix()
getPrefix
in interface PropertyConfigurable
|
ozone core API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |