grpcutil

package module
v0.121.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeTimeout

func DecodeTimeout(s string) (time.Duration, error)

DecodeTimeout parses a string associated with the "grpc-timeout" header. Note this will accept all valid gRPC units including microseconds and nanoseconds, which EncodeTimeout avoids. This is specified in:

https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests

func EncodeTimeout

func EncodeTimeout(t time.Duration) string

EncodeTimeout encodes the duration to the format grpc-timeout header accepts. This is copied from the gRPC-Go implementation, with two branches of the original six branches removed, leaving the four you see for milliseconds, seconds, minutes, and hours. This code will not encode timeouts less than one millisecond. See:

https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests

Types

This section is empty.

Jump to

Keyboard shortcuts

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