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

tech.ytsaurus.client.CompoundClient Maven / Gradle / Ivy

The newest version!
package tech.ytsaurus.client;

import java.io.Closeable;
import java.time.Duration;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.function.Function;

import javax.annotation.Nullable;

import tech.ytsaurus.client.request.MountTable;
import tech.ytsaurus.client.request.UnmountTable;
import tech.ytsaurus.core.GUID;

public interface CompoundClient extends ApiServiceClient, Closeable {
    /**
     * Retry specified action inside tablet transaction.
     * 

* This method creates tablet transaction, runs specified action and then commits transaction. * If error happens retryPolicy is invoked to determine if there is a need for retry and if there is such * need process repeats. *

* Retries are performed until retry policy says to stop or action is successfully executed * * @param action action to be retried; it should not call commit; action might be called multiple times. * @param executor executor that will run user action * @param retryPolicy retry policy that determines which error should be retried * @return future that contains: *

    *
  • result of action if it was executed successfully
  • *
  • most recent error if all retries have failed
  • *
*/ CompletableFuture retryWithTabletTransaction( Function> action, ExecutorService executor, RetryPolicy retryPolicy ); /** * Mount table and wait until all tablets become mounted. * * @see ApiServiceClient#mountTable(MountTable) * @see MountTable */ CompletableFuture mountTableAndWaitTablets(MountTable req); default CompletableFuture mountTableAndWaitTablets(MountTable.BuilderBase req) { return mountTableAndWaitTablets(req.build()); } /** * @param requestTimeout applies only to request itself and does NOT apply to waiting for tablets to be mounted */ CompletableFuture mountTable( String path, GUID cellId, boolean freeze, boolean waitMounted, @Nullable Duration requestTimeout ); default CompletableFuture mountTable(String path, GUID cellId, boolean freeze, boolean waitMounted) { return mountTable(path, cellId, freeze, waitMounted, null); } default CompletableFuture mountTable(String path, GUID cellId, boolean freeze) { return mountTable(path, cellId, freeze, null); } default CompletableFuture mountTable( String path, GUID cellId, boolean freeze, @Nullable Duration requestTimeout ) { return mountTable(path, cellId, freeze, false, requestTimeout); } default CompletableFuture mountTable(String path) { return mountTable(path, null); } default CompletableFuture mountTable(String path, @Nullable Duration requestTimeout) { return mountTable(path, null, false, requestTimeout); } default CompletableFuture mountTable(String path, boolean freeze) { return mountTable(path, freeze, null); } default CompletableFuture mountTable(String path, boolean freeze, @Nullable Duration requestTimeout) { return mountTable(path, null, freeze, requestTimeout); } /** * Unmount table and wait until all tablets become unmounted. * * @see ApiServiceClient#unmountTable(UnmountTable) * @see UnmountTable */ CompletableFuture unmountTableAndWaitTablets(UnmountTable req); default CompletableFuture unmountTableAndWaitTablets(UnmountTable.BuilderBase req) { return unmountTableAndWaitTablets(req.build()); } /** * Unmount table and wait until all tablets become unmounted. * * @see UnmountTable * @see ApiServiceClient#unmountTable(UnmountTable) */ default CompletableFuture unmountTableAndWaitTablets(String path) { return unmountTableAndWaitTablets(UnmountTable.builder().setPath(path).build()); } /** * Unmount table. *

* This method doesn't wait until tablets become unmounted. * * @see ApiServiceClient#unmountTable(UnmountTable) * @see UnmountTable * @see #unmountTableAndWaitTablets(UnmountTable) * @see #unmountTableAndWaitTablets(String) */ default CompletableFuture unmountTable(String path) { return unmountTable(UnmountTable.builder().setPath(path).build()); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy