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 long
CACHE_SIZE_NODE_MB
static String
DIRECTORY_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)
void
close()
long
getEntryCount()
String
getHighestReadKey()
String
getIndexStoreType()
NodeStateEntry
getNodeStateEntry(String path)
TreeSession
getSession()
Store
getStore()
String
getStorePath()
void
init()
boolean
isIncremental()
Iterator<NodeStateEntry>
iterator()
Iterator<String>
iteratorOverPaths()
Iterator<NodeStateEntry>
nextSubsetIterator()
void
prefillCache(String path, TreeStoreNodeState nse)
void
putNode(String path, String json)
Add or update a node.void
removeNode(String path)
Remove a node if it exists.void
setEntryCount(long entryCount)
void
setIncludedPaths(SortedSet<String> includedPaths)
void
setIndexDefinitions(Set<org.apache.jackrabbit.oak.plugins.index.search.IndexDefinition> indexDefs)
void
setPrefetcher(Prefetcher prefetcher)
static String
toChildNodeEntry(String path)
The child node entry for the given path.static String
toChildNodeEntry(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.String
toString()
-
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:
iterator
in interfaceIndexStore
- Specified by:
iterator
in interfaceIterable<NodeStateEntry>
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in 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:
getStorePath
in interfaceIndexStore
-
getEntryCount
public long getEntryCount()
- Specified by:
getEntryCount
in interfaceIndexStore
-
setEntryCount
public void setEntryCount(long entryCount)
- Specified by:
setEntryCount
in interfaceIndexStore
-
getIndexStoreType
public String getIndexStoreType()
- Specified by:
getIndexStoreType
in interfaceIndexStore
-
isIncremental
public boolean isIncremental()
- Specified by:
isIncremental
in interfaceIndexStore
-
buildParallelStores
public Collection<IndexStore> buildParallelStores(int pieces)
- Specified by:
buildParallelStores
in interfaceParallelIndexStore
-
nextSubsetIterator
public Iterator<NodeStateEntry> nextSubsetIterator()
-
setPrefetcher
public void setPrefetcher(Prefetcher prefetcher)
-
-