Class TreeStore
- java.lang.Object
-
- org.apache.jackrabbit.oak.index.indexer.document.tree.TreeStore
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Iterable<NodeStateEntry>,IndexStore,ParallelIndexStore
public class TreeStore extends Object implements ParallelIndexStore
The tree store is similar to the flat file store, but instead of storing all key-value pairs in a single file, it stores the entries in multiple files (except if there are very few nodes).
-
-
Field Summary
Fields Modifier and Type Field Description static longCACHE_SIZE_NODE_MBstatic StringDIRECTORY_NAME
-
Constructor Summary
Constructors Constructor Description TreeStore(String name, File fileOrDirectory, NodeStateEntryReader entryReader, long cacheSizeFactor)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<IndexStore>buildParallelStores(int pieces)voidclose()longgetEntryCount()StringgetHighestReadKey()StringgetIndexStoreType()NodeStateEntrygetNodeStateEntry(String path)TreeSessiongetSession()StoregetStore()StringgetStorePath()voidinit()booleanisIncremental()Iterator<NodeStateEntry>iterator()Iterator<String>iteratorOverPaths()Iterator<NodeStateEntry>nextSubsetIterator()voidprefillCache(String path, TreeStoreNodeState nse)voidputNode(String path, String json)Add or update a node.voidremoveNode(String path)Remove a node if it exists.voidsetEntryCount(long entryCount)voidsetIncludedPaths(SortedSet<String> includedPaths)voidsetIndexDefinitions(Set<org.apache.jackrabbit.oak.plugins.index.search.IndexDefinition> indexDefs)voidsetPrefetcher(Prefetcher prefetcher)static StringtoChildNodeEntry(String path)The child node entry for the given path.static StringtoChildNodeEntry(String parentPath, String childName)The child node entry for the given parent and child.static String[]toParentAndChildNodeName(String key)Convert a child node entry to parent and node name.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
DIRECTORY_NAME
public static final String DIRECTORY_NAME
- See Also:
- Constant Field Values
-
CACHE_SIZE_NODE_MB
public static final long CACHE_SIZE_NODE_MB
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TreeStore
public TreeStore(String name, File fileOrDirectory, NodeStateEntryReader entryReader, long cacheSizeFactor)
-
-
Method Detail
-
init
public void init()
-
setIndexDefinitions
public void setIndexDefinitions(Set<org.apache.jackrabbit.oak.plugins.index.search.IndexDefinition> indexDefs)
-
iterator
public Iterator<NodeStateEntry> iterator()
- Specified by:
iteratorin interfaceIndexStore- Specified by:
iteratorin interfaceIterable<NodeStateEntry>
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceIndexStore- Throws:
IOException
-
getHighestReadKey
public String getHighestReadKey()
-
getNodeStateEntry
public NodeStateEntry getNodeStateEntry(String path)
-
prefillCache
public void prefillCache(String path, TreeStoreNodeState nse)
-
toChildNodeEntry
public static String toChildNodeEntry(String path)
The child node entry for the given path.- Parameters:
path- the path, e.g. /hello/world- Returns:
- the child node entry, e.g. /hello
world
-
toParentAndChildNodeName
public static String[] toParentAndChildNodeName(String key)
Convert a child node entry to parent and node name. This method is used for tooling and testing only. It does the reverse of toChildNodeEntry(parentPath, childName)- Parameters:
child- node entry, e.g. /helloworld - Returns:
- the parent path and the child node name, e.g. ["/hello" "world"]
- Throws:
IllegalArgumentException- if this is not a child node entry
-
toChildNodeEntry
public static String toChildNodeEntry(String parentPath, String childName)
The child node entry for the given parent and child.- Parameters:
path- the parentPath, e.g. /hellochildName- the name of the child node, e.g. world- Returns:
- the child node entry, e.g. /hello
world
-
removeNode
public void removeNode(String path)
Remove a node if it exists.- Parameters:
path- the path
-
putNode
public void putNode(String path, String json)
Add or update a node.- Parameters:
path- the pathjson- the property data
-
getSession
public TreeSession getSession()
-
getStore
public Store getStore()
-
getStorePath
public String getStorePath()
- Specified by:
getStorePathin interfaceIndexStore
-
getEntryCount
public long getEntryCount()
- Specified by:
getEntryCountin interfaceIndexStore
-
setEntryCount
public void setEntryCount(long entryCount)
- Specified by:
setEntryCountin interfaceIndexStore
-
getIndexStoreType
public String getIndexStoreType()
- Specified by:
getIndexStoreTypein interfaceIndexStore
-
isIncremental
public boolean isIncremental()
- Specified by:
isIncrementalin interfaceIndexStore
-
buildParallelStores
public Collection<IndexStore> buildParallelStores(int pieces)
- Specified by:
buildParallelStoresin interfaceParallelIndexStore
-
nextSubsetIterator
public Iterator<NodeStateEntry> nextSubsetIterator()
-
setPrefetcher
public void setPrefetcher(Prefetcher prefetcher)
-
-