Involved Source Files
Package encoding defines the interface for the compressor and codec, and
functions to register and retrieve compressors and codecs.
This package is EXPERIMENTAL.
Package-Level Type Names (total 2, both are exported)
/* sort exporteds by: | */
Codec defines the interface gRPC uses to encode and decode messages. Note
that implementations of this interface must be thread safe; a Codec's
methods can be called from concurrent goroutines.
Marshal returns the wire format of v.
Name returns the name of the Codec implementation. The returned string
will be used as part of content type in transmission. The result must be
static; the result cannot change between calls.
Unmarshal parses the wire format into v.
google.golang.org/grpc/encoding/proto.codec
T : google.golang.org/grpc.baseCodec
func GetCodec(contentSubtype string) Codec
func RegisterCodec(codec Codec)
func google.golang.org/grpc.ForceCodec(codec Codec) grpc.CallOption
Package-Level Functions (total 4, all are exported)
GetCodec gets a registered Codec by content-subtype, or nil if no Codec is
registered for the content-subtype.
The content-subtype is expected to be lowercase.
GetCompressor returns Compressor for the given compressor name.
RegisterCodec registers the provided Codec for use with all gRPC clients and
servers.
The Codec will be stored and looked up by result of its Name() method, which
should match the content-subtype of the encoding handled by the Codec. This
is case-insensitive, and is stored and looked up as lowercase. If the
result of calling Name() is an empty string, RegisterCodec will panic. See
Content-Type on
https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests for
more details.
NOTE: this function must only be called during initialization time (i.e. in
an init() function), and is not thread-safe. If multiple Compressors are
registered with the same name, the one registered last will take effect.
RegisterCompressor registers the compressor with gRPC by its name. It can
be activated when sending an RPC via grpc.UseCompressor(). It will be
automatically accessed when receiving a message based on the content coding
header. Servers also use it to send a response with the same encoding as
the request.
NOTE: this function must only be called during initialization time (i.e. in
an init() function), and is not thread-safe. If multiple Compressors are
registered with the same name, the one registered last will take effect.
Package-Level Variables (total 2, neither is exported)
Package-Level Constants (only one, which is exported)
Identity specifies the optional encoding for uncompressed streams.
It is intended for grpc internal use only.
The pages are generated with Goldsv0.3.2-preview. (GOOS=darwin GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.