From 7cfe91fac75a97113941ecc53fd17c90bf50da87 Mon Sep 17 00:00:00 2001 From: Angira Kekteeva Date: Tue, 25 May 2021 14:46:58 +0300 Subject: [PATCH] [#4] pool: Rename exported structs in pool pkg Renamed PoolBuilderOptions to BuilderOptions and PoolBuilder to Builder because usages of them with prefix pool.* in other packages stutter. Signed-off-by: Angira Kekteeva --- pkg/pool/pool.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/pool/pool.go b/pkg/pool/pool.go index 3422f75..7dd1221 100644 --- a/pkg/pool/pool.go +++ b/pkg/pool/pool.go @@ -15,8 +15,8 @@ import ( "google.golang.org/grpc/keepalive" ) -// PoolBuilderOptions contains options used to build connection pool. -type PoolBuilderOptions struct { +// BuilderOptions contains options used to build connection pool. +type BuilderOptions struct { Key *ecdsa.PrivateKey NodeConnectionTimeout time.Duration NodeRequestTimeout time.Duration @@ -29,22 +29,22 @@ type PoolBuilderOptions struct { connections []*grpc.ClientConn } -// PoolBuilder is an interim structure used to collect node addresses/weights and +// Builder is an interim structure used to collect node addresses/weights and // build connection pool subsequently. -type PoolBuilder struct { +type Builder struct { addresses []string weights []float64 } // AddNode adds address/weight pair to node PoolBuilder list. -func (pb *PoolBuilder) AddNode(address string, weight float64) *PoolBuilder { +func (pb *Builder) AddNode(address string, weight float64) *Builder { pb.addresses = append(pb.addresses, address) pb.weights = append(pb.weights, weight) return pb } // Build creates new pool based on current PoolBuilder state and options. -func (pb *PoolBuilder) Build(ctx context.Context, options *PoolBuilderOptions) (Pool, error) { +func (pb *Builder) Build(ctx context.Context, options *BuilderOptions) (Pool, error) { if len(pb.addresses) == 0 { return nil, errors.New("no NeoFS peers configured") } @@ -97,7 +97,7 @@ type pool struct { clientPacks []*clientPack } -func new(ctx context.Context, options *PoolBuilderOptions) (Pool, error) { +func new(ctx context.Context, options *BuilderOptions) (Pool, error) { clientPacks := make([]*clientPack, len(options.weights)) for i, con := range options.connections { c, err := client.New(client.WithDefaultPrivateKey(options.Key), client.WithGRPCConnection(con))