Package org.yamcs.yarch
Interface StorageEngine
-
- All Known Implementing Classes:
RdbStorageEngine
public interface StorageEngine
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidcreateTable(YarchDatabaseInstance ydb, TableDefinition tblDef)Create a new table based on definition.voiddropTable(YarchDatabaseInstance ydb, TableDefinition tblDef)Drop the table (removing all data)BucketDatabasegetBucketDatabase(YarchDatabaseInstance yarchDatabaseInstance)HistogramIteratorgetHistogramIterator(YarchDatabaseInstance ydb, TableDefinition tblDef, String columnName, TimeInterval interval)PartitionManagergetPartitionManager(YarchDatabaseInstance ydb, TableDefinition tblDef)ProtobufDatabasegetProtobufDatabase(YarchDatabaseInstance ydb)SequencegetSequence(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.List<SequenceInfo>getSequencesInfo(YarchDatabaseInstance ydb)Gets the list of sequences togehter with their latest valuesTagDbgetTagDb(YarchDatabaseInstance ydb)List<TableDefinition>loadTables(YarchDatabaseInstance ydb)Loads the table definitions from the disk for all the tables belonging to the instance.default voidmigrateTableDefinition(YarchDatabaseInstance ydb, TableDefinition tblDef)In Yamcs version 4 the table definitions were stored in yaml serialized format (in the /storage/yamcs-data// .def) TableWalkernewSecondaryIndexTableWalker(YarchDatabaseInstance ydb, TableDefinition tableDefinition, boolean ascending, boolean follow)TableWalkernewTableWalker(YarchDatabaseInstance ydb, TableDefinition tblDef, boolean ascending, boolean follow)Creates a new table iterator.TableWriternewTableWriter(YarchDatabaseInstance ydb, TableDefinition tblDef, TableWriter.InsertMode insertMode)Creates a new table writervoidsaveTableDefinition(YarchDatabaseInstance ydb, TableDefinition tblDef, List<TableColumnDefinition> keyColumns, List<TableColumnDefinition> valueColumns)Persist the table definition to diks (called when the table definition modifies)
-
-
-
Method Detail
-
loadTables
List<TableDefinition> loadTables(YarchDatabaseInstance ydb) throws YarchException
Loads the table definitions from the disk for all the tables belonging to the instance.called at startup.
- Parameters:
ydb-- Throws:
YarchException
-
createTable
void createTable(YarchDatabaseInstance ydb, TableDefinition tblDef) throws YarchException
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
void dropTable(YarchDatabaseInstance ydb, TableDefinition tblDef) throws YarchException
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(YarchDatabaseInstance ydb, TableDefinition tblDef, boolean ascending, boolean follow)
Creates a new table iterator.- Parameters:
ydb-tblDef-
-
getTagDb
TagDb getTagDb(YarchDatabaseInstance ydb) throws YarchException
- Throws:
YarchException
-
getHistogramIterator
HistogramIterator getHistogramIterator(YarchDatabaseInstance ydb, TableDefinition tblDef, String columnName, TimeInterval interval) throws YarchException
- Throws:
YarchException
-
getBucketDatabase
BucketDatabase getBucketDatabase(YarchDatabaseInstance yarchDatabaseInstance) throws YarchException
- Throws:
YarchException
-
getProtobufDatabase
ProtobufDatabase getProtobufDatabase(YarchDatabaseInstance ydb) throws YarchException
- Throws:
YarchException
-
getPartitionManager
PartitionManager getPartitionManager(YarchDatabaseInstance ydb, TableDefinition tblDef)
-
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// .def) This function is called to migrate them inside the storage engine where they are stored starting with Yamcs 5
- Throws:
YarchException
-
getSequence
Sequence getSequence(YarchDatabaseInstance ydb, String name, boolean create) throws YarchException
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
List<SequenceInfo> getSequencesInfo(YarchDatabaseInstance ydb)
Gets the list of sequences togehter with their latest values
-
-