@InterfaceAudience.Private @InterfaceStability.Unstable public class PendingSet extends PersistentCommitData
SinglePendingCommit
entries; validation logic
checks those values on load.Modifier and Type | Field and Description |
---|---|
static int |
VERSION
Supported version value: 1.
|
Constructor and Description |
---|
PendingSet() |
PendingSet(int size) |
Modifier and Type | Method and Description |
---|---|
void |
add(SinglePendingCommit commit)
Add a commit.
|
List<SinglePendingCommit> |
getCommits() |
int |
getVersion() |
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 |
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 |
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 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)
Copyright © 2008–2019 Apache Software Foundation. All rights reserved.