const logLevel … type bufferPool … func newBufferPool() *bufferPool { … } func (p *bufferPool) get() *bytes.Buffer { … } func (p *bufferPool) put(b *bytes.Buffer) { … } type recvMsg … type recvBuffer … func newRecvBuffer() *recvBuffer { … } func (b *recvBuffer) put(r recvMsg) { … } func (b *recvBuffer) load() { … } // get returns the channel that receives a recvMsg in the buffer. // // Upon receipt of a recvMsg, the caller should call load to send another // recvMsg onto the channel if there is any. func (b *recvBuffer) get() <-chan recvMsg { … } type recvBufferReader … // Read reads the next len(p) bytes from last. If last is drained, it tries to // read additional data from recv. It blocks if there no additional data available // in recv. If Read returns any non-nil error, it will continue to return that error. func (r *recvBufferReader) Read(p []byte) (n int, err error) { … } func (r *recvBufferReader) read(p []byte) (n int, err error) { … } func (r *recvBufferReader) readClient(p []byte) (n int, err error) { … } func (r *recvBufferReader) readAdditional(m recvMsg, p []byte) (n int, err error) { … } type streamState … const streamActive … const streamWriteDone … const streamReadDone … const streamDone … type Stream … // isHeaderSent is only valid on the server-side. func (s *Stream) isHeaderSent() bool { … } // updateHeaderSent updates headerSent and returns true // if it was already set. It is valid only on server-side. func (s *Stream) updateHeaderSent() bool { … } func (s *Stream) swapState(st streamState) streamState { … } func (s *Stream) compareAndSwapState(oldState, newState streamState) bool { … } func (s *Stream) getState() streamState { … } func (s *Stream) waitOnHeader() { … } // RecvCompress returns the compression algorithm applied to the inbound // message. It is empty string if there is no compression applied. func (s *Stream) RecvCompress() string { … } // SetSendCompress sets the compression algorithm to the stream. func (s *Stream) SetSendCompress(name string) error { … } // SendCompress returns the send compressor name. func (s *Stream) SendCompress() string { … } // ClientAdvertisedCompressors returns the compressor names advertised by the // client via grpc-accept-encoding header. func (s *Stream) ClientAdvertisedCompressors() []string { … } // Done returns a channel which is closed when it receives the final status // from the server. func (s *Stream) Done() <-chan struct{ … } // Header returns the header metadata of the stream. // // On client side, it acquires the key-value pairs of header metadata once it is // available. It blocks until i) the metadata is ready or ii) there is no header // metadata or iii) the stream is canceled/expired. // // On server side, it returns the out header after t.WriteHeader is called. It // does not block and must not be called until after WriteHeader. func (s *Stream) Header() (metadata.MD, error) { … } // TrailersOnly blocks until a header or trailers-only frame is received and // then returns true if the stream was trailers-only. If the stream ends // before headers are received, returns true, nil. Client-side only. func (s *Stream) TrailersOnly() bool { … } // Trailer returns the cached trailer metedata. Note that if it is not called // after the entire stream is done, it could return an empty MD. Client // side only. // It can be safely read only after stream has ended that is either read // or write have returned io.EOF. func (s *Stream) Trailer() metadata.MD { … } // ContentSubtype returns the content-subtype for a request. For example, a // content-subtype of "proto" will result in a content-type of // "application/grpc+proto". This will always be lowercase. See // https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests for // more details. func (s *Stream) ContentSubtype() string { … } // Context returns the context of the stream. func (s *Stream) Context() context.Context { … } // SetContext sets the context of the stream. This will be deleted once the // stats handler callouts all move to gRPC layer. func (s *Stream) SetContext(ctx context.Context) { … } // Method returns the method for the stream. func (s *Stream) Method() string { … } // Status returns the status received from the server. // Status can be read safely only after the stream has ended, // that is, after Done() is closed. func (s *Stream) Status() *status.Status { … } // HeaderWireLength returns the size of the headers of the stream as received // from the wire. Valid only on the server. func (s *Stream) HeaderWireLength() int { … } // SetHeader sets the header metadata. This can be called multiple times. // Server side only. // This should not be called in parallel to other data writes. func (s *Stream) SetHeader(md metadata.MD) error { … } // SendHeader sends the given header metadata. The given metadata is // combined with any metadata set by previous calls to SetHeader and // then written to the transport stream. func (s *Stream) SendHeader(md metadata.MD) error { … } // SetTrailer sets the trailer metadata which will be sent with the RPC status // by the server. This can be called multiple times. Server side only. // This should not be called parallel to other data writes. func (s *Stream) SetTrailer(md metadata.MD) error { … } func (s *Stream) write(m recvMsg) { … } // Read reads all p bytes from the wire for this stream. func (s *Stream) Read(p []byte) (n int, err error) { … } type transportReader … func (t *transportReader) Read(p []byte) (n int, err error) { … } // BytesReceived indicates whether any bytes have been received on this stream. func (s *Stream) BytesReceived() bool { … } // Unprocessed indicates whether the server did not process this stream -- // i.e. it sent a refused stream or GOAWAY including this stream ID. func (s *Stream) Unprocessed() bool { … } // GoString is implemented by Stream so context.String() won't // race when printing %#v. func (s *Stream) GoString() string { … } type transportState … const reachable … const closing … const draining … type ServerConfig … type ConnectOptions … // NewClientTransport establishes the transport with the required ConnectOptions // and returns it to the caller. func NewClientTransport(connectCtx, ctx context.Context, addr resolver.Address, opts ConnectOptions, onClose func(GoAwayReason)) (ClientTransport, error) { … } type Options … type CallHdr … type ClientTransport … type ServerTransport … // connectionErrorf creates an ConnectionError with the specified error description. func connectionErrorf(temp bool, e error, format string, a ...any) ConnectionError { … } type ConnectionError … func (e ConnectionError) Error() string { … } // Temporary indicates if this connection error is temporary or fatal. func (e ConnectionError) Temporary() bool { … } // Origin returns the original error of this connection error. func (e ConnectionError) Origin() error { … } // Unwrap returns the original error of this connection error or nil when the // origin is nil. func (e ConnectionError) Unwrap() error { … } var ErrConnClosing … var errStreamDrain … var errStreamDone … var statusGoAway … type GoAwayReason … const GoAwayInvalid … const GoAwayNoReason … const GoAwayTooManyPings … // ContextErr converts the error from context package into a status error. func ContextErr(err error) error { … }