2021-09-12 23:24:32 +03:00
|
|
|
package drpc
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2021-10-27 18:20:32 +03:00
|
|
|
"go.unistack.org/micro/v3/server"
|
2021-09-12 23:24:32 +03:00
|
|
|
"google.golang.org/grpc"
|
|
|
|
)
|
|
|
|
|
|
|
|
// rpcStream implements a server side Stream.
|
|
|
|
type rpcStream struct {
|
|
|
|
// embed the grpc stream so we can access it
|
|
|
|
grpc.ServerStream
|
|
|
|
|
|
|
|
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 {
|
|
|
|
return r.ServerStream.Context()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *rpcStream) Send(m interface{}) error {
|
|
|
|
return r.ServerStream.SendMsg(m)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *rpcStream) Recv(m interface{}) error {
|
|
|
|
return r.ServerStream.RecvMsg(m)
|
|
|
|
}
|