|
@@ -19,6 +19,7 @@
|
|
|
|
|
|
package io.milvus.param.collection;
|
|
|
|
|
|
+import io.milvus.common.clientenum.ConsistencyLevelEnum;
|
|
|
import io.milvus.exception.ParamException;
|
|
|
import io.milvus.param.ParamUtils;
|
|
|
import lombok.Getter;
|
|
@@ -37,6 +38,7 @@ public class CreateCollectionParam {
|
|
|
private final String description;
|
|
|
private final List<FieldType> fieldTypes;
|
|
|
private final int partitionsNum;
|
|
|
+ private final ConsistencyLevelEnum consistencyLevel;
|
|
|
|
|
|
private CreateCollectionParam(@NonNull Builder builder) {
|
|
|
this.collectionName = builder.collectionName;
|
|
@@ -44,6 +46,7 @@ public class CreateCollectionParam {
|
|
|
this.description = builder.description;
|
|
|
this.fieldTypes = builder.fieldTypes;
|
|
|
this.partitionsNum = builder.partitionsNum;
|
|
|
+ this.consistencyLevel = builder.consistencyLevel;
|
|
|
}
|
|
|
|
|
|
public static Builder newBuilder() {
|
|
@@ -59,6 +62,7 @@ public class CreateCollectionParam {
|
|
|
private String description = "";
|
|
|
private final List<FieldType> fieldTypes = new ArrayList<>();
|
|
|
private int partitionsNum = 0;
|
|
|
+ private ConsistencyLevelEnum consistencyLevel = ConsistencyLevelEnum.BOUNDED;
|
|
|
|
|
|
private Builder() {
|
|
|
}
|
|
@@ -120,6 +124,18 @@ public class CreateCollectionParam {
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Sets the consistency level. The default value is {@link ConsistencyLevelEnum#BOUNDED}.
|
|
|
+ * @see ConsistencyLevelEnum
|
|
|
+ *
|
|
|
+ * @param consistencyLevel consistency level
|
|
|
+ * @return <code>Builder</code>
|
|
|
+ */
|
|
|
+ public Builder withConsistencyLevel(@NonNull ConsistencyLevelEnum consistencyLevel) {
|
|
|
+ this.consistencyLevel = consistencyLevel;
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Sets the partitions number if there is partition key field. The number must be greater than zero.
|
|
|
* The default value is 64(defined in server side). The upper limit is 4096(defined in server side).
|
|
@@ -185,7 +201,8 @@ public class CreateCollectionParam {
|
|
|
"collectionName='" + collectionName + '\'' +
|
|
|
", shardsNum=" + shardsNum +
|
|
|
", description='" + description + '\'' +
|
|
|
- ", fields=" + fieldTypes.toString() +
|
|
|
+ ", fields=" + fieldTypes.toString() + '\'' +
|
|
|
+ ", consistencyLevel=" + consistencyLevel +
|
|
|
'}';
|
|
|
}
|
|
|
}
|