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

tech.ydb.jdbc.context.SchemeExecutor Maven / Gradle / Ivy

There is a newer version: 2.3.5
Show newest version
package tech.ydb.jdbc.context;


import java.util.concurrent.CompletableFuture;

import tech.ydb.core.Result;
import tech.ydb.scheme.SchemeClient;
import tech.ydb.scheme.description.ListDirectoryResult;
import tech.ydb.table.SessionRetryContext;
import tech.ydb.table.description.TableDescription;
import tech.ydb.table.settings.DescribeTableSettings;

/**
 *
 * @author Aleksandr Gorshenin
 */
public class SchemeExecutor {
    private final SchemeClient schemeClient;
    private final SessionRetryContext retryCtx;

    public SchemeExecutor(YdbContext ctx) {
        this.schemeClient = ctx.getSchemeClient();
        this.retryCtx = SessionRetryContext.create(ctx.getTableClient()).build();
    }

    public CompletableFuture> listDirectory(String path) {
        return schemeClient.listDirectory(path);
    }

    public CompletableFuture> describeTable(String tablePath, DescribeTableSettings settings) {
        return retryCtx.supplyResult(session -> session.describeTable(tablePath, settings));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy