2019-06-03 20:44:43 +03:00
|
|
|
package grpc
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2020-07-27 15:22:00 +03:00
|
|
|
"github.com/micro/go-micro/v3/server"
|
2019-06-03 20:44:43 +03:00
|
|
|
"google.golang.org/grpc"
|
|
|
|
)
|
|
|
|
|
|
|
|
// rpcStream implements a server side Stream.
|
|
|
|
type rpcStream struct {
|
2020-08-09 17:43:41 +03:00
|
|
|
// embed the grpc stream so we can access it
|
|
|
|
grpc.ServerStream
|
|
|
|
|
2019-06-03 20:44:43 +03:00
|
|
|
request server.Request
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *rpcStream) Close() error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *rpcStream) Error() error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *rpcStream) Request() server.Request {
|
|
|
|
return r.request
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *rpcStream) Context() context.Context {
|
2020-08-09 17:43:41 +03:00
|
|
|
return r.ServerStream.Context()
|
2019-06-03 20:44:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *rpcStream) Send(m interface{}) error {
|
2020-08-09 17:43:41 +03:00
|
|
|
return r.ServerStream.SendMsg(m)
|
2019-06-03 20:44:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *rpcStream) Recv(m interface{}) error {
|
2020-08-09 17:43:41 +03:00
|
|
|
return r.ServerStream.RecvMsg(m)
|
2019-06-03 20:44:43 +03:00
|
|
|
}
|