@InterfaceAudience.Private @InterfaceStability.Unstable public class SuccessData extends PersistentCommitData
_SUCCESS
marker file.
This provides an easy way to determine which committer was used
to commit work.
FileOutputCommitter
.SuccessData
:
A s3guard committer with name in in committer
field.name
field
to differentiate from any other JSON-based manifest and to identify
changes in the output format.Modifier and Type | Field and Description |
---|---|
static String |
NAME
Name to include in persisted data, so as to differentiate from
any other manifests: "org.apache.hadoop.fs.s3a.commit.files.SuccessData/1".
|
VERSION
Constructor and Description |
---|
SuccessData() |
Modifier and Type | Method and Description |
---|---|
void |
addDiagnostic(String key,
String value)
Add a diagnostics entry.
|
String |
dumpDiagnostics(String prefix,
String middle,
String suffix)
Dump the diagnostics (if any) to a string.
|
String |
dumpMetrics(String prefix,
String middle,
String suffix)
Dump the metrics (if any) to a string.
|
String |
getCommitter() |
String |
getDate() |
String |
getDescription() |
Map<String,String> |
getDiagnostics() |
List<String> |
getFilenames() |
String |
getHostname() |
Map<String,Long> |
getMetrics() |
String |
getName() |
long |
getTimestamp() |
protected static String |
joinMap(Map<String,?> map,
String prefix,
String middle,
String suffix)
Join any map of string to value into a string, sorting the keys first.
|
static SuccessData |
load(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path)
Load an instance from a file, then validate it.
|
void |
save(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path,
boolean overwrite)
Save to a hadoop filesystem.
|
void |
setCommitter(String committer) |
void |
setDate(String date) |
void |
setDescription(String description) |
void |
setDiagnostics(Map<String,String> diagnostics) |
void |
setFilenames(List<String> filenames) |
void |
setHostname(String hostname) |
void |
setMetrics(Map<String,Long> metrics) |
void |
setName(String name) |
void |
setTimestamp(long timestamp) |
byte[] |
toBytes()
Serialize to JSON and then to a byte array, after performing a
preflight validation of the data to be saved.
|
String |
toString() |
void |
validate()
Validate the data: those fields which must be non empty, must be set.
|
public static final String NAME
public void validate() throws ValidationFailure
PersistentCommitData
validate
in class PersistentCommitData
ValidationFailure
- if the data is invalidpublic byte[] toBytes() throws IOException
PersistentCommitData
toBytes
in class PersistentCommitData
IOException
- serialization problem or validation failure.public void save(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, boolean overwrite) throws IOException
PersistentCommitData
save
in class PersistentCommitData
fs
- filesystempath
- pathoverwrite
- should any existing file be overwrittenIOException
- IO exceptionpublic String dumpMetrics(String prefix, String middle, String suffix)
prefix
- prefix before every entrymiddle
- string between key and valuesuffix
- suffix to each entrypublic String dumpDiagnostics(String prefix, String middle, String suffix)
prefix
- prefix before every entrymiddle
- string between key and valuesuffix
- suffix to each entryprotected static String joinMap(Map<String,?> map, String prefix, String middle, String suffix)
map
- map to joinprefix
- prefix before every entrymiddle
- string between key and valuesuffix
- suffix to each entrypublic static SuccessData load(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path) throws IOException
fs
- filesystempath
- pathIOException
- IO failureValidationFailure
- if the data is invalidpublic String getName()
public void setName(String name)
public long getTimestamp()
public void setTimestamp(long timestamp)
public String getDate()
public void setDate(String date)
public String getHostname()
public void setHostname(String hostname)
public String getCommitter()
public void setCommitter(String committer)
public String getDescription()
public void setDescription(String description)
Copyright © 2008–2021 Apache Software Foundation. All rights reserved.