@Internal public class NumberedShardedFile extends java.lang.Object implements ShardedFile
Constructor and Description |
---|
NumberedShardedFile(java.lang.String filePattern)
Constructor that uses default shard template.
|
NumberedShardedFile(java.lang.String filePattern,
java.util.regex.Pattern shardTemplate)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getFilePattern() |
java.util.List<java.lang.String> |
readFilesWithRetries()
Discovers all shards of this file.
|
java.util.List<java.lang.String> |
readFilesWithRetries(Sleeper sleeper,
BackOff backOff)
|
java.lang.String |
toString() |
public NumberedShardedFile(java.lang.String filePattern)
filePattern
- path or glob of files to includepublic NumberedShardedFile(java.lang.String filePattern, java.util.regex.Pattern shardTemplate)
filePattern
- path or glob of files to includeshardTemplate
- template of shard name to parse out the total number of shards which is
used in I/O retry to avoid inconsistency of filesystem. Customized template should assign
name "numshards" to capturing group - total shard number.public java.lang.String getFilePattern()
public java.util.List<java.lang.String> readFilesWithRetries(Sleeper sleeper, BackOff backOff) throws java.io.IOException, java.lang.InterruptedException
Sleeper
and BackOff
.
Because of eventual consistency, reads may discover no files or fewer files than the shard template implies. In this case, the read is considered to have failed.
readFilesWithRetries
in interface ShardedFile
java.io.IOException
java.lang.InterruptedException
public java.util.List<java.lang.String> readFilesWithRetries() throws java.io.IOException, java.lang.InterruptedException
Because of eventual consistency, reads may discover no files or fewer files than the shard template implies. In this case, the read is considered to have failed.
java.io.IOException
java.lang.InterruptedException
public java.lang.String toString()
toString
in class java.lang.Object