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

com.yandex.ydb.table.Session Maven / Gradle / Ivy

package com.yandex.ydb.table;

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

import com.yandex.ydb.core.Result;
import com.yandex.ydb.core.Status;
import com.yandex.ydb.table.description.TableDescription;
import com.yandex.ydb.table.query.DataQuery;
import com.yandex.ydb.table.query.DataQueryResult;
import com.yandex.ydb.table.query.ExplainDataQueryResult;
import com.yandex.ydb.table.query.Params;
import com.yandex.ydb.table.result.ResultSetReader;
import com.yandex.ydb.table.settings.AlterTableSettings;
import com.yandex.ydb.table.settings.BeginTxSettings;
import com.yandex.ydb.table.settings.BulkUpsertSettings;
import com.yandex.ydb.table.settings.CloseSessionSettings;
import com.yandex.ydb.table.settings.CommitTxSettings;
import com.yandex.ydb.table.settings.CopyTableSettings;
import com.yandex.ydb.table.settings.CreateTableSettings;
import com.yandex.ydb.table.settings.DescribeTableSettings;
import com.yandex.ydb.table.settings.DropTableSettings;
import com.yandex.ydb.table.settings.ExecuteDataQuerySettings;
import com.yandex.ydb.table.settings.ExecuteScanQuerySettings;
import com.yandex.ydb.table.settings.ExecuteSchemeQuerySettings;
import com.yandex.ydb.table.settings.ExplainDataQuerySettings;
import com.yandex.ydb.table.settings.KeepAliveSessionSettings;
import com.yandex.ydb.table.settings.PrepareDataQuerySettings;
import com.yandex.ydb.table.settings.ReadTableSettings;
import com.yandex.ydb.table.settings.RollbackTxSettings;
import com.yandex.ydb.table.transaction.Transaction;
import com.yandex.ydb.table.transaction.TransactionMode;
import com.yandex.ydb.table.transaction.TxControl;
import com.yandex.ydb.table.values.ListValue;


/**
 * @author Sergey Polovko
 */
public interface Session {

    String getId();

    CompletableFuture createTable(String path, TableDescription tableDescriptions, CreateTableSettings settings);

    default CompletableFuture createTable(String path, TableDescription tableDescriptions) {
        return createTable(path, tableDescriptions, new CreateTableSettings());
    }

    CompletableFuture dropTable(String path, DropTableSettings settings);

    default CompletableFuture dropTable(String path) {
        return dropTable(path, new DropTableSettings());
    }

    CompletableFuture alterTable(String path, AlterTableSettings settings);

    default CompletableFuture alterTable(String path) {
        return alterTable(path, new AlterTableSettings());
    }

    CompletableFuture copyTable(String src, String dst, CopyTableSettings settings);

    default CompletableFuture copyTable(String src, String dst) {
        return copyTable(src, dst, new CopyTableSettings());
    }

    CompletableFuture> describeTable(String path, DescribeTableSettings settings);

    default CompletableFuture> describeTable(String path) {
        return describeTable(path, new DescribeTableSettings());
    }

    CompletableFuture> executeDataQuery(
        String query,
        TxControl txControl,
        Params params,
        ExecuteDataQuerySettings settings);

    default CompletableFuture> executeDataQuery(String query, TxControl txControl, Params params) {
        return executeDataQuery(query, txControl, params, new ExecuteDataQuerySettings());
    }

    default CompletableFuture> executeDataQuery(String query, TxControl txControl) {
        return executeDataQuery(query, txControl, Params.empty(), new ExecuteDataQuerySettings());
    }

    CompletableFuture> prepareDataQuery(String query, PrepareDataQuerySettings settings);

    default CompletableFuture> prepareDataQuery(String query) {
        return prepareDataQuery(query, new PrepareDataQuerySettings());
    }

    CompletableFuture executeSchemeQuery(String query, ExecuteSchemeQuerySettings settings);

    default CompletableFuture executeSchemeQuery(String query) {
        return executeSchemeQuery(query, new ExecuteSchemeQuerySettings());
    }

    CompletableFuture> explainDataQuery(String query, ExplainDataQuerySettings settings);

    default CompletableFuture> explainDataQuery(String query) {
        return explainDataQuery(query, new ExplainDataQuerySettings());
    }

    CompletableFuture> beginTransaction(TransactionMode transactionMode, BeginTxSettings settings);

    default CompletableFuture> beginTransaction(TransactionMode transactionMode) {
        return beginTransaction(transactionMode, new BeginTxSettings());
    }

    CompletableFuture commitTransaction(String txId, CommitTxSettings settings);

    CompletableFuture rollbackTransaction(String txId, RollbackTxSettings settings);

    CompletableFuture readTable(String tablePath, ReadTableSettings settings, Consumer fn);

    CompletableFuture executeScanQuery(String query, Params params, ExecuteScanQuerySettings settings, Consumer fn);

    CompletableFuture> keepAlive(KeepAliveSessionSettings settings);

    CompletableFuture executeBulkUpsert(String tablePath, ListValue rows, BulkUpsertSettings settings);

    default CompletableFuture> keepAlive() {
        return keepAlive(new KeepAliveSessionSettings());
    }

    void invalidateQueryCache();

    boolean release();

    CompletableFuture close(CloseSessionSettings settings);

    default CompletableFuture close() {
        return close(new CloseSessionSettings());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy