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

tech.ydb.export.ExportClient Maven / Gradle / Ivy

There is a newer version: 2.3.0
Show newest version
package tech.ydb.export;

import java.util.concurrent.CompletableFuture;

import javax.annotation.WillNotClose;

import tech.ydb.core.Result;
import tech.ydb.core.grpc.GrpcTransport;
import tech.ydb.core.operation.Operation;
import tech.ydb.core.operation.OperationTray;
import tech.ydb.export.impl.ExportClientImpl;
import tech.ydb.export.impl.GrpcExportRpcImpl;
import tech.ydb.export.result.ExportToS3Result;
import tech.ydb.export.result.ExportToYtResult;
import tech.ydb.export.settings.ExportToS3Settings;
import tech.ydb.export.settings.ExportToYtSettings;
import tech.ydb.export.settings.FindExportSettings;

/**
 * @author Kirill Kurdyukov
 */
public interface ExportClient {

    static ExportClient newClient(@WillNotClose GrpcTransport transport) {
        return new ExportClientImpl(GrpcExportRpcImpl.useTransport(transport));
    }

    CompletableFuture>> findExportToS3(
            String operationId, FindExportSettings settings
    );

    CompletableFuture>> findExportToYT(
            String operationId, FindExportSettings settings
    );

    CompletableFuture>> startExportToS3(
            String endpoint, String bucket, String accessKey, String secretKey, ExportToS3Settings settings
    );

    CompletableFuture>> startExportToYt(
            String host, String token, ExportToYtSettings settings
    );

    default CompletableFuture> exportToS3(
            String endpoint, String bucket, String accessKey, String secretKey, ExportToS3Settings settings,
            int updateRateSeconds
    ) {
        return startExportToS3(endpoint, bucket, accessKey, secretKey, settings)
                .thenCompose(operation -> OperationTray.fetchOperation(operation, updateRateSeconds));
    }

    default CompletableFuture> exportToYt(
            String host, String token, ExportToYtSettings settings, int updateRateSeconds
    ) {
        return startExportToYt(host, token, settings)
                .thenCompose(operation -> OperationTray.fetchOperation(operation, updateRateSeconds));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy