conn_pool.go 766 B

123456789101112131415161718192021222324252627282930
  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. package internal
  5. import (
  6. "google.golang.org/grpc"
  7. )
  8. // ConnPool is a pool of grpc.ClientConns.
  9. type ConnPool interface {
  10. // Conn returns a ClientConn from the pool.
  11. //
  12. // Conns aren't returned to the pool.
  13. Conn() *grpc.ClientConn
  14. // Num returns the number of connections in the pool.
  15. //
  16. // It will always return the same value.
  17. Num() int
  18. // Close closes every ClientConn in the pool.
  19. //
  20. // The error returned by Close may be a single error or multiple errors.
  21. Close() error
  22. // ConnPool implements grpc.ClientConnInterface to enable it to be used directly with generated proto stubs.
  23. grpc.ClientConnInterface
  24. }