@InterfaceAudience.Private @InterfaceStability.Unstable public class PendingSet extends PersistentCommitData<PendingSet>
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.Path path,
org.apache.hadoop.fs.FileStatus status)
Load an instance from a file, then validate it.
|
void |
putExtraData(String key,
String value)
Set/Update an extra data entry.
|
org.apache.hadoop.fs.statistics.IOStatistics |
save(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path,
org.apache.hadoop.util.JsonSerialization<PendingSet> serializer)
Save to a hadoop filesystem.
|
static org.apache.hadoop.util.JsonSerialization<PendingSet> |
serializer()
Get a shared 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(org.apache.hadoop.util.JsonSerialization<PendingSet> serializer)
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.
|
load, saveFile, saveToStream
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, @Nullable org.apache.hadoop.fs.FileStatus status) throws IOException
fs
- filesystempath
- pathstatus
- 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<PendingSet>
ValidationFailure
- if the data is invalidpublic byte[] toBytes(org.apache.hadoop.util.JsonSerialization<PendingSet> serializer) throws IOException
PersistentCommitData
toBytes
in class PersistentCommitData<PendingSet>
serializer
- serializer to useIOException
- serialization problem or validation failure.public int size()
public org.apache.hadoop.fs.statistics.IOStatistics save(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, org.apache.hadoop.util.JsonSerialization<PendingSet> serializer) throws IOException
PersistentCommitData
save
in class PersistentCommitData<PendingSet>
fs
- filesystempath
- pathserializer
- serializer to useIOException
- 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()
public void setIOStatistics(org.apache.hadoop.fs.statistics.IOStatisticsSnapshot ioStatistics)
Copyright © 2008–2024 Apache Software Foundation. All rights reserved.