conn_pool.go raw

   1  // Copyright 2020 Google LLC.
   2  // Use of this source code is governed by a BSD-style
   3  // license that can be found in the LICENSE file.
   4  
   5  package internal
   6  
   7  import (
   8  	"google.golang.org/grpc"
   9  )
  10  
  11  // ConnPool is a pool of grpc.ClientConns.
  12  type ConnPool interface {
  13  	// Conn returns a ClientConn from the pool.
  14  	//
  15  	// Conns aren't returned to the pool.
  16  	Conn() *grpc.ClientConn
  17  
  18  	// Num returns the number of connections in the pool.
  19  	//
  20  	// It will always return the same value.
  21  	Num() int
  22  
  23  	// Close closes every ClientConn in the pool.
  24  	//
  25  	// The error returned by Close may be a single error or multiple errors.
  26  	Close() error
  27  
  28  	// ConnPool implements grpc.ClientConnInterface to enable it to be used directly with generated proto stubs.
  29  	grpc.ClientConnInterface
  30  }
  31