@InterfaceAudience.Private @InterfaceStability.Unstable public class SinglePendingCommit extends PersistentCommitData implements Iterable<String>
Serializable
so that it can be passed in RPC
calls; for this to work it relies on the fact that java.io ArrayList
and LinkedList are serializable. If any other list type is used for etags,
it must also be serialized. Jackson expects lists, and it is used
to persist to disk.VERSION
Constructor and Description |
---|
SinglePendingCommit() |
Modifier and Type | Method and Description |
---|---|
void |
bindCommitData(List<com.amazonaws.services.s3.model.PartETag> parts)
Set the commit data.
|
org.apache.hadoop.fs.Path |
destinationPath()
Build the destination path of the object.
|
String |
getBucket() |
long |
getCreated()
When was the upload created?
|
String |
getDate()
Timestamp as date; no expectation of parseability.
|
String |
getDestinationKey() |
List<String> |
getEtags() |
Map<String,String> |
getExtraData()
Any custom extra data committer subclasses may choose to add.
|
String |
getFilename()
This is the filename of the pending file itself.
|
String |
getJobId() |
long |
getLength()
Destination file size.
|
int |
getPartCount()
Get the number of etags.
|
long |
getSaved()
When was the upload saved?
|
String |
getTaskId() |
String |
getText()
Arbitrary notes.
|
String |
getUploadId() |
String |
getUri() |
int |
getVersion() |
Iterator<String> |
iterator()
Iterate over the etags.
|
static SinglePendingCommit |
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<SinglePendingCommit> |
serializer()
Get a JSON serializer for this class.
|
void |
setBucket(String bucket) |
void |
setCreated(long created) |
void |
setDate(String date) |
void |
setDestinationKey(String destinationKey) |
void |
setEtags(List<String> etags) |
void |
setExtraData(Map<String,String> extraData) |
void |
setFilename(String filename) |
void |
setJobId(String jobId) |
void |
setLength(long length) |
void |
setSaved(long saved) |
void |
setTaskId(String taskId) |
void |
setText(String text) |
void |
setUploadId(String uploadId) |
void |
setUri(String uri) |
void |
setVersion(int version) |
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 |
touch(long millis)
Set the various timestamp fields to the supplied value.
|
void |
validate()
Validate the data: those fields which must be non empty, must be set.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public static org.apache.hadoop.util.JsonSerialization<SinglePendingCommit> serializer()
public static SinglePendingCommit 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 touch(long millis)
millis
- time in millisecondspublic void bindCommitData(List<com.amazonaws.services.s3.model.PartETag> parts) throws ValidationFailure
parts
- ordered list of etags.ValidationFailure
- if the data is invalidpublic 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 org.apache.hadoop.fs.Path destinationPath()
IllegalStateException
- if the URI is invalidpublic int getPartCount()
public int getVersion()
public void setVersion(int version)
public String getFilename()
public void setFilename(String filename)
public String getUri()
public void setUri(String uri)
public String getUploadId()
public void setUploadId(String uploadId)
public String getBucket()
public void setBucket(String bucket)
public String getDestinationKey()
public void setDestinationKey(String destinationKey)
public long getCreated()
public void setCreated(long created)
public long getSaved()
public void setSaved(long saved)
public String getDate()
public void setDate(String date)
public String getJobId()
public void setJobId(String jobId)
public String getTaskId()
public void setTaskId(String taskId)
public String getText()
public void setText(String text)
public Map<String,String> getExtraData()
public long getLength()
public void setLength(long length)
Copyright © 2008–2020 Apache Software Foundation. All rights reserved.