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

com.yandex.ydb.core.rpc.OperationTray Maven / Gradle / Ivy

There is a newer version: 1.45.6
Show newest version
package com.yandex.ydb.core.rpc;

import java.util.concurrent.CompletableFuture;
import java.util.function.Function;

import com.google.protobuf.Message;
import com.yandex.ydb.OperationProtos.Operation;
import com.yandex.ydb.core.Result;
import com.yandex.ydb.core.Status;


/**
 *
 * @author Sergey Polovko
 */
public interface OperationTray extends AutoCloseable {

    /**
     * Awaits operation completion and retrieves its status.
     *
     * @param operation     operation to await for
     * @param deadlineAfter point in time when request must expire
     * @return future which will be completed with operation status
     */
    CompletableFuture waitStatus(Operation operation, long deadlineAfter);

    /**
     * Awaits operation completion and retrieves its result.
     *
     * @param operation     operation to await for
     * @param resultClass   class of operation result message
     * @param mapper        function to map result message to appropriate result*
     * @param deadlineAfter point in time when request must expire
     * @return future which will be completed with operation result
     */
     CompletableFuture> waitResult(
        Operation operation,
        Class resultClass,
        Function mapper,
        long deadlineAfter);

    /**
     * Stops active tasks and release resources.
     */
    @Override
    void close();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy