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

org.infinispan.api.mutiny.MutinyQuery Maven / Gradle / Ivy

package org.infinispan.api.mutiny;

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;

import io.smallrye.mutiny.Multi;
import io.smallrye.mutiny.Uni;

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

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

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

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

   /**
    * Executes the query and returns a {@link Multi} with the results
    *
    * @return a {@link Multi} which produces {@link CacheContinuousQueryEvent} items.
    */
    Multi> findContinuously();

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

   /**
    * Processes entries matched by the query using a {@link MutinyCacheEntryProcessor}. The query MUST NOT
    * use projections. If the cache is remote, entries will be retrieved, manipulated locally and put back. The query
    * MUST NOT use projections.
    *
    * @param processor the entry consumer task
    */
   default  Multi> process(MutinyCacheEntryProcessor processor) {
      return process(processor, CacheProcessorOptions.DEFAULT);
   }

   /**
    * Processes entries matched by the query using a {@link MutinyCacheEntryProcessor}. The query MUST NOT
    * use projections. If the cache is remote, entries will be retrieved, manipulated locally and put back. The query
    * MUST NOT use projections.
    *
    * @param processor the entry consumer task
    */
    Multi> process(MutinyCacheEntryProcessor 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  Multi> 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
    */
    Multi> process(CacheProcessor processor, CacheProcessorOptions options);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy