Interface CqlFactory

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static interface  CqlFactory.KvIterable<T>
      Interface for iteration over returned results returning KeyValues.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      com.datastax.driver.core.BoundStatement getFetchTokenStatement​(java.lang.String key, com.datastax.driver.core.Session session)
      Retrieve a bound statement to fetch a token for given entity.
      <T> CqlFactory.KvIterable<T> getListAllStatement​(java.lang.String key, Offsets.Raw offset, int limit, com.datastax.driver.core.Session session)
      Retrieve wrapped statement to execute to list all attributes of given key.
      com.datastax.driver.core.BoundStatement getListEntitiesStatement​(Offsets.Token offset, int limit, com.datastax.driver.core.Session session)
      Get statement for listing entities.
      com.datastax.driver.core.BoundStatement getListStatement​(java.lang.String key, AttributeDescriptor<?> wildcard, Offsets.Raw offset, int limit, com.datastax.driver.core.Session session)
      Retrieve a CQL query to execute in order to list wildcard attributes.
      com.datastax.driver.core.BoundStatement getReadStatement​(java.lang.String key, java.lang.String attribute, AttributeDescriptor<?> desc, com.datastax.driver.core.Session session)
      Retrieve a CQL query to execute in order to read data.
      java.util.Optional<com.datastax.driver.core.BoundStatement> getWriteStatement​(StreamElement element, com.datastax.driver.core.Session session)
      Retrieve a CQL query to execute in order to ingest the request.
      com.datastax.driver.core.Statement scanPartition​(java.util.List<AttributeDescriptor<?>> attributes, CassandraPartition partition, com.datastax.driver.core.Session session)
      Retrieve a bound statement to scan data for given attribute and partition.
      void setup​(EntityDescriptor entity, java.net.URI uri, StringConverter<?> converter)
      Setup the factory from URI and given string converter.
      <T> KeyValue<T> toKeyValue​(EntityDescriptor entityDescriptor, AttributeDescriptor<T> attributeDescriptor, java.lang.String key, java.lang.String attribute, long stamp, RandomOffset offset, byte[] serializedValue)
      Convert the byte[] stored in the database into KeyValue.
    • Method Detail

      • setup

        void setup​(EntityDescriptor entity,
                   java.net.URI uri,
                   StringConverter<?> converter)
        Setup the factory from URI and given string converter.
        Parameters:
        entity - descriptor of entity
        uri - URI of the source
        converter - payload to string converter
      • getWriteStatement

        java.util.Optional<com.datastax.driver.core.BoundStatement> getWriteStatement​(StreamElement element,
                                                                                      com.datastax.driver.core.Session session)
        Retrieve a CQL query to execute in order to ingest the request.
        Parameters:
        element - input data
        session - current session
        Returns:
        the statement to execute. When empty, the ingest is silently discarded.
      • getReadStatement

        com.datastax.driver.core.BoundStatement getReadStatement​(java.lang.String key,
                                                                 java.lang.String attribute,
                                                                 AttributeDescriptor<?> desc,
                                                                 com.datastax.driver.core.Session session)
        Retrieve a CQL query to execute in order to read data.
        Parameters:
        key - the primary key whose attribute to return
        attribute - the attribute to fetch
        desc - descriptor of the attribute
        session - the connection session
        Returns:
        the statement to execute
      • getListAllStatement

        <T> CqlFactory.KvIterable<T> getListAllStatement​(java.lang.String key,
                                                         @Nullable
                                                         Offsets.Raw offset,
                                                         int limit,
                                                         com.datastax.driver.core.Session session)
        Retrieve wrapped statement to execute to list all attributes of given key.
        Type Parameters:
        T - type of CqlFactory.KvIterable
        Parameters:
        key - key to list attributes of
        offset - offset to start from (return next attribute)
        limit - maximum number of items to return
        session - the connection session
        Returns:
        iterable over keyvalues
      • getListStatement

        com.datastax.driver.core.BoundStatement getListStatement​(java.lang.String key,
                                                                 AttributeDescriptor<?> wildcard,
                                                                 @Nullable
                                                                 Offsets.Raw offset,
                                                                 int limit,
                                                                 com.datastax.driver.core.Session session)
        Retrieve a CQL query to execute in order to list wildcard attributes. The prefix is name of wildcard attribute shortened by two last characters (.*).
        Parameters:
        key - the primary key value (first part of the composite key)
        wildcard - the wildcard attribute to list
        offset - the offset to start from this might be null (start from beginning)
        limit - maximal number of elements to list (-1 for all)
        session - the connection session
        Returns:
        the statement to execute
      • getListEntitiesStatement

        com.datastax.driver.core.BoundStatement getListEntitiesStatement​(@Nullable
                                                                         Offsets.Token offset,
                                                                         int limit,
                                                                         com.datastax.driver.core.Session session)
        Get statement for listing entities.
        Parameters:
        offset - offset of the query
        limit - maximal number of elements to list (-1 for all)
        session - connection session
        Returns:
        the statement to execute
      • getFetchTokenStatement

        com.datastax.driver.core.BoundStatement getFetchTokenStatement​(java.lang.String key,
                                                                       com.datastax.driver.core.Session session)
        Retrieve a bound statement to fetch a token for given entity.
        Parameters:
        key - key to fetch token for
        session - connection session
        Returns:
        the statement to execute
      • scanPartition

        com.datastax.driver.core.Statement scanPartition​(java.util.List<AttributeDescriptor<?>> attributes,
                                                         CassandraPartition partition,
                                                         com.datastax.driver.core.Session session)
        Retrieve a bound statement to scan data for given attribute and partition.
        Parameters:
        attributes - list of attributes to scan
        partition - the partition to scan
        session - connection session
        Returns:
        the statement to execute