(ctx context.Context, id string)
| 72 | } |
| 73 | |
| 74 | func (sc *streamCreator) Create(ctx context.Context, id string) (streaming.Stream, error) { |
| 75 | stream, err := sc.client.Stream(ctx) |
| 76 | if err != nil { |
| 77 | return nil, err |
| 78 | } |
| 79 | |
| 80 | a, err := typeurl.MarshalAny(&streamingapi.StreamInit{ |
| 81 | ID: id, |
| 82 | }) |
| 83 | if err != nil { |
| 84 | return nil, err |
| 85 | } |
| 86 | err = stream.Send(typeurl.MarshalProto(a)) |
| 87 | if err != nil { |
| 88 | if !errors.Is(err, io.EOF) { |
| 89 | err = errgrpc.ToNative(err) |
| 90 | } |
| 91 | return nil, err |
| 92 | } |
| 93 | |
| 94 | // Receive an ack that stream is init and ready |
| 95 | if _, err = stream.Recv(); err != nil { |
| 96 | if !errors.Is(err, io.EOF) { |
| 97 | err = errgrpc.ToNative(err) |
| 98 | } |
| 99 | return nil, err |
| 100 | } |
| 101 | |
| 102 | return &clientStream{ |
| 103 | s: stream, |
| 104 | }, nil |
| 105 | } |
| 106 | |
| 107 | type clientStream struct { |
| 108 | s streamingapi.TTRPCStreaming_StreamClient |
nothing calls this directly
no test coverage detected