mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-11-30 10:59:32 +08:00
7611128e57
issue: #33285 - add adaptor to implement walimpls into wal interface. - implement timetick sorted and filtering scanner. - add test for wal. --------- Signed-off-by: chyezh <chyezh@outlook.com>
35 lines
878 B
Go
35 lines
878 B
Go
package status
|
|
|
|
import (
|
|
"google.golang.org/grpc"
|
|
)
|
|
|
|
// NewClientStreamWrapper returns a grpc.ClientStream that wraps the given stream.
|
|
func NewClientStreamWrapper(method string, stream grpc.ClientStream) grpc.ClientStream {
|
|
if stream == nil {
|
|
return nil
|
|
}
|
|
return &clientStreamWrapper{
|
|
method: method,
|
|
ClientStream: stream,
|
|
}
|
|
}
|
|
|
|
// clientStreamWrapper wraps a grpc.ClientStream and converts errors to Status.
|
|
type clientStreamWrapper struct {
|
|
method string
|
|
grpc.ClientStream
|
|
}
|
|
|
|
// Convert the error to a Status and return it.
|
|
func (s *clientStreamWrapper) SendMsg(m interface{}) error {
|
|
err := s.ClientStream.SendMsg(m)
|
|
return ConvertStreamingError(s.method, err)
|
|
}
|
|
|
|
// Convert the error to a Status and return it.
|
|
func (s *clientStreamWrapper) RecvMsg(m interface{}) error {
|
|
err := s.ClientStream.RecvMsg(m)
|
|
return ConvertStreamingError(s.method, err)
|
|
}
|