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

com.yandex.ydb.core.grpc.BalancingSettings Maven / Gradle / Ivy

There is a newer version: 1.45.6
Show newest version
package com.yandex.ydb.core.grpc;

/**
 * @author Nikolay Perfilov
 */
public class BalancingSettings {
    public final static BalancingPolicy DEFAULT_BALANCING_POLICY = BalancingPolicy.USE_ALL_NODES;

    public final BalancingPolicy policy;
    public final String preferableLocation;

    public BalancingSettings(BalancingPolicy policy, String preferableLocation) {
        this.policy = policy;
        this.preferableLocation = preferableLocation;
    }

    public BalancingSettings() {
        this.policy = DEFAULT_BALANCING_POLICY;
        this.preferableLocation = null;
    }

    public static BalancingSettings fromPolicy(BalancingPolicy balancingPolicy) {
        return new BalancingSettings(balancingPolicy, null);
    }

    public static BalancingSettings fromLocation(String preferableLocation) {
        return new BalancingSettings(BalancingPolicy.USE_PREFERABLE_LOCATION, preferableLocation);
    }

    @Override
    public String toString() {
        return "BalancingSettings{" +
                "policy=" + policy +
                ", preferableLocation='" + preferableLocation + '\'' +
                '}';
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy