Class DirectTickDBClient

  • All Implemented Interfaces:
    DXTickDB, TickDB, WritableTickDB, deltix.util.io.AbstractDataStore, deltix.util.lang.Disposable, java.io.Closeable, java.lang.AutoCloseable

    public class DirectTickDBClient
    extends java.lang.Object
    implements DXTickDB
    In-process client with separate open/close lifecycle.
    • Constructor Detail

      • DirectTickDBClient

        public DirectTickDBClient​(DXTickDB delegate)
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface deltix.util.lang.Disposable
      • open

        public void open​(boolean readOnly)
        Specified by:
        open in interface deltix.util.io.AbstractDataStore
      • assertOpen

        protected final void assertOpen()
      • assertWritable

        protected final void assertWritable()
      • USX

        protected final java.lang.UnsupportedOperationException USX()
      • isReadOnly

        public boolean isReadOnly()
        Specified by:
        isReadOnly in interface deltix.util.io.AbstractDataStore
      • isOpen

        public boolean isOpen()
        Specified by:
        isOpen in interface deltix.util.io.AbstractDataStore
      • getId

        public java.lang.String getId()
        Specified by:
        getId in interface deltix.util.io.AbstractDataStore
      • format

        public void format()
        Specified by:
        format in interface deltix.util.io.AbstractDataStore
      • delete

        public void delete()
        Specified by:
        delete in interface deltix.util.io.AbstractDataStore
      • select

        public TickCursor select​(long time,
                                 SelectionOptions options,
                                 java.lang.String[] types,
                                 deltix.qsrv.hf.pub.InstrumentIdentity[] entities,
                                 TickStream... streams)
        Description copied from interface: TickDB

        Opens a cursor for reading data from multiple streams, according to the specified options. The messages are returned from the cursor strictly ordered by time. Within the same exact time stamp, the order of messages is undefined and may vary from call to call, i.e. it is non-deterministic.

        Note that the arguments of this method only determine the initial configuration of the cursor. The TickCursor interface provides methods for dynamically re-configuring the subscription, or jumping to a different timestamp.

        Specified by:
        select in interface TickDB
        Parameters:
        time - The start timestamp.
        options - Selection options.
        types - Specified message types to be subscribed. If null, then all types will be subscribed.
        entities - Specified entities to be subscribed. If null, then all entities will be subscribed.
        streams - Streams from which data will be selected.
        Returns:
        A cursor used to read messages.
      • createCursor

        public TickCursor createCursor​(SelectionOptions options,
                                       TickStream... streams)
        Description copied from interface: TickDB

        Opens an initially empty cursor for reading data from multiple streams, according to the specified options. The messages are returned from the cursor strictly ordered by time. Within the same exact time stamp, the order of messages is undefined and may vary from call to call, i.e. it is non-deterministic.

        The cursor is returned initially empty and must be reset. The TickCursor interface provides methods for dynamically re-configuring the subscription, or jumping to a different timestamp.

        Specified by:
        createCursor in interface TickDB
        Parameters:
        options - Selection options.
        streams - Streams from which data will be selected.
        Returns:
        A cursor used to read messages.
      • warmUp

        public void warmUp()
        Description copied from interface: DXTickDB
        Forces the building of all memory indexes. This is useful in performance testing or on server startup.
        Specified by:
        warmUp in interface DXTickDB
      • trimToSize

        public void trimToSize()
        Description copied from interface: DXTickDB
        Trims all data files to minimum size.
        Specified by:
        trimToSize in interface DXTickDB
      • setGrowthPolicy

        public void setGrowthPolicy​(deltix.util.lang.GrowthPolicy policy)
        Description copied from interface: DXTickDB
        Sets the file growth policy
        Specified by:
        setGrowthPolicy in interface DXTickDB
        Parameters:
        policy - Growth Policy value
      • getStream

        public DXTickStream getStream​(java.lang.String key)
        Description copied from interface: WritableTickDB
        Looks up an existing stream by key.
        Specified by:
        getStream in interface DXTickDB
        Specified by:
        getStream in interface TickDB
        Specified by:
        getStream in interface WritableTickDB
        Parameters:
        key - Identifies the stream.
        Returns:
        A stream object, or null if the key was not found.
      • getSizeOnDisk

        public long getSizeOnDisk()
        Description copied from interface: DXTickDB
        Returns the approximate size of the database's footprint.
        Specified by:
        getSizeOnDisk in interface DXTickDB
        Returns:
        Size in bytes.
      • getServerTime

        public long getServerTime()
        Description copied from interface: DXTickDB
        Returns system time of the timebase server.
        Specified by:
        getServerTime in interface DXTickDB
      • getMetaDataVersion

        public long getMetaDataVersion()
        Description copied from interface: DXTickDB
        Gets current metadata version.
        Specified by:
        getMetaDataVersion in interface DXTickDB
        Returns:
        current metadata version number.
      • getMetaData

        public MetaData getMetaData()
        Description copied from interface: DXTickDB
        Gets stream metadata contains all class descriptors.
        Specified by:
        getMetaData in interface DXTickDB
        Returns:
        metadata object.
      • getDbDirs

        public java.io.File[] getDbDirs()
        Specified by:
        getDbDirs in interface DXTickDB
      • describeQuery

        public ClassSet<ClassDescriptor> describeQuery​(java.lang.String qql,
                                                       SelectionOptions options,
                                                       Parameter... params)
                                                throws deltix.util.parsers.CompilationException
        Description copied from interface: DXTickDB
        Returns schema for the given query.
        Specified by:
        describeQuery in interface DXTickDB
        Parameters:
        qql - Query text.
        options - Selection options.
        params - Specified message types to be subscribed. If null, then all types will be subscribed.*
        Returns:
        Schema contains classes definitions.
        Throws:
        deltix.util.parsers.CompilationException - when query has errors
      • executeQuery

        public InstrumentMessageSource executeQuery​(deltix.util.parsers.Element qql,
                                                    SelectionOptions options,
                                                    TickStream[] streams,
                                                    deltix.qsrv.hf.pub.InstrumentIdentity[] ids,
                                                    long time,
                                                    Parameter... params)
                                             throws deltix.util.parsers.CompilationException
        Description copied from interface: DXTickDB

        Execute Query and creates a message source for reading data from it, according to the specified options. The messages are returned from the cursor strictly ordered by time. Within the same exact time stamp, the order of messages is undefined and may vary from call to call, i.e. it is non-deterministic.

        select * from bars
        Specified by:
        executeQuery in interface DXTickDB
        Parameters:
        qql - Query text element.
        options - Selection options.
        streams - Streams from which data will be selected.
        ids - Specified entities to be subscribed. If null, then all entities will be subscribed.
        time - The start timestamp.
        params - The parameter values of the query.
        Returns:
        An iterable message source to read messages.
        Throws:
        deltix.util.parsers.CompilationException - when query has errors.
      • executeQuery

        public InstrumentMessageSource executeQuery​(deltix.util.parsers.Element qql,
                                                    SelectionOptions options,
                                                    TickStream[] streams,
                                                    deltix.qsrv.hf.pub.InstrumentIdentity[] ids,
                                                    long startTimestamp,
                                                    long endTimestamp,
                                                    Parameter... params)
                                             throws deltix.util.parsers.CompilationException
        Description copied from interface: DXTickDB

        Execute Query and creates a message source for reading data from it, according to the specified options. The messages are returned from the cursor strictly ordered by time. Within the same exact time stamp, the order of messages is undefined and may vary from call to call, i.e. it is non-deterministic.

        select * from bars
        Specified by:
        executeQuery in interface DXTickDB
        Parameters:
        qql - Query text element.
        options - Selection options.
        streams - Streams from which data will be selected.
        ids - Specified entities to be subscribed. If null, then all entities will be subscribed.
        startTimestamp - The start timestamp.
        endTimestamp - The end timestamp
        params - The parameter values of the query.
        Returns:
        An iterable message source to read messages.
        Throws:
        deltix.util.parsers.CompilationException - when query has errors.
      • executeQuery

        public InstrumentMessageSource executeQuery​(java.lang.String qql,
                                                    SelectionOptions options,
                                                    TickStream[] streams,
                                                    deltix.qsrv.hf.pub.InstrumentIdentity[] ids,
                                                    long time,
                                                    Parameter... params)
                                             throws deltix.util.parsers.CompilationException
        Description copied from interface: DXTickDB

        Execute Query and creates a message source for reading data from it, according to the specified options. The messages are returned from the cursor strictly ordered by time. Within the same exact time stamp, the order of messages is undefined and may vary from call to call, i.e. it is non-deterministic.

        select * from bars
        Specified by:
        executeQuery in interface DXTickDB
        Parameters:
        qql - Query text.
        options - Selection options.
        streams - Streams from which data will be selected.
        ids - Specified entities to be subscribed. If null, then all entities will be subscribed.
        time - The start timestamp.
        params - The parameter values of the query.
        Returns:
        An iterable message source to read messages.
        Throws:
        deltix.util.parsers.CompilationException - when query has errors.
      • executeQuery

        public InstrumentMessageSource executeQuery​(java.lang.String qql,
                                                    SelectionOptions options,
                                                    TickStream[] streams,
                                                    deltix.qsrv.hf.pub.InstrumentIdentity[] ids,
                                                    long startTimestamp,
                                                    long endTimestamp,
                                                    Parameter... params)
                                             throws deltix.util.parsers.CompilationException
        Description copied from interface: DXTickDB

        Execute Query and creates a message source for reading data from it, according to the specified options. The messages are returned from the cursor strictly ordered by time. Within the same exact time stamp, the order of messages is undefined and may vary from call to call, i.e. it is non-deterministic.

        select * from bars
        Specified by:
        executeQuery in interface DXTickDB
        Parameters:
        qql - Query text.
        options - Selection options.
        streams - Streams from which data will be selected.
        ids - Specified entities to be subscribed. If null, then all entities will be subscribed.
        startTimestamp - The start timestamp.
        endTimestamp - The end timestamp
        params - The parameter values of the query.
        Returns:
        An iterable message source to read messages.
        Throws:
        deltix.util.parsers.CompilationException - when query has errors.
      • executeQuery

        public InstrumentMessageSource executeQuery​(java.lang.String qql,
                                                    Parameter... params)
                                             throws deltix.util.parsers.CompilationException
        Description copied from interface: DXTickDB

        Execute Query and creates a message source for reading data from it, according to the specified options. The messages are returned from the cursor strictly ordered by time. Within the same exact time stamp, the order of messages is undefined and may vary from call to call, i.e. it is non-deterministic.

        select * from bars
        Specified by:
        executeQuery in interface DXTickDB
        Parameters:
        qql - Query text.
        params - The parameter values of the query.
        Returns:
        An iterable message source to read messages.
        Throws:
        deltix.util.parsers.CompilationException
      • executeQuery

        public InstrumentMessageSource executeQuery​(java.lang.String qql,
                                                    SelectionOptions options,
                                                    Parameter... params)
                                             throws deltix.util.parsers.CompilationException
        Description copied from interface: DXTickDB

        Execute Query and creates a message source for reading data from it, according to the specified options. The messages are returned from the cursor strictly ordered by time. Within the same exact time stamp, the order of messages is undefined and may vary from call to call, i.e. it is non-deterministic.

        select * from bars
        Specified by:
        executeQuery in interface DXTickDB
        Parameters:
        qql - Query text.
        options - Selection options.
        params - The parameter values of the query.
        Returns:
        An iterable message source to read messages.
        Throws:
        deltix.util.parsers.CompilationException - when query has errors
      • executeQuery

        public InstrumentMessageSource executeQuery​(java.lang.String qql,
                                                    SelectionOptions options,
                                                    deltix.qsrv.hf.pub.InstrumentIdentity[] ids,
                                                    Parameter... params)
                                             throws deltix.util.parsers.CompilationException
        Description copied from interface: DXTickDB

        Execute Query and creates a message source for reading data from it, according to the specified options. The messages are returned from the cursor strictly ordered by time. Within the same exact time stamp, the order of messages is undefined and may vary from call to call, i.e. it is non-deterministic.

        select * from bars
        Specified by:
        executeQuery in interface DXTickDB
        Parameters:
        qql - Query text.
        options - Selection options.
        ids - Specified entities to be subscribed. If null, then all entities will be subscribed.
        params - The parameter values of the query.
        Returns:
        An iterable message source to read messages.
        Throws:
        deltix.util.parsers.CompilationException
      • createStream

        public DXTickStream createStream​(java.lang.String key,
                                         StreamOptions options)
        Description copied from interface: DXTickDB
        Creates a new stream within the database.
        Specified by:
        createStream in interface DXTickDB
        Parameters:
        key - A required key later used to identify the stream.
        options - Options for creating the stream.
      • createFileStream

        public DXTickStream createFileStream​(java.lang.String key,
                                             java.lang.String dataFile)
        Description copied from interface: DXTickDB
        Creates a new stream mount to the given data file.
        Specified by:
        createFileStream in interface DXTickDB
        Parameters:
        key - A required key later used to identify the stream.
        dataFile - Path to the data file (on server side).
        Returns:
        A new instance of DXTickStream.
      • coolDown

        public void coolDown()
        Description copied from interface: DXTickDB
        Removes all memory indexes. The indexes will be rebuilt on demand.
        Specified by:
        coolDown in interface DXTickDB
      • isTopicDBSupported

        public boolean isTopicDBSupported()
        Specified by:
        isTopicDBSupported in interface DXTickDB
        Returns:
        true if this DB instance supports topics. If this methods returns false then DXTickDB.getTopicDB() is unavailable.