Skip to content

Commit

Permalink
Fix grpc version (#101)
Browse files Browse the repository at this point in the history
Signed-off-by: fishpenguin <[email protected]>
  • Loading branch information
fishpenguin authored Apr 29, 2021
1 parent 126965c commit da1745f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
5 changes: 3 additions & 2 deletions examples/MilvusClientExample.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ package main
import (
"context"
"log"
"math/rand"
"strconv"
"time"

Expand All @@ -31,7 +32,7 @@ import (
var collectionName string = "test_go2"
var dimension int64 = 128
var indexFileSize int64 = 1024
var metricType int64 = int64(milvus.L2)
var metricType int32 = int32(milvus.L2)
var nq int64 = 100
var nprobe int64 = 64
var nb int64 = 100000
Expand Down Expand Up @@ -164,7 +165,7 @@ func example(address string, port string) {
for i = 0; i < nq; i++ {
queryVectors[i] = make([]float32, dimension)
for j = 0; j < dimension; j++ {
queryVectors[i][j] = float32(i % (j + 1))
queryVectors[i][j] = float32(rand.Float64())
}
queryRecords[i].FloatData = queryVectors[i]
}
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ go 1.12

require (
github.com/golang/protobuf v1.5.2
google.golang.org/grpc v1.26.0
google.golang.org/grpc v1.27.0
google.golang.org/protobuf v1.26.0
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZi
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.26.0 h1:2dTRdpdFEEhJYQD8EMLB61nnrzSCTbG38PhqdhvOltg=
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.27.0 h1:rRYRFMVgRv6E0D70Skyfsr28tDXIuuPZyWGMPdMcnXg=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
Expand Down
3 changes: 2 additions & 1 deletion milvus/ClientProxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ func (client *Milvusclient) CreateCollection(ctx context.Context, collectionPara
CollectionName: collectionParam.CollectionName,
Dimension: collectionParam.Dimension,
IndexFileSize: collectionParam.IndexFileSize,
MetricType: collectionParam.MetricType,
}
grpcStatus, err := client.Instance.CreateCollection(ctx, grpcCollectionSchema)
if err != nil {
Expand Down Expand Up @@ -293,7 +294,7 @@ func (client *Milvusclient) GetCollectionInfo(ctx context.Context, collectionNam
if err != nil {
return CollectionParam{"", 0, 0, 0}, nil, err
}
return CollectionParam{collectionSchema.GetCollectionName(), collectionSchema.GetDimension(), collectionSchema.GetIndexFileSize(), int64(collectionSchema.GetMetricType())},
return CollectionParam{collectionSchema.GetCollectionName(), collectionSchema.GetDimension(), collectionSchema.GetIndexFileSize(), collectionSchema.GetMetricType()},
status{int64(collectionSchema.GetStatus().GetErrorCode()), collectionSchema.Status.Reason}, err
}

Expand Down
2 changes: 1 addition & 1 deletion milvus/MilvusClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ type CollectionParam struct {
// IndexFileSize Index file size, must be a positive value
IndexFileSize int64
// MetricType Index metric type
MetricType int64
MetricType int32
}

// IndexParam index parameters
Expand Down

0 comments on commit da1745f

Please sign in to comment.