Class FileMetadata<K extends java.io.Serializable>
- java.lang.Object
-
- org.apache.nemo.runtime.executor.data.metadata.FileMetadata<K>
-
- Type Parameters:
K
- the key type of its partitions.
- Direct Known Subclasses:
LocalFileMetadata
,RemoteFileMetadata
public abstract class FileMetadata<K extends java.io.Serializable> extends java.lang.Object
This class represents a metadata for aBlock
. 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 Summary
Constructors Constructor Description FileMetadata()
Construct a new file metadata.FileMetadata(java.util.List<PartitionMetadata<K>> partitionMetadataList)
Construct a file metadata with existing partition metadata.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
commitBlock()
Notifies that all writes are finished for the block corresponding to this metadata.abstract void
deleteMetadata()
Deletes the metadata.java.util.List<PartitionMetadata<K>>
getPartitionMetadataList()
Gets a list containing the partition metadata of corresponding block.boolean
isCommitted()
protected void
setCommitted(boolean committed)
Set the commit value.void
writePartitionMetadata(K key, int partitionSize)
Writes the metadata for a partition.
-
-
-
Constructor Detail
-
FileMetadata
public FileMetadata()
Construct a new file metadata.
-
FileMetadata
public FileMetadata(java.util.List<PartitionMetadata<K>> partitionMetadataList)
Construct a file metadata with existing partition metadata.- Parameters:
partitionMetadataList
- the partition metadata list.
-
-
Method Detail
-
writePartitionMetadata
public final void writePartitionMetadata(K key, int partitionSize) throws java.io.IOException
Writes the metadata for a partition.- Parameters:
key
- the key of the partition.partitionSize
- the size of the partition.- Throws:
java.io.IOException
- if fail to append the partition metadata.
-
getPartitionMetadataList
public final java.util.List<PartitionMetadata<K>> getPartitionMetadataList()
Gets a list containing the partition metadata of corresponding block.- Returns:
- the list containing the partition metadata.
-
deleteMetadata
public abstract void deleteMetadata() throws java.io.IOException
Deletes the metadata.- Throws:
java.io.IOException
- if fail to delete.
-
commitBlock
public abstract void commitBlock() throws java.io.IOException
Notifies that all writes are finished for the block corresponding to this metadata.- Throws:
java.io.IOException
- if fail to commit.
-
setCommitted
protected final void setCommitted(boolean committed)
Set the commit value.- Parameters:
committed
- whether this block is committed or not.
-
isCommitted
public final boolean isCommitted()
- Returns:
- whether this file is committed or not.
-
-