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

org.infinispan.api.async.AsyncQuery Maven / Gradle / Ivy

The newest version!
package org.infinispan.api.async;

import java.util.concurrent.CompletionStage;
import java.util.concurrent.Flow;

import org.infinispan.api.common.events.cache.CacheContinuousQueryEvent;
import org.infinispan.api.common.process.CacheEntryProcessorResult;
import org.infinispan.api.common.process.CacheProcessor;
import org.infinispan.api.common.process.CacheProcessorOptions;

/**
 * Parameterized Query builder
 *
 * @param 
 * @param 
 * @param  the result type for the query
 * @since 14.0
 */
public interface AsyncQuery {
   /**
    * Sets the named parameter to the specified value
    *
    * @param name
    * @param value
    * @return
    */
   AsyncQuery param(String name, Object value);

   /**
    * Skips the first specified number of results
    *
    * @param skip
    * @return
    */
   AsyncQuery skip(long skip);

   /**
    * Limits the number of results
    *
    * @param limit
    * @return
    */
   AsyncQuery limit(int limit);

   /**
    * Executes the query
    */
   CompletionStage> find();

   /**
    * Executes the query and returns a {@link java.util.concurrent.Flow.Publisher} with the results
    *
    * @param query query String
    * @return a {@link Flow.Publisher} which produces {@link CacheContinuousQueryEvent} items.
    */
   Flow.Publisher> findContinuously(String query);

   /**
    * Executes the manipulation statement (UPDATE, REMOVE)
    *
    * @return the number of entries that were processed
    */
   CompletionStage execute();

   /**
    * @param 
    * @param processor the entry processor task
    * @return
    */
   default  Flow.Publisher> process(AsyncCacheEntryProcessor processor) {
      return process(processor, CacheProcessorOptions.DEFAULT);
   }

   /**
    * @param 
    * @param processor the entry processor task
    * @param options
    * @return
    */
    Flow.Publisher> process(AsyncCacheEntryProcessor processor, CacheProcessorOptions options);

   /**
    * Processes entries matched by the query using a named {@link CacheProcessor}. The query MUST NOT use
    * projections. If the cache processor returns a non-null value for an entry, it will be returned through the
    * publisher.
    *
    * @param 
    * @param processor the entry processor
    * @return
    */
   default  Flow.Publisher> process(CacheProcessor processor) {
      return process(processor, CacheProcessorOptions.DEFAULT);
   }

   /**
    * Processes entries matched by the query using a named {@link CacheProcessor}. The query MUST NOT use
    * projections. If the cache processor returns a non-null value for an entry, it will be returned through the
    * publisher.
    *
    * @param 
    * @param processor the named entry processor
    * @param options
    * @return
    */
    Flow.Publisher> process(CacheProcessor processor, CacheProcessorOptions options);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy