grpcpool

package module
v0.0.0-...-458a041 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: BSD-3-Clause Imports: 5 Imported by: 1

README

grpcpool

import "github.com/go-coldbrew/grpcpool"

grpcpool is a pool of grpc.ClientConns. It implements grpc.ClientConnInterface to enable it to be used directly with generated proto stubs. It is based on https://github.com/googleapis/google-api-go-client/blob/v0.115.0/transport/grpc/pool.go

Index

type ConnPool

ConnPool is a pool of grpc.ClientConns.

type ConnPool interface {
    // Conn returns a ClientConn from the pool.
    //
    // Conns aren't returned to the pool.
    Conn() *grpc.ClientConn

    // Num returns the number of connections in the pool.
    //
    // It will always return the same value.
    Num() int

    // Close closes every ClientConn in the pool.
    //
    // The error returned by Close may be a single error or multiple errors.
    Close() error

    // ConnPool implements grpc.ClientConnInterface to enable it to be used directly with generated proto stubs.
    grpc.ClientConnInterface
}

func Dial
func Dial(target string, num uint, opts ...grpc.DialOption) (ConnPool, error)

Dial creates a new ConnPool with num connections to target.

func DialContext
func DialContext(ctx context.Context, target string, num uint, opts ...grpc.DialOption) (ConnPool, error)

DialContext creates a new ConnPool with num connections to target.

func New
func New(conns []*grpc.ClientConn) ConnPool

New creates a new ConnPool from the given connections.

Generated by gomarkdoc

Documentation

Overview

grpcpool is a pool of grpc.ClientConns. It implements grpc.ClientConnInterface to enable it to be used directly with generated proto stubs. It is based on https://github.com/googleapis/google-api-go-client/blob/v0.115.0/transport/grpc/pool.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnPool

type ConnPool interface {
	// Conn returns a ClientConn from the pool.
	//
	// Conns aren't returned to the pool.
	Conn() *grpc.ClientConn

	// Num returns the number of connections in the pool.
	//
	// It will always return the same value.
	Num() int

	// Close closes every ClientConn in the pool.
	//
	// The error returned by Close may be a single error or multiple errors.
	Close() error

	// ConnPool implements grpc.ClientConnInterface to enable it to be used directly with generated proto stubs.
	grpc.ClientConnInterface
}

ConnPool is a pool of grpc.ClientConns.

func Dial

func Dial(target string, num uint, opts ...grpc.DialOption) (ConnPool, error)

Dial creates a new ConnPool with num connections to target.

func DialContext

func DialContext(ctx context.Context, target string, num uint, opts ...grpc.DialOption) (ConnPool, error)

DialContext creates a new ConnPool with num connections to target.

func New

func New(conns []*grpc.ClientConn) ConnPool

New creates a new ConnPool from the given connections.

Jump to

Keyboard shortcuts

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