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

io.milvus.param.control.GetFlushStateParam Maven / Gradle / Ivy

Go to download

Java SDK for Milvus, a distributed high-performance vector search engine. update grpc to 1.42.1 update protobuf to 3.19.1

There is a newer version: 2.2.2.1
Show newest version
package io.milvus.param.control;

import io.milvus.exception.ParamException;
import lombok.Getter;
import lombok.NonNull;

import java.util.ArrayList;
import java.util.List;

/**
 * Parameters for getMetric interface.
 */
@Getter
public class GetFlushStateParam {
    private final List segmentIDs;

    private GetFlushStateParam(@NonNull Builder builder) {
        this.segmentIDs = builder.segmentIDs;
    }

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

    /**
     * Builder for {@link GetFlushStateParam} class.
     */
    public static final class Builder {
        private final List segmentIDs = new ArrayList<>();

        private Builder() {
        }

        /**
         * Specify segments
         *
         * @param segmentIDs segments id list
         * @return Builder
         */
        public Builder withSegmentIDs(@NonNull List segmentIDs) {
            this.segmentIDs.addAll(segmentIDs);
            return this;
        }

        /**
         * Specify a segment
         *
         * @param segmentID segment id
         * @return Builder
         */
        public Builder addSegmentID(@NonNull Long segmentID) {
            this.segmentIDs.add(segmentID);
            return this;
        }

        /**
         * Verifies parameters and creates a new {@link GetFlushStateParam} instance.
         *
         * @return {@link GetFlushStateParam}
         */
        public GetFlushStateParam build() throws ParamException {
            if (segmentIDs.isEmpty()) {
                throw new ParamException("Segment id array cannot be empty");
            }

            return new GetFlushStateParam(this);
        }
    }

    /**
     * Constructs a String by {@link GetFlushStateParam} instance.
     *
     * @return String
     */
    @Override
    public String toString() {
        return "GetFlushStateParam{" +
                "segmentIDs=" + segmentIDs.toString() +
                '}';
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy