Class YarchDatabaseInstance
Synchronisation policy: to avoid problems with stream disappearing when clients connect to them, all the creation/closing/subscription to streams/tables shall be done while acquiring a lock on the YarchDatabase object. This is done in the StreamSqlStatement.java
Delivery of tuples does not require locking, this means subscription can change while delivering (for that a concurrent list is used in Stream.java)
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidvoidAdds a stream to the dictionary making it "official"voidclose()createStatement(String query, Object... args) voidcreateTable(TableDefinition tbldef) add a table to the dictionary throws exception if a table or a stream with the same name already existvoidExecutes a query and returns a result.execute(StreamSqlStatement stmt) voidexecute(StreamSqlStatement stmt, ResultListener resultListener) voidexecute(StreamSqlStatement stmt, ResultListener resultListener, long limit) voidexecuteDiscardingResult(String query, Object... args) executeUnchecked(String query, Object... args) Same asexecute(String, Object...)but it embeds any exception into aYarchExceptionSame asexecute(StreamSqlStatement)but it embeds any exception into aYarchExceptionReturn the time partitioning schema configured (dataPartitioningByTime) if any.getName()Returns the storage engine used for the parameter archive, seegetParameterArchiveStorageEngineName()Returns the name of the storage engine used for the parameter archive.getPartitionManager(TableDefinition tblDef) getRoot()Returns the root directory for this database instance.getSequence(String name, boolean create) getStorageEngine(TableDefinition tbldef) getStorageEngineName(String tableName) Returns the name of the storage engine used for a new table created without specifying the engine.Tablespaces are used byRdbStorageEngineto store data.Get the time partitioning schema configured in the passed config, or the instance schemavoidremoveStream(String name) voidrenameTable(String name, String newName) booleanstreamOrTableExists(String name) booleanusesStorageEngine(String engineName) Returns true if the instance configuration directs tables or the parameter archive to the given storage engine (as instance default engine, for specific tables or for the parameter archive), or if the instance does not configure a default engine and the given engine is the global default storage engine.
-
Field Details
-
PART_CONF_KEY
-
DEFAULT_ENGINE_CONF_KEY
- See Also:
-
TABLE_ENGINES_CONF_KEY
- See Also:
-
PARCHIVE_ENGINE_CONF_KEY
- See Also:
-
-
Method Details
-
getStorageEngineName
Returns the name of the storage engine used for a new table created without specifying the engine.This is the engine configured for the table in the
tableStorageEnginessection of the instance configuration, if any, otherwise thedefaultStorageEngineof the instance, if configured, otherwise the global default storage engine. -
getParameterArchiveStorageEngineName
Returns the name of the storage engine used for the parameter archive.This is the
parameterArchiveStorageEngineof the instance configuration, if configured, otherwise thedefaultStorageEngineof the instance, if configured, otherwise the global default storage engine. -
getParameterArchiveStorageEngine
Returns the storage engine used for the parameter archive, seegetParameterArchiveStorageEngineName() -
usesStorageEngine
Returns true if the instance configuration directs tables or the parameter archive to the given storage engine (as instance default engine, for specific tables or for the parameter archive), or if the instance does not configure a default engine and the given engine is the global default storage engine.Can be used by the storage engines in
StorageEngine.loadTables(YarchDatabaseInstance)to know if the instance has to be prepared. -
getPartitionManager
-
getTablespaceName
Tablespaces are used byRdbStorageEngineto store data. Returns the default tablespace name that is used by all tables and also the parameter archive of this yamcs instance -
getName
- Returns:
- the instance name
-
getYamcsInstance
-
createTable
add a table to the dictionary throws exception if a table or a stream with the same name already exist- Parameters:
tbldef- - table definition- Throws:
YarchException- - thrown in case a table or a stream with the same name already exists or if there was an error in creating the table
-
addStream
Adds a stream to the dictionary making it "official"- Parameters:
stream-- Throws:
YarchException
-
renameTable
-
getTable
-
streamOrTableExists
-
getStream
-
dropTable
-
removeStream
-
getStorageEngine
-
getStreams
-
getTableDefinitions
-
getRoot
Returns the root directory for this database instance. It is usually home/instance_name. -
createStatement
public StreamSqlStatement createStatement(String query, Object... args) throws StreamSqlException, ParseException - Throws:
StreamSqlExceptionParseException
-
execute
public void execute(StreamSqlStatement stmt, ResultListener resultListener, long limit) throws StreamSqlException - Throws:
StreamSqlException
-
execute
public void execute(StreamSqlStatement stmt, ResultListener resultListener) throws StreamSqlException - Throws:
StreamSqlException
-
execute
- Throws:
StreamSqlException
-
execute
public StreamSqlResult execute(String query, Object... args) throws StreamSqlException, ParseException Executes a query and returns a result.If the result contains streaming data (select from table or stream) you have to close the result
- Parameters:
query-args-- Returns:
- Throws:
StreamSqlExceptionParseException
-
executeUnchecked
Same asexecute(StreamSqlStatement)but it embeds any exception into aYarchException -
executeUnchecked
Same asexecute(String, Object...)but it embeds any exception into aYarchException- Parameters:
query-args-- Returns:
-
executeDiscardingResult
public void executeDiscardingResult(String query, Object... args) throws StreamSqlException, ParseException - Throws:
StreamSqlExceptionParseException
-
close
public void close() -
getProtobufDatabase
- Throws:
YarchException
-
getDefaultPartitioningSchema
Return the time partitioning schema configured (dataPartitioningByTime) if any.If not configured, return null.
-
getSequence
- Throws:
YarchException
-
getSequencesInfo
-
addSpec
-
getTimePartitioningSchema
Get the time partitioning schema configured in the passed config, or the instance schemareturns null of "none" is configured in the config or if there is no configuration in the config or at instance level
-