Package org.yamcs.yarch
Interface StorageEngine
- All Known Implementing Classes:
RdbStorageEngine
public interface StorageEngine
-
Method Summary
Modifier and TypeMethodDescriptionvoid
createTable
(YarchDatabaseInstance ydb, TableDefinition tblDef) Create a new table based on definition.void
dropTable
(YarchDatabaseInstance ydb, TableDefinition tblDef) Drop the table (removing all data)getBucketDatabase
(YarchDatabaseInstance yarchDatabaseInstance) getHistogramIterator
(YarchDatabaseInstance ydb, TableDefinition tblDef, String columnName, TimeInterval interval) getPartitionManager
(YarchDatabaseInstance ydb, TableDefinition tblDef) getSequence
(YarchDatabaseInstance ydb, String name, boolean create) Returns a sequence with the given name if it exists or first create it and returns it if create is true.Gets the list of sequences togehter with their latest valuesLoads the table definitions from the disk for all the tables belonging to the instance.default void
migrateTableDefinition
(YarchDatabaseInstance ydb, TableDefinition tblDef) In Yamcs version 4 the table definitions were stored in yaml serialized format (in the /storage/yamcs-data/<instance-name>/<table-name>.def)newSecondaryIndexTableWalker
(YarchDatabaseInstance ydb, TableDefinition tableDefinition, boolean ascending, boolean follow) newTableWalker
(ExecutionContext ctx, TableDefinition tblDef, boolean ascending, boolean follow) Creates a new table iterator.newTableWriter
(YarchDatabaseInstance ydb, TableDefinition tblDef, TableWriter.InsertMode insertMode) Creates a new table writervoid
renameTable
(YarchDatabaseInstance ydb, TableDefinition tblDef, String newName) rename the tablevoid
saveTableDefinition
(YarchDatabaseInstance ydb, TableDefinition tblDef, List<TableColumnDefinition> keyColumns, List<TableColumnDefinition> valueColumns) Persist the table definition to diks (called when the table definition modifies)
-
Method Details
-
loadTables
Loads the table definitions from the disk for all the tables belonging to the instance.called at startup.
- Parameters:
ydb
-- Throws:
YarchException
-
createTable
Create a new table based on definition.- Parameters:
ydb
-tblDef
-- Throws:
YarchException
-
saveTableDefinition
void saveTableDefinition(YarchDatabaseInstance ydb, TableDefinition tblDef, List<TableColumnDefinition> keyColumns, List<TableColumnDefinition> valueColumns) throws YarchException Persist the table definition to diks (called when the table definition modifies)The general table properties should be read from the tblDef argument but the column properties should be read from the extra arguments This is because the method is called with modified column content which is not reflected in the table definition until the data is saved in the database.
- Parameters:
ydb
-tblDef
-- Throws:
YarchException
-
dropTable
Drop the table (removing all data)- Parameters:
ydb
-tblDef
-- Throws:
YarchException
-
newTableWriter
TableWriter newTableWriter(YarchDatabaseInstance ydb, TableDefinition tblDef, TableWriter.InsertMode insertMode) throws YarchException Creates a new table writer- Parameters:
ydb
-tblDef
-insertMode
-- Returns:
- Throws:
YarchException
-
newTableWalker
TableWalker newTableWalker(ExecutionContext ctx, TableDefinition tblDef, boolean ascending, boolean follow) Creates a new table iterator.- Parameters:
ctx
-tblDef
-
-
getHistogramIterator
HistogramIterator getHistogramIterator(YarchDatabaseInstance ydb, TableDefinition tblDef, String columnName, TimeInterval interval) throws YarchException - Throws:
YarchException
-
getBucketDatabase
- Throws:
YarchException
-
getProtobufDatabase
- Throws:
YarchException
-
getPartitionManager
-
migrateTableDefinition
default void migrateTableDefinition(YarchDatabaseInstance ydb, TableDefinition tblDef) throws YarchException In Yamcs version 4 the table definitions were stored in yaml serialized format (in the /storage/yamcs-data/<instance-name>/<table-name>.def)This function is called to migrate them inside the storage engine where they are stored starting with Yamcs 5
- Throws:
YarchException
-
getSequence
Returns a sequence with the given name if it exists or first create it and returns it if create is true.If create is false and the sequence does not exist, returns null.
- Parameters:
name
-create
-- Returns:
- Throws:
YarchException
-
newSecondaryIndexTableWalker
TableWalker newSecondaryIndexTableWalker(YarchDatabaseInstance ydb, TableDefinition tableDefinition, boolean ascending, boolean follow) -
getSequencesInfo
Gets the list of sequences togehter with their latest values -
renameTable
rename the table
-