Package org.yamcs.yarch
Class YarchDatabaseInstance
java.lang.Object
org.yamcs.yarch.YarchDatabaseInstance
Handles tables and streams for one Yamcs Instance
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()getPartitionManager(TableDefinition tblDef) getRoot()Returns the root directory for this database instance.getSequence(String name, boolean create) getStorageEngine(TableDefinition tbldef) 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)
-
Field Details
-
PART_CONF_KEY
-
-
Method Details
-
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
-