-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enhance: Enable set node label filter in resource group config
Signed-off-by: Wei Liu <[email protected]>
- Loading branch information
1 parent
e97602f
commit 848f408
Showing
3 changed files
with
82 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
64 changes: 64 additions & 0 deletions
64
src/main/java/io/milvus/common/resourcegroup/ResourceGroupNodeFilter.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,64 @@ | ||
package io.milvus.common.resourcegroup; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.stream.Collectors; | ||
|
||
import io.milvus.grpc.KeyValuePair; | ||
import io.milvus.param.ParamUtils; | ||
import lombok.Getter; | ||
import lombok.NonNull; | ||
|
||
@Getter | ||
public class ResourceGroupNodeFilter { | ||
private final Map<String, String> nodeLabels; | ||
|
||
private ResourceGroupNodeFilter(Builder builder) { | ||
this.nodeLabels = builder.nodeLabels; | ||
} | ||
|
||
public static Builder newBuilder() { | ||
return new Builder(); | ||
} | ||
|
||
public static final class Builder { | ||
private Map<String, String> nodeLabels; | ||
private Builder() { | ||
} | ||
|
||
/** | ||
* Set the node label filter | ||
* @param key label name | ||
* @param value label value | ||
* @return <code>Builder</code> | ||
*/ | ||
public Builder withNodeLabel(@NonNull String key, @NonNull String value) { | ||
this.nodeLabels.put(key, value); | ||
return this; | ||
} | ||
|
||
public ResourceGroupNodeFilter build() { | ||
return new ResourceGroupNodeFilter(this); | ||
} | ||
} | ||
|
||
/** | ||
* Transfer to grpc | ||
* @return io.milvus.grpc.ResourceGroupNodeFilter | ||
*/ | ||
public @NonNull io.milvus.grpc.ResourceGroupNodeFilter toGRPC() { | ||
List<KeyValuePair> pair = ParamUtils.AssembleKvPair(nodeLabels); | ||
return io.milvus.grpc.ResourceGroupNodeFilter.newBuilder() | ||
.addAllNodeLabels(pair) | ||
.build(); | ||
} | ||
|
||
/** | ||
* Constructor from grpc | ||
* @param filter grpc filter object | ||
*/ | ||
public ResourceGroupNodeFilter(io.milvus.grpc.ResourceGroupNodeFilter filter) { | ||
this.nodeLabels = filter.getNodeLabelsList().stream().collect(Collectors.toMap(KeyValuePair::getKey, KeyValuePair::getValue)); | ||
} | ||
|
||
} |
Submodule milvus-proto
updated
9 files
+546 −527 | go-api/commonpb/common.pb.go | |
+12 −1 | go-api/hook/hook.go | |
+2,463 −2,432 | go-api/milvuspb/milvus.pb.go | |
+136 −32 | go-api/msgpb/msg.pb.go | |
+293 −274 | go-api/schemapb/schema.pb.go | |
+3 −0 | proto/common.proto | |
+6 −3 | proto/milvus.proto | |
+7 −0 | proto/msg.proto | |
+2 −0 | proto/schema.proto |