All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.infinispan.persistence.jdbc.common.TableOperations Maven / Gradle / Ivy

There is a newer version: 14.0.33.Final
Show newest version
package org.infinispan.persistence.jdbc.common;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.function.Supplier;

import org.infinispan.commons.util.IntSet;
import org.infinispan.persistence.spi.MarshallableEntry;
import org.infinispan.persistence.spi.NonBlockingStore;
import org.reactivestreams.Publisher;

import io.reactivex.rxjava3.core.Flowable;

/**
 * @author William Burns
 */
public interface TableOperations {
   MarshallableEntry loadEntry(Connection connection, int segment, Object key) throws SQLException;

   default Flowable publishKeys(Supplier connectionSupplier, Consumer connectionCloser,
         IntSet segments, Predicate filter) {
      return publishEntries(connectionSupplier, connectionCloser, segments, filter, false)
            .map(MarshallableEntry::getKey);
   }

   Flowable> publishEntries(Supplier connectionSupplier,
         Consumer connectionCloser, IntSet segments, Predicate filter, boolean fetchValue);

   boolean deleteEntry(Connection connection, int segment, Object key) throws SQLException;

   void deleteAllRows(Connection connection) throws SQLException;

   void upsertEntry(Connection connection, int segment, MarshallableEntry entry) throws SQLException;

   long size(Connection connection) throws SQLException;

   void batchUpdates(Connection connection, int writePublisherCount, Publisher removePublisher,
         Publisher>> writePublisher) throws SQLException;
}