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

tech.ytsaurus.client.request.CheckClusterLiveness Maven / Gradle / Ivy

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

import tech.ytsaurus.client.rpc.RpcClientRequestBuilder;
import tech.ytsaurus.rpcproxy.TReqCheckClusterLiveness;

public class CheckClusterLiveness extends RequestBase
        implements HighLevelRequest {
    private final boolean checkCypressRoot;
    private final boolean checkSecondaryMasterCells;

    CheckClusterLiveness(Builder builder) {
        super(builder);
        this.checkCypressRoot = builder.checkCypressRoot;
        this.checkSecondaryMasterCells = builder.checkSecondaryMasterCells;
    }

    public CheckClusterLiveness() {
        this(builder());
    }

    public static Builder builder() {
        return new Builder();
    }

    /**
     * Internal method: prepare request to send over network.
     */
    @Override
    public void writeTo(RpcClientRequestBuilder builder) {
        builder.body().setCheckCypressRoot(checkCypressRoot);
        builder.body().setCheckSecondaryMasterCells(checkSecondaryMasterCells);
    }

    @Override
    public Builder toBuilder() {
        return builder()
                .setCheckCypressRoot(checkCypressRoot)
                .setCheckSecondaryMasterCells(checkSecondaryMasterCells)
                .setTimeout(timeout)
                .setRequestId(requestId)
                .setUserAgent(userAgent)
                .setTraceId(traceId, traceSampled)
                .setAdditionalData(additionalData);
    }

    public static class Builder extends RequestBase.Builder {
        private boolean checkCypressRoot = false;
        private boolean checkSecondaryMasterCells = false;

        Builder() {
        }

        Builder(Builder builder) {
            super(builder);
            checkCypressRoot = builder.checkCypressRoot;
            checkSecondaryMasterCells = builder.checkSecondaryMasterCells;
        }

        /*
         * Checks cypress root availability.
         */
        public Builder setCheckCypressRoot(boolean checkCypressRoot) {
            this.checkCypressRoot = checkCypressRoot;
            return self();
        }

        /*
         * Checks secondary master cells generic availability.
         */
        public Builder setCheckSecondaryMasterCells(boolean checkSecondaryMasterCells) {
            this.checkSecondaryMasterCells = checkSecondaryMasterCells;
            return self();
        }

        public CheckClusterLiveness build() {
            return new CheckClusterLiveness(this);
        }

        @Override
        protected Builder self() {
            return this;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy