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 void
createTable(YarchDatabaseInstance ydb, TableDefinition tblDef)
Create a new table based on definition.void
dropTable(YarchDatabaseInstance ydb, TableDefinition tblDef)
Drop the table (removing all data)BucketDatabase
getBucketDatabase(YarchDatabaseInstance yarchDatabaseInstance)
HistogramIterator
getHistogramIterator(YarchDatabaseInstance ydb, TableDefinition tblDef, String columnName, TimeInterval interval)
PartitionManager
getPartitionManager(YarchDatabaseInstance ydb, TableDefinition tblDef)
ProtobufDatabase
getProtobufDatabase(YarchDatabaseInstance ydb)
Sequence
getSequence(YarchDatabaseInstance ydb, String name)
Creates (if not already existing) and returns a sequence with the given name.TagDb
getTagDb(YarchDatabaseInstance ydb)
List<TableDefinition>
loadTables(YarchDatabaseInstance ydb)
Loads 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// .def) TableWalker
newSecondaryIndexTableWalker(YarchDatabaseInstance ydb, TableDefinition tableDefinition, boolean ascending, boolean follow)
TableWalker
newTableWalker(YarchDatabaseInstance ydb, TableDefinition tblDef, boolean ascending, boolean follow)
Creates a new table iterator.TableWriter
newTableWriter(YarchDatabaseInstance ydb, TableDefinition tblDef, TableWriter.InsertMode insertMode)
Creates a new table writervoid
saveTableDefinition(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) throws YarchException
Creates (if not already existing) and returns a sequence with the given name.- Parameters:
name
-- Returns:
- Throws:
YarchException
-
newSecondaryIndexTableWalker
TableWalker newSecondaryIndexTableWalker(YarchDatabaseInstance ydb, TableDefinition tableDefinition, boolean ascending, boolean follow)
-
-