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)
-
Method Summary
Modifier and TypeMethodDescriptionaddFileSystemBucket(String bucketName, Path location) Adds a bucket that maps to the file system.voidAdds a stream to the dictionary making it "official"voidclose()createBucket(String bucketName) 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 existvoiddeleteBucket(String bucketName) voidExecutes 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 asexecuteUnchecked(String, Object...)but it embeds any exception into aYarchExceptionvoidexecuteUnchecked(StreamSqlStatement stmt, ResultListener resultListener) 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.voidremoveStream(String name) voidrenameTable(String name, String newName) booleanstreamOrTableExists(String name)
-
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
-
executeUnchecked
-
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 asexecuteUnchecked(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
-
getBucket
- Throws:
IOException
-
createBucket
- Throws:
IOException
-
addFileSystemBucket
Adds a bucket that maps to the file system. This is a transient operation that has to be done on each server restart.- Parameters:
bucketName- the name of the bucketlocation- the path to the bucket contents- Returns:
- the created bucket
- Throws:
IOException- on I/O issues
-
listBuckets
- Throws:
IOException
-
deleteBucket
- Throws:
IOException
-
getSequence
- Throws:
YarchException
-
getSequencesInfo
-