Class ClusteredTable


public class ClusteredTable extends AbstractCassandraTable<ClusteredRecord>
Table representing persistence for LangChain operations
  • Constructor Details

    • ClusteredTable

      public ClusteredTable(@NonNull @NonNull com.datastax.oss.driver.api.core.CqlSession session, @NonNull @NonNull String keyspaceName, @NonNull @NonNull String tableName)
      Constructor with the mandatory parameters.
      Parameters:
      session - cassandra Session
      keyspaceName - keyspace name
      tableName - table name
  • Method Details

    • create

      public void create()
      Create table if not exist.
      Specified by:
      create in class AbstractCassandraTable<ClusteredRecord>
    • put

      public void put(@NonNull @NonNull ClusteredRecord row)
      Upsert a row of the table.
      Specified by:
      put in class AbstractCassandraTable<ClusteredRecord>
      Parameters:
      row - current row
    • mapRow

      public ClusteredRecord mapRow(@NonNull @NonNull com.datastax.oss.driver.api.core.cql.Row row)
      Should be table to map from a Cassandra row to a record.
      Specified by:
      mapRow in class AbstractCassandraTable<ClusteredRecord>
      Parameters:
      row - current cassandra row
      Returns:
      current record
    • findPartition

      public List<ClusteredRecord> findPartition(@NonNull @NonNull String partitionDd)
      Find a partition.
      Parameters:
      partitionDd - partition id
      Returns:
      list of rows
    • upsertPartition

      public void upsertPartition(List<ClusteredRecord> rows)
      Update the history in one go.
      Parameters:
      rows - current rows.
    • findById

      public Optional<ClusteredRecord> findById(String partition, UUID rowId)
      Find a row by its id.
      Parameters:
      partition - partition id
      rowId - row id
      Returns:
      record if exists
    • deletePartition

      public void deletePartition(@NonNull @NonNull String partitionId)
      Delete Partition.
      Parameters:
      partitionId - delete the whole partition
    • delete

      public void delete(@NonNull @NonNull String partitionId, @NonNull @NonNull UUID rowId)
      Delete one row.
      Parameters:
      partitionId - current session
      rowId - message id
    • insert

      public void insert(@NonNull @NonNull String partitionId, @NonNull @NonNull UUID rowId, @NonNull @NonNull String bodyBlob)
      Insert Row.
      Parameters:
      partitionId - partition id
      rowId - rowId
      bodyBlob - body