nphttp2

package
v0.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 34 Imported by: 9

Documentation

Overview

Package nphttp2 transport powered by netpoll

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GRPCHeader added in v0.4.3

func GRPCHeader(ctx context.Context, md *metadata.MD) context.Context

GRPCHeader is used for unary call client to get header from response.

func GRPCTrailer added in v0.4.3

func GRPCTrailer(ctx context.Context, md *metadata.MD) context.Context

GRPCTrailer is used for unary call client to get taiiler from response.

func GetHeaderMetadataFromCtx added in v0.6.0

func GetHeaderMetadataFromCtx(ctx context.Context) *metadata.MD

GetHeaderMetadataFromCtx is used to get the metadata of stream Header from ctx.

func NewCliTransHandlerFactory

func NewCliTransHandlerFactory() remote.ClientTransHandlerFactory

NewCliTransHandlerFactory ...

func NewConnPool

func NewConnPool(remoteService string, size uint32, connOpts grpc.ConnectOptions) *connPool

NewConnPool ...

func NewStream

func NewStream(ctx context.Context, svcInfo *serviceinfo.ServiceInfo, conn net.Conn,
	handler remote.TransReadWriter,
) streaming.Stream

NewStream ...

func NewSvrTransHandlerFactory

func NewSvrTransHandlerFactory() remote.ServerTransHandlerFactory

NewSvrTransHandlerFactory ...

func SendHeader added in v0.4.3

func SendHeader(ctx context.Context, md metadata.MD) error

SendHeader sends header metadata. It may be called at most once, and may not be called after any event that causes headers to be sent (see SetHeader for a complete list). The provided md and headers set by SetHeader() will be sent.

The error returned is compatible with the status package. However, the status code will often not match the RPC status as seen by the client application, and therefore, should not be relied upon for this purpose.

func SetHeader added in v0.4.3

func SetHeader(ctx context.Context, md metadata.MD) error

SetHeader sets the header metadata to be sent from the server to the client. The context provided must be the context passed to the server's handler.

Streaming RPCs should prefer the SetHeader method of the ServerStream.

When called multiple times, all the provided metadata will be merged. All the metadata will be sent out when one of the following happens:

  • grpc.SendHeader is called, or for streaming handlers, stream.SendHeader.
  • The first response message is sent. For unary handlers, this occurs when the handler returns; for streaming handlers, this can happen when stream's SendMsg method is called.
  • An RPC status is sent out (error or success). This occurs when the handler returns.

SetHeader will fail if called after any of the events above.

The error returned is compatible with the status package. However, the status code will often not match the RPC status as seen by the client application, and therefore, should not be relied upon for this purpose.

func SetTrailer added in v0.4.3

func SetTrailer(ctx context.Context, md metadata.MD) error

SetTrailer sets the trailer metadata that will be sent when an RPC returns. When called more than once, all the provided metadata will be merged.

The error returned is compatible with the status package. However, the status code will often not match the RPC status as seen by the client application, and therefore, should not be relied upon for this purpose.

Types

type GRPCConn added in v0.3.3

type GRPCConn interface {
	net.Conn
	// WriteFrame set header and data buffer into frame with nocopy
	WriteFrame(hdr, data []byte) (n int, err error)
	// ReadFrame read a frame and return header and payload data
	ReadFrame() (hdr, data []byte, err error)
}

GRPCConn implement WriteFrame and ReadFrame

func GetServerConn added in v0.3.3

func GetServerConn(st streaming.Stream) (GRPCConn, error)

type Streamer

type Streamer func(ctx context.Context, svcInfo serviceinfo.ServiceInfo, conn net.Conn,
	handler remote.TransReadWriter) streaming.Stream

Streamer Stream creator

type SvrTrans added in v0.4.0

type SvrTrans struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis
Package codes defines the canonical error codes used by gRPC.
Package codes defines the canonical error codes used by gRPC.
The files in grpc package are forked from gRPC[github.com/grpc/grpc-go], and we keep the original Copyright[Copyright 2017 gRPC authors] and License of gRPC for those files.
The files in grpc package are forked from gRPC[github.com/grpc/grpc-go], and we keep the original Copyright[Copyright 2017 gRPC authors] and License of gRPC for those files.
syscall
Package syscall provides functionalities that grpc uses to get low-level operating system stats/info.
Package syscall provides functionalities that grpc uses to get low-level operating system stats/info.
testutils/leakcheck
Package leakcheck contains functions to check leaked goroutines.
Package leakcheck contains functions to check leaked goroutines.
Package metadata define the structure of the metadata supported by gRPC library.
Package metadata define the structure of the metadata supported by gRPC library.
Package status implements errors returned by gRPC.
Package status implements errors returned by gRPC.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL