Repository: grpc/grpc-go
File: stream_interfaces.go (Go)

Code before:
	// This method is typically called after processing all request messages from the client
	// to send the final response and close the stream. The single response message from
	// the server is sent by calling the SendAndClose method on this ClientStreamingServer
	// parameter. If an error occurs on the stream, it will be returned as an  instance of the
	// 'status' package. Refer to the 'status' package documentation for more details. The
	// stream is terminated upon calling this method. No further methods on this interface
	// should be called afterward.
	SendAndClose(*Res) error
	ServerStream
}

// BidiStreamingClient represents the client side of a bidirectional-streaming
// (many requests, many responses) RPC. It is generic over both the type of the
// request message stream and the type of the response message stream. It is
// used in generated code.
type BidiStreamingClient[Req any, Res any] interface {
	// Send sends a message to the server. This method is called repeatedly
	// to send all messages as part of the client’s request stream. The client
	// can repeatedly call the Send method on the returned BidiStreamingClient
	// stream in order to send the client-to-server message stream. If an error
	// occurs on the stream, it will be returned as an instance of the 'status'
	// package. Refer to the 'status' package documentation for more details.
	Send(*Req) error

	// Recv receives the next message from the server's response stream. This method
	// is called repeatedly to receive all messages sent by the server. The client can
	// repeatedly call Recv on this stream in order to receive the full server-to-client
	// message stream. If an error occurs on the stream, it will be returned as an instance
	// of the 'status' package. Refer to the 'status' package documentation for more details.
	// End-of-stream for the client-to-server stream can be indicated from the client by
	// calling the CloseSend method on the stream.
	Recv() (*Res, error)
	ClientStream
}

// BidiStreamingServer represents the server side of a bidirectional-streaming
// (many requests, many responses) RPC. It is generic over both the type of the
// request message stream and the type of the response message stream. It is
// used in generated code.
type BidiStreamingServer[Req any, Res any] interface {
	// Recv receives a request message from the client. The server-side handler can
	// repeatedly call Recv on this parameter in order to read the client-to-server
	// message stream. If an error occurs on the stream, it will be returned as an
	// instance of the 'status' package. Refer to the 'status' package documentation
	// for more details.Recv returns (nil, io.EOF) once it has reached the end of the
	// client-to-server stream. when the client has finished sending messages.
	Recv() (*Req, error)

	// Send sends a response message to the client. The response server-to-client
	// message stream is sent by repeatedly calling the Send method of on this
	// BidiStreamingServer parameter. If an error occurs on the stream, it will be

Review comment (suggestion):
```
This method
	// is called repeatedly to receive all messages sent by the server. The client can
	// repeatedly call Recv on this stream in order to receive the full server-to-client
	// message stream.
```

these sentences are looking talking about repeatedly twice. Let's combine in one. 

Code after:
// package.
type ClientStreamingServer[Req any, Res any] interface {
	// Recv receives the next request message from the client.  The server may
	// repeatedly call Recv to read messages from the request stream.  If
	// io.EOF is returned, it indicates the client called CloseAndRecv on its
	// ClientStreamingClient.  Any other error indicates the stream was
	// terminated unexpectedly, and the handler method should return, as the
	// stream is no longer usable.
	Recv() (*Req, error)

	// SendAndClose sends a single response message to the client and closes
	// the stream.  This method must be called once and only once after all
	// request messages have been processed.  Recv should not be called after
	// calling SendAndClose.
	SendAndClose(*Res) error

	// ServerStream is embedded to provide Context, SetHeader, SendHeader, and
	// SetTrailer functionality.  No other methods in the ServerStream should
	// be called directly.
	ServerStream
}

// BidiStreamingClient represents the client side of a bidirectional-streaming
// (many requests, many responses) RPC. It is generic over both the type of the
// request message stream and the type of the response message stream. It is
// used in generated code.
type BidiStreamingClient[Req any, Res any] interface {
	// Send sends a request message to the server.  The client may call Send
	// multiple times to send multiple messages to the server.  On error, Send
	// aborts the stream.  If the error was generated by the client, the status
	// is returned directly.  Otherwise, io.EOF is returned, and the status of
	// the stream may be discovered using Recv().
	Send(*Req) error

	// Recv receives the next response message from the server. The client may
	// repeatedly call Recv to read messages from the response stream.  If
	// io.EOF is returned, the stream has terminated with an OK status.  Any
	// other error is compatible with the status package and indicates the
	// RPC's status code and message.
	Recv() (*Res, error)

	// ClientStream is embedded to provide Context, Header, Trailer, and
	// CloseSend functionality.  No other methods in the ClientStream should be
	// called directly.
	ClientStream
}

// BidiStreamingServer represents the server side of a bidirectional-streaming
// (many requests, many responses) RPC. It is generic over both the type of the
// request message stream and the type of the response message stream. It is
// used in generated code.