@Private
public abstract class FSTreeTraverser
extends java.lang.Object
| Modifier and Type | Class | Description |
|---|---|---|
static class |
FSTreeTraverser.TraverseInfo |
Class will represent the additional info required for traverse.
|
| Modifier and Type | Field | Description |
|---|---|---|
static org.slf4j.Logger |
LOG |
| Constructor | Description |
|---|---|
FSTreeTraverser(FSDirectory dir,
org.apache.hadoop.conf.Configuration conf) |
| Modifier and Type | Method | Description |
|---|---|---|
protected abstract boolean |
canTraverseDir(INode inode) |
Check whether dir is traversable or not.
|
protected abstract void |
checkINodeReady(long startId) |
Check whether inode is ready for traverse.
|
protected abstract void |
checkPauseForTesting() |
|
FSDirectory |
getFSDirectory() |
|
protected abstract boolean |
processFileInode(INode inode,
FSTreeTraverser.TraverseInfo traverseInfo) |
Process an Inode.
|
protected void |
readLock() |
|
protected void |
readUnlock() |
|
protected abstract boolean |
shouldSubmitCurrentBatch() |
Check whether current batch can be submitted for the processing.
|
protected abstract void |
submitCurrentBatch(java.lang.Long startId) |
Submit the current batch for processing.
|
protected abstract void |
throttle() |
Throttles the FSTreeTraverser.
|
protected void |
traverseDir(INodeDirectory parent,
long startId,
byte[] startAfter,
FSTreeTraverser.TraverseInfo traverseInfo) |
Iterate through all files directly inside parent, and recurse down
directories.
|
protected INode |
traverseDirInt(long startId,
INode curr,
java.util.List<byte[]> startAfters,
FSTreeTraverser.TraverseInfo traverseInfo) |
Iterates the parent directory, and add direct children files to current
batch.
|
public FSTreeTraverser(FSDirectory dir, org.apache.hadoop.conf.Configuration conf)
public FSDirectory getFSDirectory()
protected void traverseDir(INodeDirectory parent, long startId, byte[] startAfter, FSTreeTraverser.TraverseInfo traverseInfo) throws java.io.IOException, java.lang.InterruptedException
INodeDirectory's in memory
on the fly, only the path components to the current inode is held. This
is to reduce memory consumption.parent - The inode id of parent directorystartId - Id of the start inode.startAfter - Full path of a file the traverse should start after.traverseInfo - info which may required for processing the child's.java.io.IOExceptionjava.lang.InterruptedExceptionprotected INode traverseDirInt(long startId, INode curr, java.util.List<byte[]> startAfters, FSTreeTraverser.TraverseInfo traverseInfo) throws java.io.IOException, java.lang.InterruptedException
Locks could be released and reacquired when a batch submission is finished.
startId - Id of the start inode.java.io.IOExceptionjava.lang.InterruptedExceptionprotected void readLock()
protected void readUnlock()
protected abstract void checkPauseForTesting()
throws java.lang.InterruptedException
java.lang.InterruptedExceptionprotected abstract boolean processFileInode(INode inode, FSTreeTraverser.TraverseInfo traverseInfo) throws java.io.IOException, java.lang.InterruptedException
inode - the inodejava.io.IOExceptionjava.lang.InterruptedExceptionprotected abstract boolean shouldSubmitCurrentBatch()
protected abstract void checkINodeReady(long startId)
throws java.io.IOException
startId - Id of the start inode.java.io.IOExceptionprotected abstract void submitCurrentBatch(java.lang.Long startId)
throws java.io.IOException,
java.lang.InterruptedException
startId - Id of the start inode.java.io.IOExceptionjava.lang.InterruptedExceptionprotected abstract void throttle()
throws java.lang.InterruptedException
java.lang.InterruptedExceptionprotected abstract boolean canTraverseDir(INode inode) throws java.io.IOException
inode - Dir inodejava.io.IOExceptionCopyright © 2008–2025 Apache Software Foundation. All rights reserved.