Class FileMetadata<K extends Serializable>

  • Type Parameters:
    K - the key type of its partitions.
    Direct Known Subclasses:
    LocalFileMetadata, RemoteFileMetadata

    public abstract class FileMetadata<K extends Serializable>
    extends Object
    This class represents a metadata for a 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 Detail

      • FileMetadata

        public FileMetadata()
        Construct a new file metadata.
      • FileMetadata

        public FileMetadata​(List<PartitionMetadata<K>> partitionMetadataList)
        Construct a file metadata with existing partition metadata.
        partitionMetadataList - the partition metadata list.
    • Method Detail

      • writePartitionMetadata

        public final void writePartitionMetadata​(K key,
                                                 int partitionSize)
                                          throws IOException
        Writes the metadata for a partition.
        key - the key of the partition.
        partitionSize - the size of the partition.
        IOException - if fail to append the partition metadata.
      • getPartitionMetadataList

        public final List<PartitionMetadata<K>> getPartitionMetadataList()
        Gets a list containing the partition metadata of corresponding block.
        the list containing the partition metadata.
      • deleteMetadata

        public abstract void deleteMetadata()
                                     throws IOException
        Deletes the metadata.
        IOException - if fail to delete.
      • commitBlock

        public abstract void commitBlock()
                                  throws IOException
        Notifies that all writes are finished for the block corresponding to this metadata.
        IOException - if fail to commit.
      • setCommitted

        protected final void setCommitted​(boolean committed)
        Set the commit value.
        committed - whether this block is committed or not.
      • isCommitted

        public final boolean isCommitted()
        whether this file is committed or not.