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
-
Method Summary
Modifier and TypeMethodDescriptionaddFileSystemBucket
(String bucketName, Path location) Adds a bucket that maps to the file system.static void
void
Adds a stream to the dictionary making it "official"void
close()
createBucket
(String bucketName) createStatement
(String query, Object... args) void
createTable
(TableDefinition tbldef) add a table to the dictionary throws exception if a table or a stream with the same name already existvoid
deleteBucket
(String bucketName) void
Executes a query and returns a result.execute
(StreamSqlStatement stmt) void
execute
(StreamSqlStatement stmt, ResultListener resultListener) void
execute
(StreamSqlStatement stmt, ResultListener resultListener, long limit) void
executeDiscardingResult
(String query, Object... args) executeUnchecked
(String query, Object... args) Same asexecute(String, Object...)
but it embeds any exception into aYarchException
Same asexecute(StreamSqlStatement)
but it embeds any exception into aYarchException
Return 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 byRdbStorageEngine
to store data.Get the time partitioning schema configured in the passed config, or the instance schemavoid
removeStream
(String name) void
renameTable
(String name, String newName) boolean
streamOrTableExists
(String name)
-
Field Details
-
PART_CONF_KEY
-
-
Method Details
-
getPartitionManager
-
getTablespaceName
Tablespaces are used byRdbStorageEngine
to 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:
StreamSqlException
ParseException
-
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:
StreamSqlException
ParseException
-
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:
StreamSqlException
ParseException
-
close
public void close() -
getProtobufDatabase
- Throws:
YarchException
-
getDefaultPartitioningSchema
Return the time partitioning schema configured (dataPartitioningByTime) if any.If not configured, return null.
-
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
-
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
-