T - The proto message type.public class DatePartitionedLogger<T extends com.google.protobuf.MessageLite> extends Object
| Constructor and Description |
|---|
DatePartitionedLogger(com.google.protobuf.Parser<T> parser,
org.apache.hadoop.fs.Path baseDir,
org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.yarn.util.Clock clock) |
| Modifier and Type | Method and Description |
|---|---|
org.apache.hadoop.conf.Configuration |
getConfig() |
java.time.LocalDate |
getDateFromDir(String dirName)
Extract the date from the directory name, this should be a directory created by this class.
|
String |
getDirForDate(java.time.LocalDate date)
Returns the directory name for a given date.
|
String |
getNextDirectory(String currentDir)
Find next available directory, after the given directory.
|
java.time.LocalDateTime |
getNow()
Returns the current time, using the underlying clock in UTC time.
|
org.apache.hadoop.fs.Path |
getPathForDate(java.time.LocalDate date,
String fileName)
Create a path for the given date and fileName.
|
ProtoMessageReader<T> |
getReader(org.apache.hadoop.fs.Path filePath)
Creates a reader for the given filePath, no validation is done.
|
ProtoMessageWriter<T> |
getWriter(String fileName)
Creates a writer for the given fileName, with date as today.
|
List<org.apache.hadoop.fs.Path> |
scanForChangedFiles(String subDir,
Map<String,Long> currentOffsets)
Returns new or changed files in the given directory.
|
public DatePartitionedLogger(com.google.protobuf.Parser<T> parser, org.apache.hadoop.fs.Path baseDir, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.yarn.util.Clock clock) throws IOException
IOExceptionpublic ProtoMessageWriter<T> getWriter(String fileName) throws IOException
IOExceptionpublic ProtoMessageReader<T> getReader(org.apache.hadoop.fs.Path filePath) throws IOException
IOExceptionpublic org.apache.hadoop.fs.Path getPathForDate(java.time.LocalDate date,
String fileName)
throws IOException
IOExceptionpublic java.time.LocalDate getDateFromDir(String dirName)
public String getDirForDate(java.time.LocalDate date)
public String getNextDirectory(String currentDir) throws IOException
IOExceptionpublic List<org.apache.hadoop.fs.Path> scanForChangedFiles(String subDir, Map<String,Long> currentOffsets) throws IOException
IOExceptionpublic java.time.LocalDateTime getNow()
public org.apache.hadoop.conf.Configuration getConfig()
Copyright © 2019 The Apache Software Foundation. All Rights Reserved.