@InterfaceAudience.Private @InterfaceStability.Unstable public class PendingSet extends PersistentCommitData implements org.apache.hadoop.fs.statistics.IOStatisticsSource
SinglePendingCommit
entries; validation logic
checks those values on load.
The statistics published through the IOStatisticsSource
interface are the static ones marshalled with the commit data;
they may be empty.
As single commits are added via add(SinglePendingCommit)
,
any statistics from those commits are merged into the aggregate
statistics, and those of the single commit cleared.
Modifier and Type | Field and Description |
---|---|
static int |
VERSION
Supported version value: 3.
|
Constructor and Description |
---|
PendingSet() |
PendingSet(int size) |
Modifier and Type | Method and Description |
---|---|
void |
add(SinglePendingCommit commit)
Add a commit.
|
List<SinglePendingCommit> |
getCommits() |
org.apache.hadoop.fs.statistics.IOStatisticsSnapshot |
getIOStatistics() |
String |
getJobId() |
int |
getVersion() |
static PendingSet |
load(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.FileStatus status)
Load an instance from a file, then validate it.
|
static PendingSet |
load(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path)
Load an instance from a file, then validate it.
|
void |
putExtraData(String key,
String value)
Set/Update an extra data entry.
|
void |
save(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path,
boolean overwrite)
Save to a hadoop filesystem.
|
static org.apache.hadoop.util.JsonSerialization<PendingSet> |
serializer()
Get a JSON serializer for this class.
|
void |
setCommits(List<SinglePendingCommit> commits) |
void |
setIOStatistics(org.apache.hadoop.fs.statistics.IOStatisticsSnapshot ioStatistics) |
void |
setJobId(String jobId) |
void |
setVersion(int version) |
int |
size()
Number of commits.
|
byte[] |
toBytes()
Serialize to JSON and then to a byte array, after performing a
preflight validation of the data to be saved.
|
void |
validate()
Validate the data: those fields which must be non empty, must be set.
|
public static final int VERSION
serialVersionUID
will change,
to avoid deserialization problems.public static org.apache.hadoop.util.JsonSerialization<PendingSet> serializer()
public static PendingSet 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 static PendingSet load(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.FileStatus status) throws IOException
fs
- filesystemstatus
- status of file to loadIOException
- IO failureValidationFailure
- if the data is invalidpublic void add(SinglePendingCommit commit)
commit
- the single commitpublic void validate() throws ValidationFailure
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 int size()
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 int getVersion()
public void setVersion(int version)
public List<SinglePendingCommit> getCommits()
public void setCommits(List<SinglePendingCommit> commits)
public void putExtraData(String key, String value)
key
- keyvalue
- valuepublic String getJobId()
public void setJobId(String jobId)
public org.apache.hadoop.fs.statistics.IOStatisticsSnapshot getIOStatistics()
getIOStatistics
in interface org.apache.hadoop.fs.statistics.IOStatisticsSource
public void setIOStatistics(org.apache.hadoop.fs.statistics.IOStatisticsSnapshot ioStatistics)
Copyright © 2008–2021 Apache Software Foundation. All rights reserved.