-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: SimFG <[email protected]>
- Loading branch information
Showing
11 changed files
with
342 additions
and
175 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package client | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" | ||
"github.com/milvus-io/milvus-proto/go-api/v2/msgpb" | ||
"github.com/milvus-io/milvus-sdk-go/v2/entity" | ||
) | ||
|
||
func (c *GrpcClient) ReplicateMessage(ctx context.Context, | ||
channelName string, beginTs, endTs uint64, | ||
msgsBytes [][]byte, startPositions, endPositions []*msgpb.MsgPosition, | ||
opts ...ReplicateMessageOption) (*entity.MessageInfo, error) { | ||
|
||
if c.Service == nil { | ||
return nil, ErrClientNotReady | ||
} | ||
req := &milvuspb.ReplicateMessageRequest{ | ||
ChannelName: channelName, | ||
BeginTs: beginTs, | ||
EndTs: endTs, | ||
Msgs: msgsBytes, | ||
StartPositions: startPositions, | ||
EndPositions: endPositions, | ||
} | ||
for _, opt := range opts { | ||
opt(req) | ||
} | ||
resp, err := c.Service.ReplicateMessage(ctx, req) | ||
if err != nil { | ||
return nil, err | ||
} | ||
err = handleRespStatus(resp.GetStatus()) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return &entity.MessageInfo{ | ||
Position: resp.GetPosition(), | ||
}, nil | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package client | ||
|
||
import ( | ||
"github.com/milvus-io/milvus-proto/go-api/v2/commonpb" | ||
"github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" | ||
) | ||
|
||
func WithCreateCollectionMsgBase(msgBase *commonpb.MsgBase) CreateCollectionOption { | ||
return func(opt *createCollOpt) { | ||
opt.MsgBase = msgBase | ||
} | ||
} | ||
|
||
func WithDropCollectionMsgBase(msgBase *commonpb.MsgBase) DropCollectionOption { | ||
return func(req *milvuspb.DropCollectionRequest) { | ||
req.Base = msgBase | ||
} | ||
} | ||
|
||
func WithLoadCollectionMsgBase(msgBase *commonpb.MsgBase) LoadCollectionOption { | ||
return func(req *milvuspb.LoadCollectionRequest) { | ||
req.Base = msgBase | ||
} | ||
} | ||
|
||
func WithReleaseCollectionMsgBase(msgBase *commonpb.MsgBase) ReleaseCollectionOption { | ||
return func(req *milvuspb.ReleaseCollectionRequest) { | ||
req.Base = msgBase | ||
} | ||
} | ||
|
||
func WithFlushMsgBase(msgBase *commonpb.MsgBase) FlushOption { | ||
return func(req *milvuspb.FlushRequest) { | ||
req.Base = msgBase | ||
} | ||
} | ||
|
||
func WithCreateDatabaseMsgBase(msgBase *commonpb.MsgBase) CreateDatabaseOption { | ||
return func(req *milvuspb.CreateDatabaseRequest) { | ||
req.Base = msgBase | ||
} | ||
} | ||
|
||
func WithDropDatabaseMsgBase(msgBase *commonpb.MsgBase) DropDatabaseOption { | ||
return func(req *milvuspb.DropDatabaseRequest) { | ||
req.Base = msgBase | ||
} | ||
} | ||
|
||
func WithReplicateMessageMsgBase(msgBase *commonpb.MsgBase) ReplicateMessageOption { | ||
return func(req *milvuspb.ReplicateMessageRequest) { | ||
req.Base = msgBase | ||
} | ||
} | ||
|
||
func WithCreatePartitionMsgBase(msgBase *commonpb.MsgBase) CreatePartitionOption { | ||
return func(req *milvuspb.CreatePartitionRequest) { | ||
req.Base = msgBase | ||
} | ||
} | ||
|
||
func WithDropPartitionMsgBase(msgBase *commonpb.MsgBase) DropPartitionOption { | ||
return func(req *milvuspb.DropPartitionRequest) { | ||
req.Base = msgBase | ||
} | ||
} |
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,5 @@ | ||
package entity | ||
|
||
type MessageInfo struct { | ||
Position string | ||
} |
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
Oops, something went wrong.