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

tech.ydb.jdbc.settings.YdbOperationProperties Maven / Gradle / Ivy

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

import java.time.Duration;
import java.util.Map;
import java.util.Objects;

public class YdbOperationProperties {
    public static final int MAX_ROWS = 1000; // TODO: how to figure out the max rows of current connection?

    private final Map, ParsedProperty> params;
    private final Duration joinDuration;
    private final Duration queryTimeout;
    private final Duration scanQueryTimeout;
    private final boolean failOnTruncatedResult;
    private final Duration sessionTimeout;
    private final Duration deadlineTimeout;
    private final boolean autoCommit;
    private final int transactionLevel;
    private final int maxRows;
    private final boolean cacheConnectionsInDriver;

    private final int jdbcSupportLevel;

    public YdbOperationProperties(Map, ParsedProperty> params) {
        this.params = Objects.requireNonNull(params);

        this.joinDuration = params.get(YdbOperationProperty.JOIN_DURATION).getParsedValue();
        this.queryTimeout = params.get(YdbOperationProperty.QUERY_TIMEOUT).getParsedValue();
        this.scanQueryTimeout = params.get(YdbOperationProperty.SCAN_QUERY_TIMEOUT).getParsedValue();
        this.failOnTruncatedResult = params.get(YdbOperationProperty.FAIL_ON_TRUNCATED_RESULT).getParsedValue();
        this.sessionTimeout = params.get(YdbOperationProperty.SESSION_TIMEOUT).getParsedValue();
        this.deadlineTimeout = params.get(YdbOperationProperty.DEADLINE_TIMEOUT).getParsedValue();
        this.autoCommit = params.get(YdbOperationProperty.AUTOCOMMIT).getParsedValue();
        this.transactionLevel = params.get(YdbOperationProperty.TRANSACTION_LEVEL).getParsedValue();
        this.maxRows = MAX_ROWS;
        this.cacheConnectionsInDriver = params.get(YdbOperationProperty.CACHE_CONNECTIONS_IN_DRIVER).getParsedValue();

        this.jdbcSupportLevel = params.get(YdbOperationProperty.JDBC_SUPPORT_LEVEL).getParsedValue();
    }

    public Map, ParsedProperty> getParams() {
        return params;
    }

    public Duration getJoinDuration() {
        return joinDuration;
    }

    public Duration getQueryTimeout() {
        return queryTimeout;
    }

    public Duration getScanQueryTimeout() {
        return scanQueryTimeout;
    }

    public boolean isFailOnTruncatedResult() {
        return failOnTruncatedResult;
    }

    public Duration getSessionTimeout() {
        return sessionTimeout;
    }

    public Duration getDeadlineTimeout() {
        return deadlineTimeout;
    }

    public boolean isAutoCommit() {
        return autoCommit;
    }

    public int getTransactionLevel() {
        return transactionLevel;
    }

    public int getMaxRows() {
        return maxRows;
    }

    public boolean isCacheConnectionsInDriver() {
        return cacheConnectionsInDriver;
    }

    public int getJdbcSupportLevel() {
        return jdbcSupportLevel;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy