K - the key type of its partitions.public abstract class FileMetadata<K extends Serializable> extends Object
Block.
The writer and reader determine the status of a file block
(such as accessibility, how many bytes are written, etc.) by using this metadata.| Constructor and Description |
|---|
FileMetadata()
Construct a new file metadata.
|
FileMetadata(List<PartitionMetadata<K>> partitionMetadataList)
Construct a file metadata with existing partition metadata.
|
| Modifier and Type | Method and Description |
|---|---|
abstract void |
commitBlock()
Notifies that all writes are finished for the block corresponding to this metadata.
|
abstract void |
deleteMetadata()
Deletes the metadata.
|
Iterable<PartitionMetadata<K>> |
getPartitionMetadataIterable()
Gets a iterable containing the partition metadata of corresponding block.
|
protected void |
setCommitted(boolean committed)
Set the commit value.
|
void |
writePartitionMetadata(K key,
int partitionSize,
long elementsTotal)
Writes the metadata for a partition.
|
public FileMetadata()
public FileMetadata(List<PartitionMetadata<K>> partitionMetadataList)
partitionMetadataList - the partition metadata list.public final void writePartitionMetadata(K key, int partitionSize, long elementsTotal) throws IOException
key - the key of the partition.partitionSize - the size of the partition.elementsTotal - the number of elements in the partition.IOException - if fail to append the partition metadata.public final Iterable<PartitionMetadata<K>> getPartitionMetadataIterable() throws IOException
IOException - if fail to get the iterable.public abstract void deleteMetadata()
throws IOException
IOException - if fail to delete.public abstract void commitBlock()
throws IOException
IOException - if fail to commit.protected final void setCommitted(boolean committed)
committed - whether this block is committed or not.Copyright © 2018. All rights reserved.