forked from milvus-io/milvus-sdk-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement getReplicas() interface (milvus-io#289)
Signed-off-by: groot <[email protected]>
- Loading branch information
Showing
6 changed files
with
155 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
src/main/java/io/milvus/param/control/GetReplicasParam.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package io.milvus.param.control; | ||
|
||
import io.milvus.exception.ParamException; | ||
import io.milvus.param.ParamUtils; | ||
import lombok.Getter; | ||
import lombok.NonNull; | ||
|
||
/** | ||
* Parameters for <code>getReplicas</code> interface. | ||
*/ | ||
@Getter | ||
public class GetReplicasParam { | ||
private final String collectionName; | ||
private boolean withShardNodes; | ||
|
||
private GetReplicasParam(@NonNull Builder builder) { | ||
this.collectionName = builder.collectionName; | ||
this.withShardNodes = true; | ||
} | ||
|
||
public static Builder newBuilder() { | ||
return new Builder(); | ||
} | ||
|
||
/** | ||
* Builder for {@link GetReplicasParam} class. | ||
*/ | ||
public static final class Builder { | ||
private String collectionName; | ||
|
||
private Builder() { | ||
} | ||
|
||
/** | ||
* Sets the collection name. Collection name cannot be empty or null. | ||
* | ||
* @param collectionName collection name | ||
* @return <code>Builder</code> | ||
*/ | ||
public Builder withCollectionName(@NonNull String collectionName) { | ||
this.collectionName = collectionName; | ||
return this; | ||
} | ||
|
||
/** | ||
* Verifies parameters and creates a new {@link GetReplicasParam} instance. | ||
* | ||
* @return {@link GetReplicasParam} | ||
*/ | ||
public GetReplicasParam build() throws ParamException { | ||
ParamUtils.CheckNullEmptyString(collectionName, "Collection name"); | ||
|
||
return new GetReplicasParam(this); | ||
} | ||
} | ||
|
||
/** | ||
* Constructs a <code>String</code> by {@link GetReplicasParam} instance. | ||
* | ||
* @return <code>String</code> | ||
*/ | ||
@Override | ||
public String toString() { | ||
return "GetReplicasParam{" + | ||
"collectionName='" + collectionName + '\'' + | ||
'}'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters