Interface IStatsFileDatabaseLevel


  • public interface IStatsFileDatabaseLevel
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean deleteRows​(int row)
      Deletes all rows equal to and greater than supplied row.
      boolean deleteRowsAll()
      Deletes all data in level.
      void dropIndexData()
      As time and records are read/written some storage is used to speed operation.
      boolean findTime​(long time, com.wowza.wms.stats.database.file.StatsFileDatabaseTime timeResult)
      Find the closest row with a given time.
      int getBytesPerField()
      Get the number of bytes per-field
      int getFieldCount()
      Get the number of fields per-row.
      boolean getFirstTime​(com.wowza.wms.stats.database.file.StatsFileDatabaseTime timeResult)
      Get the time of row 0
      int getFlags()
      Get flags
      boolean getLastTime​(com.wowza.wms.stats.database.file.StatsFileDatabaseTime timeResult)
      Get the time of last row
      long getLastWriteTime()
      Get the time of the last row written.
      int getLevelIndex()
      Get level index
      int getRowCountCurrent()
      Get the current number of rows in the level
      int getRowCountMax()
      Get the maximum number of rows for this level
      int getRowStorageSize()
      Get the storage size in bytes for a single row of data.
      int getTableCount()
      Get the number of tables
      boolean getTime​(int row, com.wowza.wms.stats.database.file.StatsFileDatabaseTime timeResult)
      Get time associdated with a given row.
      int getTimeIncrement()
      Get the time increment for this level (only informational)
      int getTimeIndexFactor()
      Not really used - may use in the future
      int getTimes​(int row, int count, long[] time)
      Get time for a range or rows.
      int getVersion()
      Get version
      boolean readRows​(int table, int row, int count, byte[] rowBytes, int offset)
      Read the data for a range of rows.
      void setBytesPerField​(int bytesPerField)
      Set the number of bytes per-fied (only when creating empty database)
      void setFieldCount​(int fieldCount)
      Set the number of fields per-row (only when creating empty database)
      void setRowCountMax​(int rowCountMax)
      Get the max number of rows (only when creating empty database)
      void setTableCount​(int tableCount)
      Set number of tables (only when creating empty database)
      void setTimeIncrement​(int timeIncrement)
      Set the time increment for this level v
      void setTimeIndexFactor​(int timeIndexFactor)
      Not really used - may use in the future
      boolean writeRow​(long timecode, int[] fields)
      Write a row to the level.
      boolean writeRow​(long timecode, int[][] fieldsArr)
      Write a row to the level.
    • Method Detail

      • getLevelIndex

        int getLevelIndex()
        Get level index
        Returns:
        level index
      • dropIndexData

        void dropIndexData()
        As time and records are read/written some storage is used to speed operation. This will dump the storage. It will be re-created if needed by underlying APIs.
      • findTime

        boolean findTime​(long time,
                         com.wowza.wms.stats.database.file.StatsFileDatabaseTime timeResult)
        Find the closest row with a given time. If the time is greater then the last row false will be returned. If the level is empty false will be returned. It will find closets time not greater then the requested time.
        Parameters:
        time -
        timeResult -
        Returns:
        returns false if time is greater than last row in level or level is empty
      • getFirstTime

        boolean getFirstTime​(com.wowza.wms.stats.database.file.StatsFileDatabaseTime timeResult)
        Get the time of row 0
        Parameters:
        timeResult -
        Returns:
        returns false if level is empty
      • getLastTime

        boolean getLastTime​(com.wowza.wms.stats.database.file.StatsFileDatabaseTime timeResult)
        Get the time of last row
        Parameters:
        timeResult -
        Returns:
        returns false if level is empty
      • getTime

        boolean getTime​(int row,
                        com.wowza.wms.stats.database.file.StatsFileDatabaseTime timeResult)
        Get time associdated with a given row.
        Parameters:
        row -
        timeResult -
        Returns:
        returns false if row is greater then total row count or level is empty
      • getTimes

        int getTimes​(int row,
                     int count,
                     long[] time)
        Get time for a range or rows. If count = -1 it will get times for all rows to end of table.
        Parameters:
        row -
        count -
        time -
        Returns:
        returns false if row+count is greater then total row count or level is empty
      • getLastWriteTime

        long getLastWriteTime()
        Get the time of the last row written. writeRow will fail if try to write row using timecode less than this value. If returns -1 means level is empty.
        Returns:
        time of the last row written (milliseconds)
      • deleteRowsAll

        boolean deleteRowsAll()
        Deletes all data in level.
        Returns:
        true, if rows deleted
      • deleteRows

        boolean deleteRows​(int row)
        Deletes all rows equal to and greater than supplied row.
        Parameters:
        row -
        Returns:
        true, if rows deleted
      • getRowStorageSize

        int getRowStorageSize()
        Get the storage size in bytes for a single row of data.
        Returns:
        storage size in bytes
      • readRows

        boolean readRows​(int table,
                         int row,
                         int count,
                         byte[] rowBytes,
                         int offset)
        Read the data for a range of rows. If count = -1 will read from row to the end of the level.
        Parameters:
        table -
        row -
        count -
        rowBytes -
        offset -
        Returns:
        true if successful
      • writeRow

        boolean writeRow​(long timecode,
                         int[] fields)
        Write a row to the level. This is for writing the level with only a single table's worth of data.
        Parameters:
        timecode -
        fields -
        Returns:
        true if successful
      • writeRow

        boolean writeRow​(long timecode,
                         int[][] fieldsArr)
        Write a row to the level. This is for writing to a level with more than one table (avg, min, max)
        Parameters:
        timecode -
        fieldsArr -
        Returns:
        true if successful
      • getRowCountMax

        int getRowCountMax()
        Get the maximum number of rows for this level
        Returns:
        maximum number of rows for this level
      • setRowCountMax

        void setRowCountMax​(int rowCountMax)
        Get the max number of rows (only when creating empty database)
        Parameters:
        rowCountMax -
      • getRowCountCurrent

        int getRowCountCurrent()
        Get the current number of rows in the level
        Returns:
        current number of rows in the level
      • getFieldCount

        int getFieldCount()
        Get the number of fields per-row.
        Returns:
        number of fields per-row
      • setFieldCount

        void setFieldCount​(int fieldCount)
        Set the number of fields per-row (only when creating empty database)
        Parameters:
        fieldCount -
      • getTableCount

        int getTableCount()
        Get the number of tables
        Returns:
        number of tables
      • setTableCount

        void setTableCount​(int tableCount)
        Set number of tables (only when creating empty database)
        Parameters:
        tableCount -
      • getBytesPerField

        int getBytesPerField()
        Get the number of bytes per-field
        Returns:
        number of bytes per-field
      • setBytesPerField

        void setBytesPerField​(int bytesPerField)
        Set the number of bytes per-fied (only when creating empty database)
        Parameters:
        bytesPerField -
      • getTimeIncrement

        int getTimeIncrement()
        Get the time increment for this level (only informational)
        Returns:
        time increment for this level
      • setTimeIncrement

        void setTimeIncrement​(int timeIncrement)
        Set the time increment for this level v
        Parameters:
        timeIncrement -
      • getTimeIndexFactor

        int getTimeIndexFactor()
        Not really used - may use in the future
        Returns:
        not used
      • setTimeIndexFactor

        void setTimeIndexFactor​(int timeIndexFactor)
        Not really used - may use in the future
        Parameters:
        timeIndexFactor -
      • getVersion

        int getVersion()
        Get version
        Returns:
        version
      • getFlags

        int getFlags()
        Get flags
        Returns:
        flags