Skip to content

Commit

Permalink
grpc: improve docs on StreamDesc (#4397)
Browse files Browse the repository at this point in the history
  • Loading branch information
dfawley committed May 7, 2021
1 parent c7ea734 commit b6f206b
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions stream.go
Expand Up @@ -52,14 +52,20 @@ import (
// of the RPC.
type StreamHandler func(srv interface{}, stream ServerStream) error

// StreamDesc represents a streaming RPC service's method specification.
// StreamDesc represents a streaming RPC service's method specification. Used
// on the server when registering services and on the client when initiating
// new streams.
type StreamDesc struct {
StreamName string
Handler StreamHandler

// At least one of these is true.
ServerStreams bool
ClientStreams bool
// StreamName and Handler are only used when registering handlers on a
// server.
StreamName string // the name of the method excluding the service
Handler StreamHandler // the handler called for the method

// ServerStreams and ClientStreams are used for registering handlers on a
// server as well as defining RPC behavior when passed to NewClientStream
// and ClientConn.NewStream. At least one must be true.
ServerStreams bool // indicates the server can perform streaming sends
ClientStreams bool // indicates the client can perform streaming sends
}

// Stream defines the common interface a client or server stream has to satisfy.
Expand Down

0 comments on commit b6f206b

Please sign in to comment.