public class GetContentSummaryOperation extends ExecutingStoreOperation<org.apache.hadoop.fs.ContentSummary> implements org.apache.hadoop.fs.statistics.IOStatisticsSource
FileSystem.get#getContentSummary;
its still doing sequential treewalk with the efficiency
issues.
Changes:
1. On the recursive calls there
is no probe to see if the path is a file: we know the
recursion only happens with a dir.
2. If a subdirectory is not found during the walk, that
does not trigger an error. The directory is clearly
not part of the content any more.
The Operation serves up IOStatistics; this counts
the cost of all the list operations, but not the
initial HEAD probe to see if the path is a file.| Modifier and Type | Class and Description |
|---|---|
static interface |
GetContentSummaryOperation.GetContentSummaryCallbacks
Callbacks used by the operation.
|
| Constructor and Description |
|---|
GetContentSummaryOperation(StoreContext storeContext,
org.apache.hadoop.fs.Path path,
GetContentSummaryOperation.GetContentSummaryCallbacks callbacks)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
org.apache.hadoop.fs.ContentSummary |
execute()
Return the
ContentSummary of a given path. |
org.apache.hadoop.fs.ContentSummary |
getDirSummary(org.apache.hadoop.fs.Path dir)
Return the
ContentSummary of a given directory. |
org.apache.hadoop.fs.statistics.IOStatistics |
getIOStatistics() |
apply, executeOnlyOnceactivateAuditSpan, getAuditSpan, getStoreContextpublic GetContentSummaryOperation(StoreContext storeContext, org.apache.hadoop.fs.Path path, GetContentSummaryOperation.GetContentSummaryCallbacks callbacks)
storeContext - context.path - path to summarizecallbacks - callbacks for S3 access.public org.apache.hadoop.fs.statistics.IOStatistics getIOStatistics()
getIOStatistics in interface org.apache.hadoop.fs.statistics.IOStatisticsSource@Retries.RetryTranslated public org.apache.hadoop.fs.ContentSummary execute() throws IOException
ContentSummary of a given path.execute in class ExecutingStoreOperation<org.apache.hadoop.fs.ContentSummary>FileNotFoundException - if the path does not resolveIOException - failurepublic org.apache.hadoop.fs.ContentSummary getDirSummary(org.apache.hadoop.fs.Path dir)
throws IOException
ContentSummary of a given directory.
This is a recursive operation (as the original is);
it'd be more efficient of stack and heap if it managed its
own stack.dir - dir to scanFileNotFoundException - if the path does not resolveIOException - IO failureFileNotFoundException - the path does not existIOException - failureCopyright © 2008–2022 Apache Software Foundation. All rights reserved.