Package org.yamcs.yarch.rocksdb
Class RdbStorageEngine
- java.lang.Object
-
- org.yamcs.yarch.rocksdb.RdbStorageEngine
-
- All Implemented Interfaces:
StorageEngine
public class RdbStorageEngine extends Object implements StorageEngine
Storage Engine based on RocksDB. Data is stored in multipleTablespace.Each table has associated a tablespace, if not set at creation of the table, it is the tablespace associated to the instance.
-
-
Field Summary
Fields Modifier and Type Field Description static intTBS_INDEX_SIZEstatic byte[]ZERO_BYTES
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreateTable(YarchDatabaseInstance ydb, TableDefinition def)Create a new table based on definition.TablespacecreateTablespace(String tablespaceName)voiddropTable(YarchDatabaseInstance ydb, TableDefinition tbl)Drop the table (removing all data)voiddropTablespace(String tablespaceName)BucketDatabasegetBucketDatabase(YarchDatabaseInstance ydb)HistogramIteratorgetHistogramIterator(YarchDatabaseInstance ydb, TableDefinition tblDef, String columnName, TimeInterval interval)static RdbStorageEnginegetInstance()RdbPartitionManagergetPartitionManager(YarchDatabaseInstance ydb, TableDefinition tblDef)ProtobufDatabasegetProtobufDatabase(YarchDatabaseInstance ydb)TablespacegetTablespace(String tablespaceName)TablespacegetTablespace(YarchDatabaseInstance ydb)Create and/or get the tablespace for the yarch database instance.Map<String,Tablespace>getTablespaces()TagDbgetTagDb(YarchDatabaseInstance ydb)List<TableDefinition>loadTables(YarchDatabaseInstance ydb)Loads the table definitions from the disk for all the tables belonging to the instance.voidmigrateTableDefinition(YarchDatabaseInstance ydb, TableDefinition tblDef)In Yamcs version 4 the table definitions were stored in yaml serialized format (in the /storage/yamcs-data// .def) StreamnewTableReaderStream(YarchDatabaseInstance ydb, TableDefinition tbl, boolean ascending, boolean follow)Creates a new table reader.RdbTableWriternewTableWriter(YarchDatabaseInstance ydb, TableDefinition tblDef, TableWriter.InsertMode insertMode)Creates a new table writervoidsaveTableDefinition(YarchDatabaseInstance ydb, TableDefinition tblDef)Persist the table definition to diks (called when the table definition modifies)voidsetIgnoreVersionIncompatibility(boolean b)set to ignore version incompatibility - only used from the version upgrading functions to allow loading old tables.voidshutdown()
-
-
-
Field Detail
-
TBS_INDEX_SIZE
public static final int TBS_INDEX_SIZE
- See Also:
- Constant Field Values
-
ZERO_BYTES
public static final byte[] ZERO_BYTES
-
-
Method Detail
-
dropTable
public void dropTable(YarchDatabaseInstance ydb, TableDefinition tbl) throws YarchException
Description copied from interface:StorageEngineDrop the table (removing all data)- Specified by:
dropTablein interfaceStorageEngine- Throws:
YarchException
-
newTableWriter
public RdbTableWriter newTableWriter(YarchDatabaseInstance ydb, TableDefinition tblDef, TableWriter.InsertMode insertMode)
Description copied from interface:StorageEngineCreates a new table writer- Specified by:
newTableWriterin interfaceStorageEngine- Returns:
-
newTableReaderStream
public Stream newTableReaderStream(YarchDatabaseInstance ydb, TableDefinition tbl, boolean ascending, boolean follow)
Description copied from interface:StorageEngineCreates a new table reader.- Specified by:
newTableReaderStreamin interfaceStorageEngine
-
createTable
public void createTable(YarchDatabaseInstance ydb, TableDefinition def) throws YarchException
Description copied from interface:StorageEngineCreate a new table based on definition.- Specified by:
createTablein interfaceStorageEngine- Throws:
YarchException
-
getInstance
public static RdbStorageEngine getInstance()
-
getPartitionManager
public RdbPartitionManager getPartitionManager(YarchDatabaseInstance ydb, TableDefinition tblDef)
-
getTagDb
public TagDb getTagDb(YarchDatabaseInstance ydb) throws YarchException
- Specified by:
getTagDbin interfaceStorageEngine- Throws:
YarchException
-
getTablespace
public Tablespace getTablespace(YarchDatabaseInstance ydb)
Create and/or get the tablespace for the yarch database instance.- Parameters:
ydb-- Returns:
-
getTablespaces
public Map<String,Tablespace> getTablespaces()
-
createTablespace
public Tablespace createTablespace(String tablespaceName)
-
setIgnoreVersionIncompatibility
public void setIgnoreVersionIncompatibility(boolean b)
set to ignore version incompatibility - only used from the version upgrading functions to allow loading old tables.- Parameters:
b-
-
getHistogramIterator
public HistogramIterator getHistogramIterator(YarchDatabaseInstance ydb, TableDefinition tblDef, String columnName, TimeInterval interval) throws YarchException
- Specified by:
getHistogramIteratorin interfaceStorageEngine- Throws:
YarchException
-
getBucketDatabase
public BucketDatabase getBucketDatabase(YarchDatabaseInstance ydb) throws YarchException
- Specified by:
getBucketDatabasein interfaceStorageEngine- Throws:
YarchException
-
getProtobufDatabase
public ProtobufDatabase getProtobufDatabase(YarchDatabaseInstance ydb) throws YarchException
- Specified by:
getProtobufDatabasein interfaceStorageEngine- Throws:
YarchException
-
getTablespace
public Tablespace getTablespace(String tablespaceName)
-
dropTablespace
public void dropTablespace(String tablespaceName)
-
shutdown
public void shutdown()
-
loadTables
public List<TableDefinition> loadTables(YarchDatabaseInstance ydb) throws YarchException
Description copied from interface:StorageEngineLoads the table definitions from the disk for all the tables belonging to the instance.called at startup.
- Specified by:
loadTablesin interfaceStorageEngine- Throws:
YarchException
-
migrateTableDefinition
public void migrateTableDefinition(YarchDatabaseInstance ydb, TableDefinition tblDef) throws YarchException
Description copied from interface:StorageEngineIn 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
- Specified by:
migrateTableDefinitionin interfaceStorageEngine- Throws:
YarchException
-
saveTableDefinition
public void saveTableDefinition(YarchDatabaseInstance ydb, TableDefinition tblDef) throws YarchException
Description copied from interface:StorageEnginePersist the table definition to diks (called when the table definition modifies)- Specified by:
saveTableDefinitionin interfaceStorageEngine- Throws:
YarchException
-
-