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

org.redisson.api.RFunctionAsync Maven / Gradle / Ivy

There is a newer version: 3.36.0
Show newest version
/**
 * Copyright (c) 2013-2021 Nikita Koksharov
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.redisson.api;

import java.util.List;

/**
 * Interface for Redis Function feature
 *
 * @author Nikita Koksharov
 *
 */
public interface RFunctionAsync {

    /**
     * Deletes library. Error is thrown if library doesn't exist.
     *
     * @param libraryName library name
     */
    RFuture deleteAsync(String libraryName);

    /**
     * Returns serialized state of all libraries.
     *
     * @return serialized state
     */
    RFuture dumpAsync();

    /**
     * Deletes all libraries.
     *
     */
    RFuture flushAsync();

    /**
     * Kills currently executed functions.
     * Applied only to functions which don't modify data.
     *
     */
    RFuture killAsync();

    /**
     * Returns information about libraries and functions per each.
     *
     * @return list of libraries
     */
    RFuture> listAsync();

    /**
     * Returns information about libraries and functions per each by name pattern.
     * 

* Supported glob-style patterns: * h?llo matches hello, hallo and hxllo * h*llo matches hllo and heeeello * h[ae]llo matches hello and hallo, but not hillo * * @param namePattern name pattern * @return list of libraries */ RFuture> listAsync(String namePattern); /** * Loads a library. Error is thrown if library already exists. * * @param libraryName library name * @param code function code */ RFuture loadAsync(String libraryName, String code); /** * Loads a library and overwrites existing library. * * @param libraryName library name * @param code function code */ RFuture loadAndReplaceAsync(String libraryName, String code); /** * Restores libraries using their state returned by {@link #dumpAsync()} method. * Restored libraries are appended to the existing libraries and throws error in case of collision. * * @param payload serialized state */ RFuture restoreAsync(byte[] payload); /** * Restores libraries using their state returned by {@link #dumpAsync()} method. * Restored libraries are appended to the existing libraries. * * @param payload serialized state */ RFuture restoreAndReplaceAsync(byte[] payload); /** * Restores libraries using their state returned by {@link #dumpAsync()} method. * Deletes all existing libraries before restoring. * * @param payload serialized state */ RFuture restoreAfterFlushAsync(byte[] payload); /** * Returns information about currently running * Redis function and available execution engines. * * @return function information */ RFuture statsAsync(); /** * Executes function * * @param - type of result * @param key - used to locate Redis node in Cluster which stores cached Lua script * @param mode - execution mode * @param name - function name * @param returnType - return type * @param keys - keys available through KEYS param in script * @param values - values available through VALUES param in script * @return result object */ RFuture callAsync(String key, FunctionMode mode, String name, FunctionResult returnType, List keys, Object... values); /** * Executes function * * @param - type of result * @param mode - execution mode * @param name - function name * @param returnType - return type * @param keys - keys available through KEYS param in script * @param values - values available through VALUES param in script * @return result object */ RFuture callAsync(FunctionMode mode, String name, FunctionResult returnType, List keys, Object... values); /** * Executes function * * @param - type of result * @param mode - execution mode * @param name - function name * @param returnType - return type * @return result object */ RFuture callAsync(FunctionMode mode, String name, FunctionResult returnType); }