diff --git a/constants.go b/constants.go index bd308dc..e9e1089 100644 --- a/constants.go +++ b/constants.go @@ -1,4 +1,4 @@ -package overflow_grpc_pool +package grpc_pool const ( // DefaultWriteTimeout is default value of Write Timeout diff --git a/pool.go b/pool.go index 94aa757..e05e7c7 100644 --- a/pool.go +++ b/pool.go @@ -1,4 +1,4 @@ -package overflow_grpc_pool +package grpc_pool import ( "errors" @@ -95,7 +95,7 @@ func (p *pool) createInstance() error { return ErrPoolFull } - conn, i, err := p.ph.OnCreate() + conn, i, err := p.ph.Dial() if err != nil { return err } diff --git a/pool_handler.go b/pool_handler.go index 8f23910..fe50fd8 100644 --- a/pool_handler.go +++ b/pool_handler.go @@ -1,4 +1,4 @@ -package overflow_grpc_pool +package grpc_pool import ( "time" diff --git a/pool_handlers.go b/pool_handlers.go index c015b4d..f44e7b8 100644 --- a/pool_handlers.go +++ b/pool_handlers.go @@ -1,6 +1,7 @@ -package overflow_grpc_pool +package grpc_pool import ( + "fmt" "time" "google.golang.org/grpc" @@ -13,30 +14,30 @@ type PoolHandlers struct { MaxCapacity int } -func (h *PoolHandlers) Dial() (*grpc.ClientConn, interface{}, error) { - return nil, nil, nil +func (ph *PoolHandlers) Dial() (*grpc.ClientConn, interface{}, error) { + return nil, nil, fmt.Errorf("GRPC Pool: Dial method is not implemented") } -func (h *PoolHandlers) GetIdleTimeout() time.Duration { - return h.IdleTimeout +func (ph *PoolHandlers) GetIdleTimeout() time.Duration { + return ph.IdleTimeout } -func (h *PoolHandlers) GetMaxIdle() int { - return h.MaxIdle +func (ph *PoolHandlers) GetMaxIdle() int { + return ph.MaxIdle } -func (h *PoolHandlers) GetMaxCapacity() int { - return h.MaxCapacity +func (ph *PoolHandlers) GetMaxCapacity() int { + return ph.MaxCapacity } // Validate validates the configuration -func (o *PoolHandlers) Validate() { - if o.IdleTimeout < 0 { - o.IdleTimeout = DefaultIdleTimeout +func (ph *PoolHandlers) Validate() { + if ph.IdleTimeout < 0 { + ph.IdleTimeout = DefaultIdleTimeout } - if o.MaxIdle < 0 { - o.MaxIdle = DefaultMaxIdle + if ph.MaxIdle < 0 { + ph.MaxIdle = DefaultMaxIdle } - if o.MaxCapacity <= 0 { - o.MaxCapacity = DefaultMaxCapacity + if ph.MaxCapacity <= 0 { + ph.MaxCapacity = DefaultMaxCapacity } }