Interface IStatsFileDatabaseLevel
public interface IStatsFileDatabaseLevel
-
Method Summary
Modifier and TypeMethodDescriptionbooleandeleteRows(int row) Deletes all rows equal to and greater than supplied row.booleanDeletes all data in level.voidAs time and records are read/written some storage is used to speed operation.booleanfindTime(long time, com.wowza.wms.stats.database.file.StatsFileDatabaseTime timeResult) Find the closest row with a given time.intGet the number of bytes per-fieldintGet the number of fields per-row.booleangetFirstTime(com.wowza.wms.stats.database.file.StatsFileDatabaseTime timeResult) Get the time of row 0intgetFlags()Get flagsbooleangetLastTime(com.wowza.wms.stats.database.file.StatsFileDatabaseTime timeResult) Get the time of last rowlongGet the time of the last row written.intGet level indexintGet the current number of rows in the levelintGet the maximum number of rows for this levelintGet the storage size in bytes for a single row of data.intGet the number of tablesbooleangetTime(int row, com.wowza.wms.stats.database.file.StatsFileDatabaseTime timeResult) Get time associdated with a given row.intGet the time increment for this level (only informational)intNot really used - may use in the futureintgetTimes(int row, int count, long[] time) Get time for a range or rows.intGet versionbooleanreadRows(int table, int row, int count, byte[] rowBytes, int offset) Read the data for a range of rows.voidsetBytesPerField(int bytesPerField) Set the number of bytes per-fied (only when creating empty database)voidsetFieldCount(int fieldCount) Set the number of fields per-row (only when creating empty database)voidsetRowCountMax(int rowCountMax) Get the max number of rows (only when creating empty database)voidsetTableCount(int tableCount) Set number of tables (only when creating empty database)voidsetTimeIncrement(int timeIncrement) Set the time increment for this level vvoidsetTimeIndexFactor(int timeIndexFactor) Not really used - may use in the futurebooleanwriteRow(long timecode, int[] fields) Write a row to the level.booleanwriteRow(long timecode, int[][] fieldsArr) Write a row to the level.
-
Method Details
-
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
-