Skip to content

Commit

Permalink
gorums.WithDialTimeout no longer has any effect and can be removed
Browse files Browse the repository at this point in the history
  • Loading branch information
abjeni committed Jan 7, 2025
1 parent dde5c0e commit f134d48
Show file tree
Hide file tree
Showing 15 changed files with 10 additions and 38 deletions.
1 change: 0 additions & 1 deletion cmd/benchmark/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ func main() {
gorums.WithGrpcDialOptions(
grpc.WithTransportCredentials(insecure.NewCredentials()),
),
gorums.WithDialTimeout(10 * time.Second),
gorums.WithSendBufferSize(*sendBuffer),
}

Expand Down
2 changes: 0 additions & 2 deletions doc/user-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ import (

func ExampleStorageClient() {
mgr := NewManager(
gorums.WithDialTimeout(500*time.Millisecond),
gorums.WithGrpcDialOptions(
grpc.WithTransportCredentials(insecure.NewCredentials()),
),
Expand Down Expand Up @@ -403,7 +402,6 @@ func ExampleStorageClient() {
}

mgr := NewManager(
gorums.WithDialTimeout(50*time.Millisecond),
gorums.WithGrpcDialOptions(
grpc.WithTransportCredentials(insecure.NewCredentials()),
),
Expand Down
2 changes: 0 additions & 2 deletions examples/storage/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

import (
"log"
"time"

"github.com/relab/gorums"
"github.com/relab/gorums/examples/storage/proto"
Expand All @@ -17,7 +16,6 @@ func runClient(addresses []string) {

// init gorums manager
mgr := proto.NewManager(
gorums.WithDialTimeout(1*time.Second),
gorums.WithGrpcDialOptions(
grpc.WithTransportCredentials(insecure.NewCredentials()), // disable TLS
),
Expand Down
2 changes: 0 additions & 2 deletions mgr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"log"
"testing"
"time"

"github.com/relab/gorums"
"github.com/relab/gorums/tests/dummy"
Expand Down Expand Up @@ -73,7 +72,6 @@ func TestManagerAddNodeWithConn(t *testing.T) {
})
defer teardown()
mgr := gorums.NewRawManager(
gorums.WithDialTimeout(100*time.Millisecond),
gorums.WithGrpcDialOptions(
grpc.WithTransportCredentials(insecure.NewCredentials()),
),
Expand Down
24 changes: 10 additions & 14 deletions opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,19 @@ import (
)

type managerOptions struct {
grpcDialOpts []grpc.DialOption
nodeDialTimeout time.Duration
logger *log.Logger
noConnect bool
backoff backoff.Config
sendBuffer uint
metadata metadata.MD
perNodeMD func(uint32) metadata.MD
grpcDialOpts []grpc.DialOption
logger *log.Logger
noConnect bool
backoff backoff.Config
sendBuffer uint
metadata metadata.MD
perNodeMD func(uint32) metadata.MD
}

func newManagerOptions() managerOptions {
return managerOptions{
backoff: backoff.DefaultConfig,
sendBuffer: 0,
nodeDialTimeout: 50 * time.Millisecond,
backoff: backoff.DefaultConfig,
sendBuffer: 0,
}
}

Expand All @@ -34,9 +32,7 @@ type ManagerOption func(*managerOptions)
// WithDialTimeout returns a ManagerOption which is used to set the dial
// context timeout to be used when initially connecting to each node in its pool.
func WithDialTimeout(timeout time.Duration) ManagerOption {
return func(o *managerOptions) {
o.nodeDialTimeout = timeout
}
return func(o *managerOptions) {}
}

// WithGrpcDialOptions returns a ManagerOption which sets any gRPC dial options
Expand Down
1 change: 0 additions & 1 deletion rpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ func initServer() *gorums.Server {

func gorumsTestMgr() *dummy.Manager {
mgr := dummy.NewManager(
gorums.WithDialTimeout(time.Second),
gorums.WithGrpcDialOptions(
grpc.WithTransportCredentials(insecure.NewCredentials()),
),
Expand Down
1 change: 0 additions & 1 deletion server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ func TestServerCallback(t *testing.T) {
md := metadata.New(map[string]string{"message": "hello"})

mgr := gorums.NewRawManager(
gorums.WithDialTimeout(time.Second),
gorums.WithMetadata(md),
gorums.WithGrpcDialOptions(
grpc.WithTransportCredentials(insecure.NewCredentials()),
Expand Down
2 changes: 0 additions & 2 deletions tests/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
fmt "fmt"
"testing"
"time"

gorums "github.com/relab/gorums"
"google.golang.org/grpc"
Expand Down Expand Up @@ -86,7 +85,6 @@ func TestConfig(t *testing.T) {
}
}
mgr := NewManager(
gorums.WithDialTimeout(100*time.Millisecond),
gorums.WithGrpcDialOptions(
grpc.WithTransportCredentials(insecure.NewCredentials()),
),
Expand Down
1 change: 0 additions & 1 deletion tests/correctable/correctable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ func run(t *testing.T, n int, div int, corr func(context.Context, *Configuration
defer teardown()

mgr := NewManager(
gorums.WithDialTimeout(time.Second),
gorums.WithGrpcDialOptions(
grpc.WithTransportCredentials(insecure.NewCredentials()),
),
Expand Down
4 changes: 0 additions & 4 deletions tests/metadata/metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"strconv"
"testing"
"time"

"github.com/relab/gorums"
"google.golang.org/grpc"
Expand Down Expand Up @@ -61,7 +60,6 @@ func TestMetadata(t *testing.T) {

mgr := NewManager(
gorums.WithMetadata(md),
gorums.WithDialTimeout(time.Second),
gorums.WithGrpcDialOptions(
grpc.WithTransportCredentials(insecure.NewCredentials()),
),
Expand Down Expand Up @@ -94,7 +92,6 @@ func TestPerNodeMetadata(t *testing.T) {

mgr := NewManager(
gorums.WithPerNodeMetadata(perNodeMD),
gorums.WithDialTimeout(time.Second),
gorums.WithGrpcDialOptions(
grpc.WithTransportCredentials(insecure.NewCredentials()),
),
Expand All @@ -121,7 +118,6 @@ func TestCanGetPeerInfo(t *testing.T) {
defer teardown()

mgr := NewManager(
gorums.WithDialTimeout(time.Second),
gorums.WithGrpcDialOptions(
grpc.WithTransportCredentials(insecure.NewCredentials()),
),
Expand Down
2 changes: 0 additions & 2 deletions tests/oneway/oneway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"sync"
"testing"
"time"

"github.com/relab/gorums"
"github.com/relab/gorums/tests/oneway"
Expand Down Expand Up @@ -63,7 +62,6 @@ func setup(t testing.TB, cfgSize int) (cfg *oneway.Configuration, srvs []*oneway
}

mgr := oneway.NewManager(
gorums.WithDialTimeout(100*time.Millisecond),
gorums.WithGrpcDialOptions(
grpc.WithTransportCredentials(insecure.NewCredentials()),
),
Expand Down
1 change: 0 additions & 1 deletion tests/ordering/order_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ func setup(t *testing.T, cfgSize int) (cfg *Configuration, teardown func()) {
return srv
})
mgr := NewManager(
gorums.WithDialTimeout(100*time.Millisecond),
gorums.WithGrpcDialOptions(
grpc.WithTransportCredentials(insecure.NewCredentials()),
),
Expand Down
2 changes: 0 additions & 2 deletions tests/qf/qf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"fmt"
"testing"
"time"

"github.com/relab/gorums"
"google.golang.org/grpc"
Expand Down Expand Up @@ -196,7 +195,6 @@ func BenchmarkFullStackQF(b *testing.B) {
return srv
})
mgr := NewManager(
gorums.WithDialTimeout(10*time.Second),
gorums.WithGrpcDialOptions(
grpc.WithTransportCredentials(insecure.NewCredentials()),
),
Expand Down
2 changes: 0 additions & 2 deletions tests/tls/tls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"crypto/tls"
"crypto/x509"
"testing"
"time"

"github.com/relab/gorums"
"google.golang.org/grpc"
Expand Down Expand Up @@ -47,7 +46,6 @@ func TestTLS(t *testing.T) {
defer teardown()

mgr := NewManager(
gorums.WithDialTimeout(100*time.Millisecond),
gorums.WithGrpcDialOptions(
grpc.WithTransportCredentials(credentials.NewClientTLSFromCert(cp, "")),
),
Expand Down
1 change: 0 additions & 1 deletion tests/unresponsive/unreponsive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ func TestUnresponsive(t *testing.T) {
defer teardown()

mgr := NewManager(
gorums.WithDialTimeout(100*time.Millisecond),
gorums.WithGrpcDialOptions(
grpc.WithTransportCredentials(insecure.NewCredentials()),
),
Expand Down

0 comments on commit f134d48

Please sign in to comment.