public class FailSafeConsistencyGuard extends Object implements ConsistencyGuard
ConsistencyGuard.FileVisibility| Modifier and Type | Field and Description |
|---|---|
protected ConsistencyGuardConfig |
consistencyGuardConfig |
protected org.apache.hadoop.fs.FileSystem |
fs |
| Constructor and Description |
|---|
FailSafeConsistencyGuard(org.apache.hadoop.fs.FileSystem fs,
ConsistencyGuardConfig consistencyGuardConfig) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
checkFilesVisibility(int retryNum,
org.apache.hadoop.fs.Path dir,
List<String> files,
ConsistencyGuard.FileVisibility event)
Helper to check for file visibility based on
ConsistencyGuard.FileVisibility event. |
protected boolean |
checkFileVisibility(org.apache.hadoop.fs.Path filePath,
ConsistencyGuard.FileVisibility visibility)
Helper to check of file visibility.
|
protected List<String> |
getFilesWithoutSchemeAndAuthority(List<String> files)
Generate file names without scheme and authority.
|
void |
waitForFilesVisibility(String dirPath,
List<String> files,
ConsistencyGuard.FileVisibility event)
Helper function to wait for all files belonging to single directory to appear.
|
void |
waitTillAllFilesAppear(String dirPath,
List<String> files)
Wait till all passed files belonging to a directory shows up in the listing.
|
void |
waitTillAllFilesDisappear(String dirPath,
List<String> files)
Wait till all passed files belonging to a directory disappears from listing.
|
void |
waitTillFileAppears(org.apache.hadoop.fs.Path filePath)
Wait for file to be listable based on configurable timeout.
|
void |
waitTillFileDisappears(org.apache.hadoop.fs.Path filePath)
Wait for file to be listable based on configurable timeout.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitwaitTillprotected final org.apache.hadoop.fs.FileSystem fs
protected final ConsistencyGuardConfig consistencyGuardConfig
public FailSafeConsistencyGuard(org.apache.hadoop.fs.FileSystem fs,
ConsistencyGuardConfig consistencyGuardConfig)
public void waitTillFileAppears(org.apache.hadoop.fs.Path filePath)
throws TimeoutException
ConsistencyGuardwaitTillFileAppears in interface ConsistencyGuardTimeoutException - when retries exhaustedpublic void waitTillFileDisappears(org.apache.hadoop.fs.Path filePath)
throws TimeoutException
ConsistencyGuardwaitTillFileDisappears in interface ConsistencyGuardTimeoutException - when retries exhaustedpublic void waitTillAllFilesAppear(String dirPath, List<String> files) throws TimeoutException
ConsistencyGuardwaitTillAllFilesAppear in interface ConsistencyGuardTimeoutExceptionpublic void waitTillAllFilesDisappear(String dirPath, List<String> files) throws TimeoutException
ConsistencyGuardwaitTillAllFilesDisappear in interface ConsistencyGuardTimeoutExceptionpublic void waitForFilesVisibility(String dirPath, List<String> files, ConsistencyGuard.FileVisibility event) throws TimeoutException
dirPath - Dir Pathfiles - Files to appear/disappearevent - Appear/DisappearTimeoutExceptionprotected boolean checkFileVisibility(org.apache.hadoop.fs.Path filePath,
ConsistencyGuard.FileVisibility visibility)
throws IOException
filePath - File Pathvisibility - VisibilityIOException - -protected boolean checkFilesVisibility(int retryNum,
org.apache.hadoop.fs.Path dir,
List<String> files,
ConsistencyGuard.FileVisibility event)
ConsistencyGuard.FileVisibility event.retryNum - retry attempt count.dir - directory of interest in which list of files are checked for visibilityfiles - List of files to check for visibilityevent - ConsistencyGuard.FileVisibility event of interest.true if condition succeeded. else false.Copyright © 2022 The Apache Software Foundation. All rights reserved.