Class FileMetadata<K extends>

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

    public abstract class FileMetadata<K extends>
    extends java.lang.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​(java.util.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)
        Writes the metadata for a partition.
        key - the key of the partition.
        partitionSize - the size of the partition.
        Throws: - 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.
        the list containing the partition metadata.
      • deleteMetadata

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

        public abstract void commitBlock()
        Notifies that all writes are finished for the block corresponding to this metadata.
        Throws: - 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.