Online Database
The purpose of the Online Database (OLDB) is to allow SRTC components to publish monitoring information for access by GUIs, external tools and systems.
Important
CII OLDB was not designed to be reliable, therefore it should not be used to exchange data between SRTC components, such as Data Tasks. Use the Runtime Configuration Repository for this instead.
The OLDB datapoints that will be updated by a component should be created in an idempotent manner
during the initialisation activity when the Init command is received, i.e. if a needed datapoint
does not exist it should be created, otherwise the existing one is reused.
The monitoring datapoints can then be updated as needed during the remaining lifetime of the
component.
The OLDB datapoints should typically not be deleted by the component. They are cleaned up externally. It is nevertheless possible to delete such a datapoint if necessary.
Data Access
The API for accessing datapoints is similar to the Runtime Configuration Repository.
The differences are that the server alias setting is not applicable,
and the interface class to use is the OldbIf.
Since the server alias is not used for OLDB datapoints, this means they are always stored in the
central OLDB’s backend storage.
The OLDB should always be accessed through an instance of OldbIf.
An instance is fetched from the Service Discovery as follows:
auto oldb = m_services.Get<OldbIf>();
For this to work, each component must have the endpoint configured in the service discovery using
the oldb_endpoint datapoint (see also section Service Discovery).
Two URI schemes are supported for oldb_endpoint:
- cii.oldb
This is for the central OLDB instance, e.g.
cii.oldb:/instrument_prefix/rtc.
Refer to the Data Access sub-section of Runtime Configuration Repository for details about the actual methods for creating, reading, writing, deleting and querying datapoints.
Datapoint Subscription
The CII-based OLDB adapter supports subscription to datapoints, i.e. registering callbacks for new data updates and datapoint removal notifications. The API is the same as for the Runtime Configuration Repository. Therefore, refer to that Datapoint Subscription sub-section for details.
Supported Data Types
The same C++ data types are supported as for the Runtime Configuration Repository. Refer to the Supported Data Types sub-section of Runtime Configuration Repository for additional details.
Limitations and Known Issues
Aliasing of Types
The types for RtcVectorBool and RtcMatrixBool are being effectively aliased to
std::vector<int8_t> under the hood. The aliasing is transparent for code using OldbIf.
However, the underlying storage requirements will be significantly higher than expected,
and therefore can also exhibit lower performance than expected.
Additionally, RtcBinary is being alias to std::vector<uint8_t> as there is no matching
CII OLDB type for this.
Performance
The usage of gsl::span or MatrixSpan will not result in performance improvements, since an
extra memory copy is being performed under the hood. End developers are nevertheless encouraged
to use gsl::span and MatrixSpan when appropriate as future versions of CII OLDB and
RTC Toolkit are expected to improve the performance by eliminating the unnecessary memory copying.
Subscription Deadlocks
There is currently a subtle issue with the CII subscription mechanism where, in certain cases, lock order inversion can occur if locking is used within subscription callback handlers, potentially leading to a deadlock (ECII-691).
Other Bugs
The OLDB Adapter incorrectly accepts a datapoint path that does not start with a leading slash “/” character (RTCTK-1373).
One cannot pass
gsl::spanorMatrixSpanobjects that use constant types in the template type argument to the methods of adapters based onOldbIf. For example,gsl::span<const float>cannot be used, it must begsl::span<float>(RTCTK-958).