Interface IChunkGroupWriter

  • All Known Implementing Classes:
    AlignedChunkGroupWriterImpl, NonAlignedChunkGroupWriterImpl

    public interface IChunkGroupWriter
    A chunk group in TsFile contains several series. A ChunkGroupWriter should implement write method which takes a timestamp(in TimeValue class) and a list of data points as input. It should also provide flushing method for serializing to local file system or HDFS.
    • Method Detail

      • write

        int write​(long time,
                  java.util.List<DataPoint> data)
           throws WriteProcessException,
                  java.io.IOException
        receive a timestamp and a list of data points, write them to their series writers.
        Parameters:
        time - - all data points have unify time stamp.
        data - - data point list to input
        Throws:
        WriteProcessException - exception in write process
        java.io.IOException - exception in IO
      • flushToFileWriter

        long flushToFileWriter​(TsFileIOWriter tsfileWriter)
                        throws java.io.IOException
        flushing method for serializing to local file system or HDFS. Implemented by ChunkWriterImpl.writeToFileWriter().
        Parameters:
        tsfileWriter - - TSFileIOWriter
        Returns:
        current ChunkGroupDataSize
        Throws:
        java.io.IOException - exception in IO
      • updateMaxGroupMemSize

        long updateMaxGroupMemSize()
        get the max memory occupied at this time. Note that, this method should be called after running long calcAllocatedSize()
        Returns:
        - allocated memory size.
      • tryToAddSeriesWriter

        void tryToAddSeriesWriter​(MeasurementSchema measurementSchema)
                           throws java.io.IOException
        given a measurement descriptor, create a corresponding writer and put into this ChunkGroupWriter.
        Parameters:
        measurementSchema - a measurement descriptor containing the message of the series
        Throws:
        java.io.IOException
      • tryToAddSeriesWriter

        void tryToAddSeriesWriter​(java.util.List<MeasurementSchema> measurementSchemas)
                           throws java.io.IOException
        given a measurement descriptor list, create corresponding writers and put into this ChunkGroupWriter.
        Parameters:
        measurementSchemas -
        Throws:
        java.io.IOException
      • getCurrentChunkGroupSize

        long getCurrentChunkGroupSize()
        get the serialized size of current chunkGroup header + all chunks. Notice, the value does not include any un-sealed page in the chunks.
        Returns:
        the serialized size of current chunkGroup header + all chunk