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

tech.ytsaurus.client.sync.SyncYTsaurusClient Maven / Gradle / Ivy

The newest version!
package tech.ytsaurus.client.sync;

import java.util.List;

import tech.ytsaurus.client.YTsaurusClient;
import tech.ytsaurus.client.YTsaurusCluster;
import tech.ytsaurus.lang.NonNullApi;
import tech.ytsaurus.lang.NonNullFields;

/**
 * Synchronous YTsaurus client.
 */
public class SyncYTsaurusClient
        extends SyncCompoundClientImpl {
    private final YTsaurusClient client;

    protected SyncYTsaurusClient(YTsaurusClient client) {
        super(client);
        this.client = client;
    }

    /**
     * Create client with default settings.
     */
    public static SyncYTsaurusClient of(String cluster) {
        return builder()
                .setCluster(cluster)
                .build();
    }

    public static SyncYTsaurusClient wrap(YTsaurusClient client) {
        return new SyncYTsaurusClient(client);
    }

    public List getClusters() {
        return client.getClusters();
    }

    /**
     * Create builder for SyncYTsaurusClient.
     */
    public static YTsaurusClient.ClientBuilder builder() {
        return new Builder();
    }

    @Override
    public void close() {
        client.close();
    }

    @NonNullApi
    @NonNullFields
    public static class Builder extends YTsaurusClient.ClientBuilder {
        @Override
        protected Builder self() {
            return this;
        }

        @Override
        public SyncYTsaurusClient build() {
            return new SyncYTsaurusClient(
                    this.copyTo(YTsaurusClient.builder())
                            .build()
            );
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy