client

package
v2.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package client implements a gRPC client implementation that satisfies the PiServiceClient interface requirements with optional OpenTelemetry metrics and traces.

Index

Constants

View Source
const (
	// The default maximum timeout that will be applied to requests.
	DefaultMaxTimeout = 10 * time.Second
	// The default name to use when using OpenTelemetry components.
	OpenTelemetryPackageIdentifier = "pkg.client"
	// A default round-robin configuration to use with client-side load balancer.
	DefaultRoundRobinConfig = `{"loadBalancingConfig": [{"round_robin":{}}]}`
)

Variables

This section is empty.

Functions

This section is empty.

Types

type PiClient

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

Implements the PiServiceClient interface.

func NewPiClient

func NewPiClient(options ...PiClientOption) (*PiClient, error)

Create a new PiClient with optional settings.

func (*PiClient) FetchDigit

func (c *PiClient) FetchDigit(ctx context.Context, index uint64) (uint32, error)

Initiate a gRPC request to Pi Service and retrieve a single fractional decimal digit of pi at the zero-based index.

func (*PiClient) Shutdown

func (c *PiClient) Shutdown(_ context.Context) error

Shutdown the gRPC client connection that is used by this PiClient. After calling this function FetchDigit will return an error on every call.

type PiClientOption

type PiClientOption func(*PiClient)

Defines a function signature for PiClient options.

func WithAuthority

func WithAuthority(authority string) PiClientOption

Set the authority string to use for gRPC connections.

func WithEndpoint

func WithEndpoint(endpoint string) PiClientOption

Set the endpoint to use for gRPC connections.

func WithHeaders

func WithHeaders(headers map[string]string) PiClientOption

Add the headers values to the PiService client gRPC metadata.

func WithLogger

func WithLogger(logger logr.Logger) PiClientOption

Use the supplied logr.logger.

func WithMaxTimeout

func WithMaxTimeout(maxTimeout time.Duration) PiClientOption

Set the maximum timeout for client requests to a PiService.

func WithTransportCredentials

func WithTransportCredentials(creds credentials.TransportCredentials) PiClientOption

Set the transport credentials to use for PiService gRPC connection.

func WithUserAgent

func WithUserAgent(userAgent string) PiClientOption

Set the user-agent string to use for gRPC connections.

Jump to

Keyboard shortcuts

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