From b05d133b200e582a15e5ccebce41da43fed7472c Mon Sep 17 00:00:00 2001 From: Hein Meling Date: Tue, 19 Mar 2024 23:02:19 +0100 Subject: [PATCH 01/10] chore: update dependencies --- examples/go.mod | 20 ++++++++++---------- examples/go.sum | 41 ++++++++++++++++++----------------------- go.mod | 16 ++++++++-------- go.sum | 16 ++++++++++++++++ 4 files changed, 52 insertions(+), 41 deletions(-) diff --git a/examples/go.mod b/examples/go.mod index ac9416c2..e2fe9325 100644 --- a/examples/go.mod +++ b/examples/go.mod @@ -1,24 +1,24 @@ module github.com/relab/gorums/examples -go 1.21 +go 1.22 require ( github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 github.com/relab/gorums v0.7.0 - golang.org/x/term v0.16.0 - google.golang.org/grpc v1.61.0 - google.golang.org/protobuf v1.32.0 + golang.org/x/term v0.18.0 + google.golang.org/grpc v1.62.1 + google.golang.org/protobuf v1.33.0 ) require ( - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/google/go-cmp v0.6.0 // indirect - golang.org/x/mod v0.14.0 // indirect - golang.org/x/net v0.20.0 // indirect - golang.org/x/sys v0.16.0 // indirect + golang.org/x/mod v0.16.0 // indirect + golang.org/x/net v0.22.0 // indirect + golang.org/x/sys v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect - golang.org/x/tools v0.17.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe // indirect + golang.org/x/tools v0.19.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 // indirect ) diff --git a/examples/go.sum b/examples/go.sum index 84864bdd..48e13940 100644 --- a/examples/go.sum +++ b/examples/go.sum @@ -1,33 +1,28 @@ -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= -golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= -golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= -golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/mod v0.16.0 h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic= +golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE= -golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= +golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= -golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe h1:bQnxqljG/wqi4NTXu2+DJ3n7APcEA882QZ1JvhQAq9o= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe/go.mod h1:PAREbraiVEVGVdTZsVWjSbbTtSyGbAgIIvni8a8CD5s= -google.golang.org/grpc v1.61.0 h1:TOvOcuXn30kRao+gfcvsebNEa5iZIiLkisYEkf7R7o0= -google.golang.org/grpc v1.61.0/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= +golang.org/x/tools v0.19.0 h1:tfGCXNR1OsFG+sVdLAitlpjAvD/I6dHDKnYrpEZUHkw= +golang.org/x/tools v0.19.0/go.mod h1:qoJWxmGSIBmAeriMx19ogtrEPrGtDbPK634QFIcLAhc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 h1:NnYq6UN9ReLM9/Y01KWNOWyI5xQ9kbIms5GGJVwS/Yc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 h1:rNBFJjBCOgVr9pWD7rs/knKL4FRTKgpZmsRfV214zcA= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0/go.mod h1:Dk1tviKTvMCz5tvh7t+fh94dhmQVHuCt2OzJB3CTW9Y= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= diff --git a/go.mod b/go.mod index 5f87ddc6..1f61ee64 100644 --- a/go.mod +++ b/go.mod @@ -5,17 +5,17 @@ go 1.22 require ( github.com/google/go-cmp v0.6.0 golang.org/x/sync v0.6.0 - golang.org/x/tools v0.18.0 - google.golang.org/genproto/googleapis/rpc v0.0.0-20240205150955-31a09d347014 - google.golang.org/grpc v1.61.0 + golang.org/x/tools v0.19.0 + google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 + google.golang.org/grpc v1.62.1 google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 - google.golang.org/protobuf v1.32.0 + google.golang.org/protobuf v1.33.0 ) require ( - github.com/golang/protobuf v1.5.3 // indirect - golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.21.0 // indirect - golang.org/x/sys v0.17.0 // indirect + github.com/golang/protobuf v1.5.4 // indirect + golang.org/x/mod v0.16.0 // indirect + golang.org/x/net v0.22.0 // indirect + golang.org/x/sys v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect ) diff --git a/go.sum b/go.sum index 2699dca9..655e0267 100644 --- a/go.sum +++ b/go.sum @@ -1,29 +1,45 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8= golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.16.0 h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic= +golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ= golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg= +golang.org/x/tools v0.19.0 h1:tfGCXNR1OsFG+sVdLAitlpjAvD/I6dHDKnYrpEZUHkw= +golang.org/x/tools v0.19.0/go.mod h1:qoJWxmGSIBmAeriMx19ogtrEPrGtDbPK634QFIcLAhc= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240205150955-31a09d347014 h1:FSL3lRCkhaPFxqi0s9o+V4UI2WTzAVOvkgbd4kVV4Wg= google.golang.org/genproto/googleapis/rpc v0.0.0-20240205150955-31a09d347014/go.mod h1:SaPjaZGWb0lPqs6Ittu0spdfrOArqji4ZdeP5IC/9N4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 h1:NnYq6UN9ReLM9/Y01KWNOWyI5xQ9kbIms5GGJVwS/Yc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= google.golang.org/grpc v1.61.0 h1:TOvOcuXn30kRao+gfcvsebNEa5iZIiLkisYEkf7R7o0= google.golang.org/grpc v1.61.0/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 h1:rNBFJjBCOgVr9pWD7rs/knKL4FRTKgpZmsRfV214zcA= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0/go.mod h1:Dk1tviKTvMCz5tvh7t+fh94dhmQVHuCt2OzJB3CTW9Y= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= From 907a8e7130624aa5039575bd856a7e1f6077ff80 Mon Sep 17 00:00:00 2001 From: Hein Meling Date: Sat, 23 Mar 2024 13:02:49 +0100 Subject: [PATCH 02/10] chore: simplified configuration error Renamed ConfigurationCreationError to just configurationError. Also, removed configuration error from some parts since the configuration error does not provide additional context; in fact it often just repeats the same information in the error output. --- .vscode/gorums.txt | 1 + config.go | 6 +----- config_opts.go | 22 ++++++++++------------ errors.go | 7 +++---- mgr.go | 6 +++--- mgr_test.go | 4 ++-- node.go | 4 ++-- 7 files changed, 22 insertions(+), 28 deletions(-) diff --git a/.vscode/gorums.txt b/.vscode/gorums.txt index e129b217..9034ce30 100644 --- a/.vscode/gorums.txt +++ b/.vscode/gorums.txt @@ -43,6 +43,7 @@ Meland's Meling memprofile multicast +naddr obj's Paxos Pedersen diff --git a/config.go b/config.go index 15a569ef..ef7c1c6b 100644 --- a/config.go +++ b/config.go @@ -1,9 +1,5 @@ package gorums -import ( - "fmt" -) - // RawConfiguration represents a static set of nodes on which quorum calls may be invoked. // // NOTE: mutating the configuration is not supported. @@ -18,7 +14,7 @@ type RawConfiguration []*RawNode // using the And, WithNewNodes, Except, and WithoutNodes methods. func NewRawConfiguration(mgr *RawManager, opt NodeListOption) (nodes RawConfiguration, err error) { if opt == nil { - return nil, ConfigCreationError(fmt.Errorf("missing required node list")) + return nil, configurationError("missing required node list") } return opt.newConfig(mgr) } diff --git a/config_opts.go b/config_opts.go index 155e586a..f1124cd0 100644 --- a/config_opts.go +++ b/config_opts.go @@ -17,7 +17,7 @@ type nodeIDMap struct { func (o nodeIDMap) newConfig(mgr *RawManager) (nodes RawConfiguration, err error) { if len(o.idMap) == 0 { - return nil, ConfigCreationError(fmt.Errorf("node-to-ID map required: WithNodeMap")) + return nil, configurationError("missing required node map") } nodes = make(RawConfiguration, 0, len(o.idMap)) for naddr, id := range o.idMap { @@ -25,11 +25,10 @@ func (o nodeIDMap) newConfig(mgr *RawManager) (nodes RawConfiguration, err error if !found { node, err = NewRawNodeWithID(naddr, id) if err != nil { - return nil, ConfigCreationError(err) + return nil, err } - err = mgr.AddNode(node) - if err != nil { - return nil, ConfigCreationError(err) + if err = mgr.AddNode(node); err != nil { + return nil, err } } nodes = append(nodes, node) @@ -52,18 +51,17 @@ type nodeList struct { func (o nodeList) newConfig(mgr *RawManager) (nodes RawConfiguration, err error) { if len(o.addrsList) == 0 { - return nil, ConfigCreationError(fmt.Errorf("node addresses required: WithNodeList")) + return nil, configurationError("missing required node addresses") } nodes = make(RawConfiguration, 0, len(o.addrsList)) for _, naddr := range o.addrsList { node, err := NewRawNode(naddr) if err != nil { - return nil, ConfigCreationError(err) + return nil, err } if n, found := mgr.Node(node.ID()); !found { - err = mgr.AddNode(node) - if err != nil { - return nil, ConfigCreationError(err) + if err = mgr.AddNode(node); err != nil { + return nil, err } } else { node = n @@ -88,14 +86,14 @@ type nodeIDs struct { func (o nodeIDs) newConfig(mgr *RawManager) (nodes RawConfiguration, err error) { if len(o.nodeIDs) == 0 { - return nil, ConfigCreationError(fmt.Errorf("node IDs required: WithNodeIDs")) + return nil, configurationError("missing required node IDs") } nodes = make(RawConfiguration, 0, len(o.nodeIDs)) for _, id := range o.nodeIDs { node, found := mgr.Node(id) if !found { // Node IDs must have been registered previously - return nil, ConfigCreationError(fmt.Errorf("node ID %d not found", id)) + return nil, configurationError(fmt.Sprintf("node %d not found", id)) } nodes = append(nodes, node) } diff --git a/errors.go b/errors.go index b5656a30..6ec57b53 100644 --- a/errors.go +++ b/errors.go @@ -5,10 +5,9 @@ import ( "fmt" ) -// ConfigCreationError returns an error reporting that a Configuration -// could not be created due to err. -func ConfigCreationError(err error) error { - return fmt.Errorf("could not create configuration: %s", err.Error()) +// configurationError reports that a Configuration could not be created. +func configurationError(desc string) error { + return fmt.Errorf("configuration: %s", desc) } // A QuorumCallError is used to report that a quorum call failed. diff --git a/mgr.go b/mgr.go index 8097fe48..ff571317 100644 --- a/mgr.go +++ b/mgr.go @@ -113,13 +113,13 @@ func (m *RawManager) Size() (nodes int) { func (m *RawManager) AddNode(node *RawNode) error { if _, found := m.Node(node.ID()); found { // Node IDs must be unique - return fmt.Errorf("node ID %d already exists (%s)", node.ID(), node.Address()) + return configurationError(fmt.Sprintf("node %d (%s) already exists", node.ID(), node.Address())) } if m.logger != nil { - m.logger.Printf("connecting to %s with id %d\n", node, node.id) + m.logger.Printf("Connecting to %s with id %d\n", node, node.id) } if err := node.connect(m); err != nil { - return fmt.Errorf("connection failed for %s: %w", node, err) + return err } m.mu.Lock() diff --git a/mgr_test.go b/mgr_test.go index 8fff847e..b3f96662 100644 --- a/mgr_test.go +++ b/mgr_test.go @@ -41,10 +41,10 @@ func TestManagerAddNode(t *testing.T) { id uint32 err string }{ - {"127.0.1.1:1234", 1, "node ID 1 already exists (127.0.1.1:1234)"}, + {"127.0.1.1:1234", 1, "configuration: node 1 (127.0.1.1:1234) already exists"}, {"127.0.1.1:1234", 5, ""}, {"127.0.1.1:1234", 6, ""}, // TODO(meling) does it make sense to allow same addr:port for different IDs? - {"127.0.1.1:1234", 2, "node ID 2 already exists (127.0.1.1:1234)"}, + {"127.0.1.1:1234", 2, "configuration: node 2 (127.0.1.1:1234) already exists"}, } for _, test := range tests { node, err := gorums.NewRawNodeWithID(test.addr, test.id) diff --git a/node.go b/node.go index a7914d44..83b43449 100644 --- a/node.go +++ b/node.go @@ -36,7 +36,7 @@ type RawNode struct { func NewRawNode(addr string) (*RawNode, error) { tcpAddr, err := net.ResolveTCPAddr("tcp", addr) if err != nil { - return nil, fmt.Errorf("node error: '%s' error: %v", addr, err) + return nil, err } h := fnv.New32a() _, _ = h.Write([]byte(tcpAddr.String())) @@ -50,7 +50,7 @@ func NewRawNode(addr string) (*RawNode, error) { func NewRawNodeWithID(addr string, id uint32) (*RawNode, error) { tcpAddr, err := net.ResolveTCPAddr("tcp", addr) if err != nil { - return nil, fmt.Errorf("node error: '%s' error: %v", addr, err) + return nil, err } return &RawNode{ id: id, From d0746c947a392df8badff3c1b2d09db107392990 Mon Sep 17 00:00:00 2001 From: Hein Meling Date: Sat, 23 Mar 2024 13:56:52 +0100 Subject: [PATCH 03/10] chore: simplified gorums codec errors --- .vscode/gorums.txt | 3 +++ encoding.go | 10 ++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.vscode/gorums.txt b/.vscode/gorums.txt index 9034ce30..6d249431 100644 --- a/.vscode/gorums.txt +++ b/.vscode/gorums.txt @@ -54,6 +54,8 @@ protoc protogen protoimpl protoreflect +protoregistry +protowire ptypes QCQF qcresult @@ -79,6 +81,7 @@ unicast unmarshal unmarshaled unmarshaling +unmarshals userguide Xeon Zorums diff --git a/encoding.go b/encoding.go index 180fc1c2..a1802d21 100644 --- a/encoding.go +++ b/encoding.go @@ -66,7 +66,7 @@ func (c Codec) Marshal(m interface{}) (b []byte, err error) { case protoreflect.ProtoMessage: return c.marshaler.Marshal(msg) default: - return nil, fmt.Errorf("gorumsCodec: don't know how to marshal message of type '%T'", m) + return nil, fmt.Errorf("gorums: cannot marshal message of type '%T'", m) } } @@ -96,7 +96,7 @@ func (c Codec) Unmarshal(b []byte, m interface{}) (err error) { case protoreflect.ProtoMessage: return c.unmarshaler.Unmarshal(b, msg) default: - return fmt.Errorf("gorumsCodec: don't know how to unmarshal message of type '%T'", m) + return fmt.Errorf("gorums: cannot unmarshal message of type '%T'", m) } } @@ -124,7 +124,7 @@ func (c Codec) gorumsUnmarshal(b []byte, msg *Message) (err error) { case responseType: messageName = methodDesc.Output().FullName() default: - return fmt.Errorf("gorumsCodec: Unknown message type") + return fmt.Errorf("gorums: unknown message type %d", msg.msgType) } // now get the message type from the types registry @@ -136,7 +136,5 @@ func (c Codec) gorumsUnmarshal(b []byte, msg *Message) (err error) { // unmarshal message msgBuf, _ := protowire.ConsumeBytes(b[mdLen:]) - err = c.unmarshaler.Unmarshal(msgBuf, msg.Message) - - return err + return c.unmarshaler.Unmarshal(msgBuf, msg.Message) } From b197cbdf44381046eb36c5db7a038476808549ab Mon Sep 17 00:00:00 2001 From: Hein Meling Date: Sat, 23 Mar 2024 14:49:07 +0100 Subject: [PATCH 04/10] chore: replaced configurationError with direct fmt.Errorf Since configurationError only added a prefix. --- cmd/protoc-gen-gorums/dev/mgr.go | 6 +++--- cmd/protoc-gen-gorums/gengorums/template_static.go | 11 ++++++----- config.go | 4 +++- config_opts.go | 12 +++++++----- errors.go | 5 ----- mgr.go | 2 +- mgr_test.go | 6 +++--- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/cmd/protoc-gen-gorums/dev/mgr.go b/cmd/protoc-gen-gorums/dev/mgr.go index 4fec657d..97023826 100644 --- a/cmd/protoc-gen-gorums/dev/mgr.go +++ b/cmd/protoc-gen-gorums/dev/mgr.go @@ -37,7 +37,7 @@ func NewManager(opts ...gorums.ManagerOption) (mgr *Manager) { // using the And, WithNewNodes, Except, and WithoutNodes methods. func (m *Manager) NewConfiguration(opts ...gorums.ConfigOption) (c *Configuration, err error) { if len(opts) < 1 || len(opts) > 2 { - return nil, fmt.Errorf("wrong number of options: %d", len(opts)) + return nil, fmt.Errorf("config: wrong number of options: %d", len(opts)) } c = &Configuration{} for _, opt := range opts { @@ -51,13 +51,13 @@ func (m *Manager) NewConfiguration(opts ...gorums.ConfigOption) (c *Configuratio // Must be last since v may match QuorumSpec if it is interface{} c.qspec = v default: - return nil, fmt.Errorf("unknown option type: %v", v) + return nil, fmt.Errorf("config: unknown option type: %v", v) } } // return an error if the QuorumSpec interface is not empty and no implementation was provided. var test interface{} = struct{}{} if _, empty := test.(QuorumSpec); !empty && c.qspec == nil { - return nil, fmt.Errorf("missing required QuorumSpec") + return nil, fmt.Errorf("config: missing required QuorumSpec") } return c, nil } diff --git a/cmd/protoc-gen-gorums/gengorums/template_static.go b/cmd/protoc-gen-gorums/gengorums/template_static.go index d5b4999c..8b90c9cf 100644 --- a/cmd/protoc-gen-gorums/gengorums/template_static.go +++ b/cmd/protoc-gen-gorums/gengorums/template_static.go @@ -22,8 +22,9 @@ type Configuration struct { // ConfigurationFromRaw returns a new Configuration from the given raw configuration and QuorumSpec. // // This function may for example be used to "clone" a configuration but install a different QuorumSpec: -// cfg1, err := mgr.NewConfiguration(qspec1, opts...) -// cfg2 := ConfigurationFromRaw(cfg1.RawConfig, qspec2) +// +// cfg1, err := mgr.NewConfiguration(qspec1, opts...) +// cfg2 := ConfigurationFromRaw(cfg1.RawConfig, qspec2) func ConfigurationFromRaw(rawCfg gorums.RawConfiguration, qspec QuorumSpec) *Configuration { // return an error if the QuorumSpec interface is not empty and no implementation was provided. var test interface{} = struct{}{} @@ -91,7 +92,7 @@ func NewManager(opts ...gorums.ManagerOption) (mgr *Manager) { // using the And, WithNewNodes, Except, and WithoutNodes methods. func (m *Manager) NewConfiguration(opts ...gorums.ConfigOption) (c *Configuration, err error) { if len(opts) < 1 || len(opts) > 2 { - return nil, fmt.Errorf("wrong number of options: %d", len(opts)) + return nil, fmt.Errorf("config: wrong number of options: %d", len(opts)) } c = &Configuration{} for _, opt := range opts { @@ -105,13 +106,13 @@ func (m *Manager) NewConfiguration(opts ...gorums.ConfigOption) (c *Configuratio // Must be last since v may match QuorumSpec if it is interface{} c.qspec = v default: - return nil, fmt.Errorf("unknown option type: %v", v) + return nil, fmt.Errorf("config: unknown option type: %v", v) } } // return an error if the QuorumSpec interface is not empty and no implementation was provided. var test interface{} = struct{}{} if _, empty := test.(QuorumSpec); !empty && c.qspec == nil { - return nil, fmt.Errorf("missing required QuorumSpec") + return nil, fmt.Errorf("config: missing required QuorumSpec") } return c, nil } diff --git a/config.go b/config.go index ef7c1c6b..274836be 100644 --- a/config.go +++ b/config.go @@ -1,5 +1,7 @@ package gorums +import "fmt" + // RawConfiguration represents a static set of nodes on which quorum calls may be invoked. // // NOTE: mutating the configuration is not supported. @@ -14,7 +16,7 @@ type RawConfiguration []*RawNode // using the And, WithNewNodes, Except, and WithoutNodes methods. func NewRawConfiguration(mgr *RawManager, opt NodeListOption) (nodes RawConfiguration, err error) { if opt == nil { - return nil, configurationError("missing required node list") + return nil, fmt.Errorf("config: missing required node list") } return opt.newConfig(mgr) } diff --git a/config_opts.go b/config_opts.go index f1124cd0..8a44af80 100644 --- a/config_opts.go +++ b/config_opts.go @@ -1,6 +1,8 @@ package gorums -import "fmt" +import ( + "fmt" +) // ConfigOption is a marker interface for options to NewConfiguration. type ConfigOption interface{} @@ -17,7 +19,7 @@ type nodeIDMap struct { func (o nodeIDMap) newConfig(mgr *RawManager) (nodes RawConfiguration, err error) { if len(o.idMap) == 0 { - return nil, configurationError("missing required node map") + return nil, fmt.Errorf("config: missing required node map") } nodes = make(RawConfiguration, 0, len(o.idMap)) for naddr, id := range o.idMap { @@ -51,7 +53,7 @@ type nodeList struct { func (o nodeList) newConfig(mgr *RawManager) (nodes RawConfiguration, err error) { if len(o.addrsList) == 0 { - return nil, configurationError("missing required node addresses") + return nil, fmt.Errorf("config: missing required node addresses") } nodes = make(RawConfiguration, 0, len(o.addrsList)) for _, naddr := range o.addrsList { @@ -86,14 +88,14 @@ type nodeIDs struct { func (o nodeIDs) newConfig(mgr *RawManager) (nodes RawConfiguration, err error) { if len(o.nodeIDs) == 0 { - return nil, configurationError("missing required node IDs") + return nil, fmt.Errorf("config: missing required node IDs") } nodes = make(RawConfiguration, 0, len(o.nodeIDs)) for _, id := range o.nodeIDs { node, found := mgr.Node(id) if !found { // Node IDs must have been registered previously - return nil, configurationError(fmt.Sprintf("node %d not found", id)) + return nil, fmt.Errorf("config: node %d not found", id) } nodes = append(nodes, node) } diff --git a/errors.go b/errors.go index 6ec57b53..bbbdf52c 100644 --- a/errors.go +++ b/errors.go @@ -5,11 +5,6 @@ import ( "fmt" ) -// configurationError reports that a Configuration could not be created. -func configurationError(desc string) error { - return fmt.Errorf("configuration: %s", desc) -} - // A QuorumCallError is used to report that a quorum call failed. type QuorumCallError struct { Reason string diff --git a/mgr.go b/mgr.go index ff571317..c961c891 100644 --- a/mgr.go +++ b/mgr.go @@ -113,7 +113,7 @@ func (m *RawManager) Size() (nodes int) { func (m *RawManager) AddNode(node *RawNode) error { if _, found := m.Node(node.ID()); found { // Node IDs must be unique - return configurationError(fmt.Sprintf("node %d (%s) already exists", node.ID(), node.Address())) + return fmt.Errorf("config: node %d (%s) already exists", node.ID(), node.Address()) } if m.logger != nil { m.logger.Printf("Connecting to %s with id %d\n", node, node.id) diff --git a/mgr_test.go b/mgr_test.go index b3f96662..0640128d 100644 --- a/mgr_test.go +++ b/mgr_test.go @@ -41,10 +41,10 @@ func TestManagerAddNode(t *testing.T) { id uint32 err string }{ - {"127.0.1.1:1234", 1, "configuration: node 1 (127.0.1.1:1234) already exists"}, + {"127.0.1.1:1234", 1, "config: node 1 (127.0.1.1:1234) already exists"}, {"127.0.1.1:1234", 5, ""}, - {"127.0.1.1:1234", 6, ""}, // TODO(meling) does it make sense to allow same addr:port for different IDs? - {"127.0.1.1:1234", 2, "configuration: node 2 (127.0.1.1:1234) already exists"}, + {"127.0.1.1:1234", 6, ""}, // The same addr:port can have different IDs + {"127.0.1.1:1234", 2, "config: node 2 (127.0.1.1:1234) already exists"}, } for _, test := range tests { node, err := gorums.NewRawNodeWithID(test.addr, test.id) From a1fa819623355e87a54252d850bb45640660af91 Mon Sep 17 00:00:00 2001 From: Hein Meling Date: Sat, 23 Mar 2024 14:55:16 +0100 Subject: [PATCH 05/10] chore: ran make -B to update generated files --- benchmark/benchmark.pb.go | 4 ++-- benchmark/benchmark_gorums.pb.go | 13 +++++++------ cmd/protoc-gen-gorums/dev/zorums.pb.go | 2 +- cmd/protoc-gen-gorums/dev/zorums_async_gorums.pb.go | 2 +- .../dev/zorums_correctable_gorums.pb.go | 2 +- .../dev/zorums_multicast_gorums.pb.go | 2 +- cmd/protoc-gen-gorums/dev/zorums_qspec_gorums.pb.go | 2 +- .../dev/zorums_quorumcall_gorums.pb.go | 2 +- cmd/protoc-gen-gorums/dev/zorums_rpc_gorums.pb.go | 2 +- .../dev/zorums_server_gorums.pb.go | 2 +- cmd/protoc-gen-gorums/dev/zorums_types_gorums.pb.go | 2 +- .../dev/zorums_unicast_gorums.pb.go | 2 +- examples/storage/proto/storage.pb.go | 4 ++-- examples/storage/proto/storage_gorums.pb.go | 13 +++++++------ gorums.pb.go | 4 ++-- internal/correctable/opts.pb.go | 4 ++-- ordering/ordering.pb.go | 4 ++-- ordering/ordering_grpc.pb.go | 10 +++++++--- tests/config/config.pb.go | 4 ++-- tests/config/config_gorums.pb.go | 13 +++++++------ tests/correctable/correctable.pb.go | 4 ++-- tests/correctable/correctable_gorums.pb.go | 13 +++++++------ tests/dummy/dummy.pb.go | 4 ++-- tests/dummy/dummy_gorums.pb.go | 13 +++++++------ tests/metadata/metadata.pb.go | 4 ++-- tests/metadata/metadata_gorums.pb.go | 13 +++++++------ tests/oneway/oneway.pb.go | 4 ++-- tests/oneway/oneway_gorums.pb.go | 13 +++++++------ tests/ordering/order.pb.go | 4 ++-- tests/ordering/order_gorums.pb.go | 13 +++++++------ tests/qf/qf.pb.go | 4 ++-- tests/qf/qf_gorums.pb.go | 13 +++++++------ tests/tls/tls.pb.go | 4 ++-- tests/tls/tls_gorums.pb.go | 13 +++++++------ tests/unresponsive/unresponsive.pb.go | 4 ++-- tests/unresponsive/unresponsive_gorums.pb.go | 13 +++++++------ 36 files changed, 122 insertions(+), 107 deletions(-) diff --git a/benchmark/benchmark.pb.go b/benchmark/benchmark.pb.go index 9effc0c1..d90b3f7d 100644 --- a/benchmark/benchmark.pb.go +++ b/benchmark/benchmark.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.19.2 +// protoc-gen-go v1.31.0 +// protoc v4.25.3 // source: benchmark/benchmark.proto package benchmark diff --git a/benchmark/benchmark_gorums.pb.go b/benchmark/benchmark_gorums.pb.go index 25fcbbad..8987e1b4 100644 --- a/benchmark/benchmark_gorums.pb.go +++ b/benchmark/benchmark_gorums.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gorums. DO NOT EDIT. // versions: // protoc-gen-gorums v0.7.0-devel -// protoc v3.19.2 +// protoc v4.25.3 // source: benchmark/benchmark.proto package benchmark @@ -33,8 +33,9 @@ type Configuration struct { // ConfigurationFromRaw returns a new Configuration from the given raw configuration and QuorumSpec. // // This function may for example be used to "clone" a configuration but install a different QuorumSpec: -// cfg1, err := mgr.NewConfiguration(qspec1, opts...) -// cfg2 := ConfigurationFromRaw(cfg1.RawConfig, qspec2) +// +// cfg1, err := mgr.NewConfiguration(qspec1, opts...) +// cfg2 := ConfigurationFromRaw(cfg1.RawConfig, qspec2) func ConfigurationFromRaw(rawCfg gorums.RawConfiguration, qspec QuorumSpec) *Configuration { // return an error if the QuorumSpec interface is not empty and no implementation was provided. var test interface{} = struct{}{} @@ -102,7 +103,7 @@ func NewManager(opts ...gorums.ManagerOption) (mgr *Manager) { // using the And, WithNewNodes, Except, and WithoutNodes methods. func (m *Manager) NewConfiguration(opts ...gorums.ConfigOption) (c *Configuration, err error) { if len(opts) < 1 || len(opts) > 2 { - return nil, fmt.Errorf("wrong number of options: %d", len(opts)) + return nil, fmt.Errorf("config: wrong number of options: %d", len(opts)) } c = &Configuration{} for _, opt := range opts { @@ -116,13 +117,13 @@ func (m *Manager) NewConfiguration(opts ...gorums.ConfigOption) (c *Configuratio // Must be last since v may match QuorumSpec if it is interface{} c.qspec = v default: - return nil, fmt.Errorf("unknown option type: %v", v) + return nil, fmt.Errorf("config: unknown option type: %v", v) } } // return an error if the QuorumSpec interface is not empty and no implementation was provided. var test interface{} = struct{}{} if _, empty := test.(QuorumSpec); !empty && c.qspec == nil { - return nil, fmt.Errorf("missing required QuorumSpec") + return nil, fmt.Errorf("config: missing required QuorumSpec") } return c, nil } diff --git a/cmd/protoc-gen-gorums/dev/zorums.pb.go b/cmd/protoc-gen-gorums/dev/zorums.pb.go index ee46fc60..0a26492e 100644 --- a/cmd/protoc-gen-gorums/dev/zorums.pb.go +++ b/cmd/protoc-gen-gorums/dev/zorums.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v4.24.4 +// protoc v4.25.3 // source: zorums.proto package dev diff --git a/cmd/protoc-gen-gorums/dev/zorums_async_gorums.pb.go b/cmd/protoc-gen-gorums/dev/zorums_async_gorums.pb.go index a53800e4..a32fcacb 100644 --- a/cmd/protoc-gen-gorums/dev/zorums_async_gorums.pb.go +++ b/cmd/protoc-gen-gorums/dev/zorums_async_gorums.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gorums. DO NOT EDIT. // versions: // protoc-gen-gorums v0.7.0-devel -// protoc v4.24.4 +// protoc v4.25.3 // source: zorums.proto package dev diff --git a/cmd/protoc-gen-gorums/dev/zorums_correctable_gorums.pb.go b/cmd/protoc-gen-gorums/dev/zorums_correctable_gorums.pb.go index 171d056f..5cb8b8f4 100644 --- a/cmd/protoc-gen-gorums/dev/zorums_correctable_gorums.pb.go +++ b/cmd/protoc-gen-gorums/dev/zorums_correctable_gorums.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gorums. DO NOT EDIT. // versions: // protoc-gen-gorums v0.7.0-devel -// protoc v4.24.4 +// protoc v4.25.3 // source: zorums.proto package dev diff --git a/cmd/protoc-gen-gorums/dev/zorums_multicast_gorums.pb.go b/cmd/protoc-gen-gorums/dev/zorums_multicast_gorums.pb.go index d2581bc3..005a7c15 100644 --- a/cmd/protoc-gen-gorums/dev/zorums_multicast_gorums.pb.go +++ b/cmd/protoc-gen-gorums/dev/zorums_multicast_gorums.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gorums. DO NOT EDIT. // versions: // protoc-gen-gorums v0.7.0-devel -// protoc v4.24.4 +// protoc v4.25.3 // source: zorums.proto package dev diff --git a/cmd/protoc-gen-gorums/dev/zorums_qspec_gorums.pb.go b/cmd/protoc-gen-gorums/dev/zorums_qspec_gorums.pb.go index e996362c..6b71a306 100644 --- a/cmd/protoc-gen-gorums/dev/zorums_qspec_gorums.pb.go +++ b/cmd/protoc-gen-gorums/dev/zorums_qspec_gorums.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gorums. DO NOT EDIT. // versions: // protoc-gen-gorums v0.7.0-devel -// protoc v4.24.4 +// protoc v4.25.3 // source: zorums.proto package dev diff --git a/cmd/protoc-gen-gorums/dev/zorums_quorumcall_gorums.pb.go b/cmd/protoc-gen-gorums/dev/zorums_quorumcall_gorums.pb.go index 181b2970..0d4baa37 100644 --- a/cmd/protoc-gen-gorums/dev/zorums_quorumcall_gorums.pb.go +++ b/cmd/protoc-gen-gorums/dev/zorums_quorumcall_gorums.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gorums. DO NOT EDIT. // versions: // protoc-gen-gorums v0.7.0-devel -// protoc v4.24.4 +// protoc v4.25.3 // source: zorums.proto package dev diff --git a/cmd/protoc-gen-gorums/dev/zorums_rpc_gorums.pb.go b/cmd/protoc-gen-gorums/dev/zorums_rpc_gorums.pb.go index b5aff4a2..4e57c69e 100644 --- a/cmd/protoc-gen-gorums/dev/zorums_rpc_gorums.pb.go +++ b/cmd/protoc-gen-gorums/dev/zorums_rpc_gorums.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gorums. DO NOT EDIT. // versions: // protoc-gen-gorums v0.7.0-devel -// protoc v4.24.4 +// protoc v4.25.3 // source: zorums.proto package dev diff --git a/cmd/protoc-gen-gorums/dev/zorums_server_gorums.pb.go b/cmd/protoc-gen-gorums/dev/zorums_server_gorums.pb.go index 4f6bd860..6feaaef2 100644 --- a/cmd/protoc-gen-gorums/dev/zorums_server_gorums.pb.go +++ b/cmd/protoc-gen-gorums/dev/zorums_server_gorums.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gorums. DO NOT EDIT. // versions: // protoc-gen-gorums v0.7.0-devel -// protoc v4.24.4 +// protoc v4.25.3 // source: zorums.proto package dev diff --git a/cmd/protoc-gen-gorums/dev/zorums_types_gorums.pb.go b/cmd/protoc-gen-gorums/dev/zorums_types_gorums.pb.go index 30efcd28..670dc138 100644 --- a/cmd/protoc-gen-gorums/dev/zorums_types_gorums.pb.go +++ b/cmd/protoc-gen-gorums/dev/zorums_types_gorums.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gorums. DO NOT EDIT. // versions: // protoc-gen-gorums v0.7.0-devel -// protoc v4.24.4 +// protoc v4.25.3 // source: zorums.proto package dev diff --git a/cmd/protoc-gen-gorums/dev/zorums_unicast_gorums.pb.go b/cmd/protoc-gen-gorums/dev/zorums_unicast_gorums.pb.go index 9ad1ee1e..0d9b4b33 100644 --- a/cmd/protoc-gen-gorums/dev/zorums_unicast_gorums.pb.go +++ b/cmd/protoc-gen-gorums/dev/zorums_unicast_gorums.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gorums. DO NOT EDIT. // versions: // protoc-gen-gorums v0.7.0-devel -// protoc v4.24.4 +// protoc v4.25.3 // source: zorums.proto package dev diff --git a/examples/storage/proto/storage.pb.go b/examples/storage/proto/storage.pb.go index 2bed060f..7a42e148 100644 --- a/examples/storage/proto/storage.pb.go +++ b/examples/storage/proto/storage.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.19.2 +// protoc-gen-go v1.33.0 +// protoc v4.25.3 // source: storage/proto/storage.proto package proto diff --git a/examples/storage/proto/storage_gorums.pb.go b/examples/storage/proto/storage_gorums.pb.go index 1ed07100..cdbf7cf8 100644 --- a/examples/storage/proto/storage_gorums.pb.go +++ b/examples/storage/proto/storage_gorums.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gorums. DO NOT EDIT. // versions: // protoc-gen-gorums v0.7.0-devel -// protoc v3.19.2 +// protoc v4.25.3 // source: storage/proto/storage.proto package proto @@ -33,8 +33,9 @@ type Configuration struct { // ConfigurationFromRaw returns a new Configuration from the given raw configuration and QuorumSpec. // // This function may for example be used to "clone" a configuration but install a different QuorumSpec: -// cfg1, err := mgr.NewConfiguration(qspec1, opts...) -// cfg2 := ConfigurationFromRaw(cfg1.RawConfig, qspec2) +// +// cfg1, err := mgr.NewConfiguration(qspec1, opts...) +// cfg2 := ConfigurationFromRaw(cfg1.RawConfig, qspec2) func ConfigurationFromRaw(rawCfg gorums.RawConfiguration, qspec QuorumSpec) *Configuration { // return an error if the QuorumSpec interface is not empty and no implementation was provided. var test interface{} = struct{}{} @@ -102,7 +103,7 @@ func NewManager(opts ...gorums.ManagerOption) (mgr *Manager) { // using the And, WithNewNodes, Except, and WithoutNodes methods. func (m *Manager) NewConfiguration(opts ...gorums.ConfigOption) (c *Configuration, err error) { if len(opts) < 1 || len(opts) > 2 { - return nil, fmt.Errorf("wrong number of options: %d", len(opts)) + return nil, fmt.Errorf("config: wrong number of options: %d", len(opts)) } c = &Configuration{} for _, opt := range opts { @@ -116,13 +117,13 @@ func (m *Manager) NewConfiguration(opts ...gorums.ConfigOption) (c *Configuratio // Must be last since v may match QuorumSpec if it is interface{} c.qspec = v default: - return nil, fmt.Errorf("unknown option type: %v", v) + return nil, fmt.Errorf("config: unknown option type: %v", v) } } // return an error if the QuorumSpec interface is not empty and no implementation was provided. var test interface{} = struct{}{} if _, empty := test.(QuorumSpec); !empty && c.qspec == nil { - return nil, fmt.Errorf("missing required QuorumSpec") + return nil, fmt.Errorf("config: missing required QuorumSpec") } return c, nil } diff --git a/gorums.pb.go b/gorums.pb.go index 78befb0a..8840b0ac 100644 --- a/gorums.pb.go +++ b/gorums.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.19.2 +// protoc-gen-go v1.31.0 +// protoc v4.25.3 // source: gorums.proto package gorums diff --git a/internal/correctable/opts.pb.go b/internal/correctable/opts.pb.go index eef54eae..f1184a1e 100644 --- a/internal/correctable/opts.pb.go +++ b/internal/correctable/opts.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.19.2 +// protoc-gen-go v1.31.0 +// protoc v4.25.3 // source: internal/correctable/opts.proto package correctable diff --git a/ordering/ordering.pb.go b/ordering/ordering.pb.go index eb33acd5..da0af6c4 100644 --- a/ordering/ordering.pb.go +++ b/ordering/ordering.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.19.2 +// protoc-gen-go v1.31.0 +// protoc v4.25.3 // source: ordering/ordering.proto package ordering diff --git a/ordering/ordering_grpc.pb.go b/ordering/ordering_grpc.pb.go index 15e595b5..2a1bdb4f 100644 --- a/ordering/ordering_grpc.pb.go +++ b/ordering/ordering_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.2.0 -// - protoc v3.19.2 +// - protoc-gen-go-grpc v1.3.0 +// - protoc v4.25.3 // source: ordering/ordering.proto package ordering @@ -18,6 +18,10 @@ import ( // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 +const ( + Gorums_NodeStream_FullMethodName = "/ordering.Gorums/NodeStream" +) + // GorumsClient is the client API for Gorums service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. @@ -37,7 +41,7 @@ func NewGorumsClient(cc grpc.ClientConnInterface) GorumsClient { } func (c *gorumsClient) NodeStream(ctx context.Context, opts ...grpc.CallOption) (Gorums_NodeStreamClient, error) { - stream, err := c.cc.NewStream(ctx, &Gorums_ServiceDesc.Streams[0], "/ordering.Gorums/NodeStream", opts...) + stream, err := c.cc.NewStream(ctx, &Gorums_ServiceDesc.Streams[0], Gorums_NodeStream_FullMethodName, opts...) if err != nil { return nil, err } diff --git a/tests/config/config.pb.go b/tests/config/config.pb.go index b5d74dda..9425484a 100644 --- a/tests/config/config.pb.go +++ b/tests/config/config.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.19.2 +// protoc-gen-go v1.31.0 +// protoc v4.25.3 // source: config/config.proto package config diff --git a/tests/config/config_gorums.pb.go b/tests/config/config_gorums.pb.go index 915eaa55..2f93b875 100644 --- a/tests/config/config_gorums.pb.go +++ b/tests/config/config_gorums.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gorums. DO NOT EDIT. // versions: // protoc-gen-gorums v0.7.0-devel -// protoc v3.19.2 +// protoc v4.25.3 // source: config/config.proto package config @@ -32,8 +32,9 @@ type Configuration struct { // ConfigurationFromRaw returns a new Configuration from the given raw configuration and QuorumSpec. // // This function may for example be used to "clone" a configuration but install a different QuorumSpec: -// cfg1, err := mgr.NewConfiguration(qspec1, opts...) -// cfg2 := ConfigurationFromRaw(cfg1.RawConfig, qspec2) +// +// cfg1, err := mgr.NewConfiguration(qspec1, opts...) +// cfg2 := ConfigurationFromRaw(cfg1.RawConfig, qspec2) func ConfigurationFromRaw(rawCfg gorums.RawConfiguration, qspec QuorumSpec) *Configuration { // return an error if the QuorumSpec interface is not empty and no implementation was provided. var test interface{} = struct{}{} @@ -101,7 +102,7 @@ func NewManager(opts ...gorums.ManagerOption) (mgr *Manager) { // using the And, WithNewNodes, Except, and WithoutNodes methods. func (m *Manager) NewConfiguration(opts ...gorums.ConfigOption) (c *Configuration, err error) { if len(opts) < 1 || len(opts) > 2 { - return nil, fmt.Errorf("wrong number of options: %d", len(opts)) + return nil, fmt.Errorf("config: wrong number of options: %d", len(opts)) } c = &Configuration{} for _, opt := range opts { @@ -115,13 +116,13 @@ func (m *Manager) NewConfiguration(opts ...gorums.ConfigOption) (c *Configuratio // Must be last since v may match QuorumSpec if it is interface{} c.qspec = v default: - return nil, fmt.Errorf("unknown option type: %v", v) + return nil, fmt.Errorf("config: unknown option type: %v", v) } } // return an error if the QuorumSpec interface is not empty and no implementation was provided. var test interface{} = struct{}{} if _, empty := test.(QuorumSpec); !empty && c.qspec == nil { - return nil, fmt.Errorf("missing required QuorumSpec") + return nil, fmt.Errorf("config: missing required QuorumSpec") } return c, nil } diff --git a/tests/correctable/correctable.pb.go b/tests/correctable/correctable.pb.go index 98fca4bc..6c206f67 100644 --- a/tests/correctable/correctable.pb.go +++ b/tests/correctable/correctable.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.19.2 +// protoc-gen-go v1.31.0 +// protoc v4.25.3 // source: correctable/correctable.proto package correctable diff --git a/tests/correctable/correctable_gorums.pb.go b/tests/correctable/correctable_gorums.pb.go index 736409fe..a9f81a2a 100644 --- a/tests/correctable/correctable_gorums.pb.go +++ b/tests/correctable/correctable_gorums.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gorums. DO NOT EDIT. // versions: // protoc-gen-gorums v0.7.0-devel -// protoc v3.19.2 +// protoc v4.25.3 // source: correctable/correctable.proto package correctable @@ -34,8 +34,9 @@ type Configuration struct { // ConfigurationFromRaw returns a new Configuration from the given raw configuration and QuorumSpec. // // This function may for example be used to "clone" a configuration but install a different QuorumSpec: -// cfg1, err := mgr.NewConfiguration(qspec1, opts...) -// cfg2 := ConfigurationFromRaw(cfg1.RawConfig, qspec2) +// +// cfg1, err := mgr.NewConfiguration(qspec1, opts...) +// cfg2 := ConfigurationFromRaw(cfg1.RawConfig, qspec2) func ConfigurationFromRaw(rawCfg gorums.RawConfiguration, qspec QuorumSpec) *Configuration { // return an error if the QuorumSpec interface is not empty and no implementation was provided. var test interface{} = struct{}{} @@ -103,7 +104,7 @@ func NewManager(opts ...gorums.ManagerOption) (mgr *Manager) { // using the And, WithNewNodes, Except, and WithoutNodes methods. func (m *Manager) NewConfiguration(opts ...gorums.ConfigOption) (c *Configuration, err error) { if len(opts) < 1 || len(opts) > 2 { - return nil, fmt.Errorf("wrong number of options: %d", len(opts)) + return nil, fmt.Errorf("config: wrong number of options: %d", len(opts)) } c = &Configuration{} for _, opt := range opts { @@ -117,13 +118,13 @@ func (m *Manager) NewConfiguration(opts ...gorums.ConfigOption) (c *Configuratio // Must be last since v may match QuorumSpec if it is interface{} c.qspec = v default: - return nil, fmt.Errorf("unknown option type: %v", v) + return nil, fmt.Errorf("config: unknown option type: %v", v) } } // return an error if the QuorumSpec interface is not empty and no implementation was provided. var test interface{} = struct{}{} if _, empty := test.(QuorumSpec); !empty && c.qspec == nil { - return nil, fmt.Errorf("missing required QuorumSpec") + return nil, fmt.Errorf("config: missing required QuorumSpec") } return c, nil } diff --git a/tests/dummy/dummy.pb.go b/tests/dummy/dummy.pb.go index a1b8c647..825fd4af 100644 --- a/tests/dummy/dummy.pb.go +++ b/tests/dummy/dummy.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.19.2 +// protoc-gen-go v1.31.0 +// protoc v4.25.3 // source: dummy/dummy.proto package dummy diff --git a/tests/dummy/dummy_gorums.pb.go b/tests/dummy/dummy_gorums.pb.go index ad31c670..84043ba2 100644 --- a/tests/dummy/dummy_gorums.pb.go +++ b/tests/dummy/dummy_gorums.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gorums. DO NOT EDIT. // versions: // protoc-gen-gorums v0.7.0-devel -// protoc v3.19.2 +// protoc v4.25.3 // source: dummy/dummy.proto package dummy @@ -31,8 +31,9 @@ type Configuration struct { // ConfigurationFromRaw returns a new Configuration from the given raw configuration and QuorumSpec. // // This function may for example be used to "clone" a configuration but install a different QuorumSpec: -// cfg1, err := mgr.NewConfiguration(qspec1, opts...) -// cfg2 := ConfigurationFromRaw(cfg1.RawConfig, qspec2) +// +// cfg1, err := mgr.NewConfiguration(qspec1, opts...) +// cfg2 := ConfigurationFromRaw(cfg1.RawConfig, qspec2) func ConfigurationFromRaw(rawCfg gorums.RawConfiguration, qspec QuorumSpec) *Configuration { // return an error if the QuorumSpec interface is not empty and no implementation was provided. var test interface{} = struct{}{} @@ -100,7 +101,7 @@ func NewManager(opts ...gorums.ManagerOption) (mgr *Manager) { // using the And, WithNewNodes, Except, and WithoutNodes methods. func (m *Manager) NewConfiguration(opts ...gorums.ConfigOption) (c *Configuration, err error) { if len(opts) < 1 || len(opts) > 2 { - return nil, fmt.Errorf("wrong number of options: %d", len(opts)) + return nil, fmt.Errorf("config: wrong number of options: %d", len(opts)) } c = &Configuration{} for _, opt := range opts { @@ -114,13 +115,13 @@ func (m *Manager) NewConfiguration(opts ...gorums.ConfigOption) (c *Configuratio // Must be last since v may match QuorumSpec if it is interface{} c.qspec = v default: - return nil, fmt.Errorf("unknown option type: %v", v) + return nil, fmt.Errorf("config: unknown option type: %v", v) } } // return an error if the QuorumSpec interface is not empty and no implementation was provided. var test interface{} = struct{}{} if _, empty := test.(QuorumSpec); !empty && c.qspec == nil { - return nil, fmt.Errorf("missing required QuorumSpec") + return nil, fmt.Errorf("config: missing required QuorumSpec") } return c, nil } diff --git a/tests/metadata/metadata.pb.go b/tests/metadata/metadata.pb.go index 27ca2b4d..8e646fc6 100644 --- a/tests/metadata/metadata.pb.go +++ b/tests/metadata/metadata.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.19.2 +// protoc-gen-go v1.31.0 +// protoc v4.25.3 // source: metadata/metadata.proto package metadata diff --git a/tests/metadata/metadata_gorums.pb.go b/tests/metadata/metadata_gorums.pb.go index 6818ce29..79b65409 100644 --- a/tests/metadata/metadata_gorums.pb.go +++ b/tests/metadata/metadata_gorums.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gorums. DO NOT EDIT. // versions: // protoc-gen-gorums v0.7.0-devel -// protoc v3.19.2 +// protoc v4.25.3 // source: metadata/metadata.proto package metadata @@ -32,8 +32,9 @@ type Configuration struct { // ConfigurationFromRaw returns a new Configuration from the given raw configuration and QuorumSpec. // // This function may for example be used to "clone" a configuration but install a different QuorumSpec: -// cfg1, err := mgr.NewConfiguration(qspec1, opts...) -// cfg2 := ConfigurationFromRaw(cfg1.RawConfig, qspec2) +// +// cfg1, err := mgr.NewConfiguration(qspec1, opts...) +// cfg2 := ConfigurationFromRaw(cfg1.RawConfig, qspec2) func ConfigurationFromRaw(rawCfg gorums.RawConfiguration, qspec QuorumSpec) *Configuration { // return an error if the QuorumSpec interface is not empty and no implementation was provided. var test interface{} = struct{}{} @@ -101,7 +102,7 @@ func NewManager(opts ...gorums.ManagerOption) (mgr *Manager) { // using the And, WithNewNodes, Except, and WithoutNodes methods. func (m *Manager) NewConfiguration(opts ...gorums.ConfigOption) (c *Configuration, err error) { if len(opts) < 1 || len(opts) > 2 { - return nil, fmt.Errorf("wrong number of options: %d", len(opts)) + return nil, fmt.Errorf("config: wrong number of options: %d", len(opts)) } c = &Configuration{} for _, opt := range opts { @@ -115,13 +116,13 @@ func (m *Manager) NewConfiguration(opts ...gorums.ConfigOption) (c *Configuratio // Must be last since v may match QuorumSpec if it is interface{} c.qspec = v default: - return nil, fmt.Errorf("unknown option type: %v", v) + return nil, fmt.Errorf("config: unknown option type: %v", v) } } // return an error if the QuorumSpec interface is not empty and no implementation was provided. var test interface{} = struct{}{} if _, empty := test.(QuorumSpec); !empty && c.qspec == nil { - return nil, fmt.Errorf("missing required QuorumSpec") + return nil, fmt.Errorf("config: missing required QuorumSpec") } return c, nil } diff --git a/tests/oneway/oneway.pb.go b/tests/oneway/oneway.pb.go index bc220e24..06d2c7d0 100644 --- a/tests/oneway/oneway.pb.go +++ b/tests/oneway/oneway.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.19.2 +// protoc-gen-go v1.31.0 +// protoc v4.25.3 // source: oneway/oneway.proto package oneway diff --git a/tests/oneway/oneway_gorums.pb.go b/tests/oneway/oneway_gorums.pb.go index c8c60d41..57c84b4a 100644 --- a/tests/oneway/oneway_gorums.pb.go +++ b/tests/oneway/oneway_gorums.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gorums. DO NOT EDIT. // versions: // protoc-gen-gorums v0.7.0-devel -// protoc v3.19.2 +// protoc v4.25.3 // source: oneway/oneway.proto package oneway @@ -32,8 +32,9 @@ type Configuration struct { // ConfigurationFromRaw returns a new Configuration from the given raw configuration and QuorumSpec. // // This function may for example be used to "clone" a configuration but install a different QuorumSpec: -// cfg1, err := mgr.NewConfiguration(qspec1, opts...) -// cfg2 := ConfigurationFromRaw(cfg1.RawConfig, qspec2) +// +// cfg1, err := mgr.NewConfiguration(qspec1, opts...) +// cfg2 := ConfigurationFromRaw(cfg1.RawConfig, qspec2) func ConfigurationFromRaw(rawCfg gorums.RawConfiguration, qspec QuorumSpec) *Configuration { // return an error if the QuorumSpec interface is not empty and no implementation was provided. var test interface{} = struct{}{} @@ -101,7 +102,7 @@ func NewManager(opts ...gorums.ManagerOption) (mgr *Manager) { // using the And, WithNewNodes, Except, and WithoutNodes methods. func (m *Manager) NewConfiguration(opts ...gorums.ConfigOption) (c *Configuration, err error) { if len(opts) < 1 || len(opts) > 2 { - return nil, fmt.Errorf("wrong number of options: %d", len(opts)) + return nil, fmt.Errorf("config: wrong number of options: %d", len(opts)) } c = &Configuration{} for _, opt := range opts { @@ -115,13 +116,13 @@ func (m *Manager) NewConfiguration(opts ...gorums.ConfigOption) (c *Configuratio // Must be last since v may match QuorumSpec if it is interface{} c.qspec = v default: - return nil, fmt.Errorf("unknown option type: %v", v) + return nil, fmt.Errorf("config: unknown option type: %v", v) } } // return an error if the QuorumSpec interface is not empty and no implementation was provided. var test interface{} = struct{}{} if _, empty := test.(QuorumSpec); !empty && c.qspec == nil { - return nil, fmt.Errorf("missing required QuorumSpec") + return nil, fmt.Errorf("config: missing required QuorumSpec") } return c, nil } diff --git a/tests/ordering/order.pb.go b/tests/ordering/order.pb.go index 19cf8da3..1ac01b4b 100644 --- a/tests/ordering/order.pb.go +++ b/tests/ordering/order.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.19.2 +// protoc-gen-go v1.31.0 +// protoc v4.25.3 // source: ordering/order.proto package ordering diff --git a/tests/ordering/order_gorums.pb.go b/tests/ordering/order_gorums.pb.go index 663494a8..9d6f2613 100644 --- a/tests/ordering/order_gorums.pb.go +++ b/tests/ordering/order_gorums.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gorums. DO NOT EDIT. // versions: // protoc-gen-gorums v0.7.0-devel -// protoc v3.19.2 +// protoc v4.25.3 // source: ordering/order.proto package ordering @@ -32,8 +32,9 @@ type Configuration struct { // ConfigurationFromRaw returns a new Configuration from the given raw configuration and QuorumSpec. // // This function may for example be used to "clone" a configuration but install a different QuorumSpec: -// cfg1, err := mgr.NewConfiguration(qspec1, opts...) -// cfg2 := ConfigurationFromRaw(cfg1.RawConfig, qspec2) +// +// cfg1, err := mgr.NewConfiguration(qspec1, opts...) +// cfg2 := ConfigurationFromRaw(cfg1.RawConfig, qspec2) func ConfigurationFromRaw(rawCfg gorums.RawConfiguration, qspec QuorumSpec) *Configuration { // return an error if the QuorumSpec interface is not empty and no implementation was provided. var test interface{} = struct{}{} @@ -101,7 +102,7 @@ func NewManager(opts ...gorums.ManagerOption) (mgr *Manager) { // using the And, WithNewNodes, Except, and WithoutNodes methods. func (m *Manager) NewConfiguration(opts ...gorums.ConfigOption) (c *Configuration, err error) { if len(opts) < 1 || len(opts) > 2 { - return nil, fmt.Errorf("wrong number of options: %d", len(opts)) + return nil, fmt.Errorf("config: wrong number of options: %d", len(opts)) } c = &Configuration{} for _, opt := range opts { @@ -115,13 +116,13 @@ func (m *Manager) NewConfiguration(opts ...gorums.ConfigOption) (c *Configuratio // Must be last since v may match QuorumSpec if it is interface{} c.qspec = v default: - return nil, fmt.Errorf("unknown option type: %v", v) + return nil, fmt.Errorf("config: unknown option type: %v", v) } } // return an error if the QuorumSpec interface is not empty and no implementation was provided. var test interface{} = struct{}{} if _, empty := test.(QuorumSpec); !empty && c.qspec == nil { - return nil, fmt.Errorf("missing required QuorumSpec") + return nil, fmt.Errorf("config: missing required QuorumSpec") } return c, nil } diff --git a/tests/qf/qf.pb.go b/tests/qf/qf.pb.go index fc15b1a4..ca25eee9 100644 --- a/tests/qf/qf.pb.go +++ b/tests/qf/qf.pb.go @@ -2,8 +2,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.19.2 +// protoc-gen-go v1.31.0 +// protoc v4.25.3 // source: qf/qf.proto package qf diff --git a/tests/qf/qf_gorums.pb.go b/tests/qf/qf_gorums.pb.go index 0fa19d9b..ed2a6bf9 100644 --- a/tests/qf/qf_gorums.pb.go +++ b/tests/qf/qf_gorums.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gorums. DO NOT EDIT. // versions: // protoc-gen-gorums v0.7.0-devel -// protoc v3.19.2 +// protoc v4.25.3 // source: qf/qf.proto package qf @@ -32,8 +32,9 @@ type Configuration struct { // ConfigurationFromRaw returns a new Configuration from the given raw configuration and QuorumSpec. // // This function may for example be used to "clone" a configuration but install a different QuorumSpec: -// cfg1, err := mgr.NewConfiguration(qspec1, opts...) -// cfg2 := ConfigurationFromRaw(cfg1.RawConfig, qspec2) +// +// cfg1, err := mgr.NewConfiguration(qspec1, opts...) +// cfg2 := ConfigurationFromRaw(cfg1.RawConfig, qspec2) func ConfigurationFromRaw(rawCfg gorums.RawConfiguration, qspec QuorumSpec) *Configuration { // return an error if the QuorumSpec interface is not empty and no implementation was provided. var test interface{} = struct{}{} @@ -101,7 +102,7 @@ func NewManager(opts ...gorums.ManagerOption) (mgr *Manager) { // using the And, WithNewNodes, Except, and WithoutNodes methods. func (m *Manager) NewConfiguration(opts ...gorums.ConfigOption) (c *Configuration, err error) { if len(opts) < 1 || len(opts) > 2 { - return nil, fmt.Errorf("wrong number of options: %d", len(opts)) + return nil, fmt.Errorf("config: wrong number of options: %d", len(opts)) } c = &Configuration{} for _, opt := range opts { @@ -115,13 +116,13 @@ func (m *Manager) NewConfiguration(opts ...gorums.ConfigOption) (c *Configuratio // Must be last since v may match QuorumSpec if it is interface{} c.qspec = v default: - return nil, fmt.Errorf("unknown option type: %v", v) + return nil, fmt.Errorf("config: unknown option type: %v", v) } } // return an error if the QuorumSpec interface is not empty and no implementation was provided. var test interface{} = struct{}{} if _, empty := test.(QuorumSpec); !empty && c.qspec == nil { - return nil, fmt.Errorf("missing required QuorumSpec") + return nil, fmt.Errorf("config: missing required QuorumSpec") } return c, nil } diff --git a/tests/tls/tls.pb.go b/tests/tls/tls.pb.go index bcc35f2f..de4bde7c 100644 --- a/tests/tls/tls.pb.go +++ b/tests/tls/tls.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.19.2 +// protoc-gen-go v1.31.0 +// protoc v4.25.3 // source: tls/tls.proto package tls diff --git a/tests/tls/tls_gorums.pb.go b/tests/tls/tls_gorums.pb.go index 297c2773..1c13fbea 100644 --- a/tests/tls/tls_gorums.pb.go +++ b/tests/tls/tls_gorums.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gorums. DO NOT EDIT. // versions: // protoc-gen-gorums v0.7.0-devel -// protoc v3.19.2 +// protoc v4.25.3 // source: tls/tls.proto package tls @@ -31,8 +31,9 @@ type Configuration struct { // ConfigurationFromRaw returns a new Configuration from the given raw configuration and QuorumSpec. // // This function may for example be used to "clone" a configuration but install a different QuorumSpec: -// cfg1, err := mgr.NewConfiguration(qspec1, opts...) -// cfg2 := ConfigurationFromRaw(cfg1.RawConfig, qspec2) +// +// cfg1, err := mgr.NewConfiguration(qspec1, opts...) +// cfg2 := ConfigurationFromRaw(cfg1.RawConfig, qspec2) func ConfigurationFromRaw(rawCfg gorums.RawConfiguration, qspec QuorumSpec) *Configuration { // return an error if the QuorumSpec interface is not empty and no implementation was provided. var test interface{} = struct{}{} @@ -100,7 +101,7 @@ func NewManager(opts ...gorums.ManagerOption) (mgr *Manager) { // using the And, WithNewNodes, Except, and WithoutNodes methods. func (m *Manager) NewConfiguration(opts ...gorums.ConfigOption) (c *Configuration, err error) { if len(opts) < 1 || len(opts) > 2 { - return nil, fmt.Errorf("wrong number of options: %d", len(opts)) + return nil, fmt.Errorf("config: wrong number of options: %d", len(opts)) } c = &Configuration{} for _, opt := range opts { @@ -114,13 +115,13 @@ func (m *Manager) NewConfiguration(opts ...gorums.ConfigOption) (c *Configuratio // Must be last since v may match QuorumSpec if it is interface{} c.qspec = v default: - return nil, fmt.Errorf("unknown option type: %v", v) + return nil, fmt.Errorf("config: unknown option type: %v", v) } } // return an error if the QuorumSpec interface is not empty and no implementation was provided. var test interface{} = struct{}{} if _, empty := test.(QuorumSpec); !empty && c.qspec == nil { - return nil, fmt.Errorf("missing required QuorumSpec") + return nil, fmt.Errorf("config: missing required QuorumSpec") } return c, nil } diff --git a/tests/unresponsive/unresponsive.pb.go b/tests/unresponsive/unresponsive.pb.go index c1af48bf..0a86d466 100644 --- a/tests/unresponsive/unresponsive.pb.go +++ b/tests/unresponsive/unresponsive.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.19.2 +// protoc-gen-go v1.31.0 +// protoc v4.25.3 // source: unresponsive/unresponsive.proto package unresponsive diff --git a/tests/unresponsive/unresponsive_gorums.pb.go b/tests/unresponsive/unresponsive_gorums.pb.go index ce3f8c88..b7ea484b 100644 --- a/tests/unresponsive/unresponsive_gorums.pb.go +++ b/tests/unresponsive/unresponsive_gorums.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gorums. DO NOT EDIT. // versions: // protoc-gen-gorums v0.7.0-devel -// protoc v3.19.2 +// protoc v4.25.3 // source: unresponsive/unresponsive.proto package unresponsive @@ -31,8 +31,9 @@ type Configuration struct { // ConfigurationFromRaw returns a new Configuration from the given raw configuration and QuorumSpec. // // This function may for example be used to "clone" a configuration but install a different QuorumSpec: -// cfg1, err := mgr.NewConfiguration(qspec1, opts...) -// cfg2 := ConfigurationFromRaw(cfg1.RawConfig, qspec2) +// +// cfg1, err := mgr.NewConfiguration(qspec1, opts...) +// cfg2 := ConfigurationFromRaw(cfg1.RawConfig, qspec2) func ConfigurationFromRaw(rawCfg gorums.RawConfiguration, qspec QuorumSpec) *Configuration { // return an error if the QuorumSpec interface is not empty and no implementation was provided. var test interface{} = struct{}{} @@ -100,7 +101,7 @@ func NewManager(opts ...gorums.ManagerOption) (mgr *Manager) { // using the And, WithNewNodes, Except, and WithoutNodes methods. func (m *Manager) NewConfiguration(opts ...gorums.ConfigOption) (c *Configuration, err error) { if len(opts) < 1 || len(opts) > 2 { - return nil, fmt.Errorf("wrong number of options: %d", len(opts)) + return nil, fmt.Errorf("config: wrong number of options: %d", len(opts)) } c = &Configuration{} for _, opt := range opts { @@ -114,13 +115,13 @@ func (m *Manager) NewConfiguration(opts ...gorums.ConfigOption) (c *Configuratio // Must be last since v may match QuorumSpec if it is interface{} c.qspec = v default: - return nil, fmt.Errorf("unknown option type: %v", v) + return nil, fmt.Errorf("config: unknown option type: %v", v) } } // return an error if the QuorumSpec interface is not empty and no implementation was provided. var test interface{} = struct{}{} if _, empty := test.(QuorumSpec); !empty && c.qspec == nil { - return nil, fmt.Errorf("missing required QuorumSpec") + return nil, fmt.Errorf("config: missing required QuorumSpec") } return c, nil } From 1fbfdbec78c70cee377031ddc6191afdbfc08cdd Mon Sep 17 00:00:00 2001 From: Hein Meling Date: Sat, 23 Mar 2024 15:38:27 +0100 Subject: [PATCH 06/10] chore: simplified QuorumCallError and added nodeError This adds field labels when constructing errors. This also reuses the nodeError.Error() call. --- async.go | 8 ++++---- correctable.go | 8 ++++---- errors.go | 37 ++++++++++++++++++------------------- quorumcall.go | 8 ++++---- 4 files changed, 30 insertions(+), 31 deletions(-) diff --git a/async.go b/async.go index 1f1328bb..a4648e07 100644 --- a/async.go +++ b/async.go @@ -78,7 +78,7 @@ func (c RawConfiguration) handleAsyncCall(ctx context.Context, fut *Async, state var ( resp protoreflect.ProtoMessage - errs []Error + errs []nodeError quorum bool replies = make(map[uint32]protoreflect.ProtoMessage) ) @@ -87,7 +87,7 @@ func (c RawConfiguration) handleAsyncCall(ctx context.Context, fut *Async, state select { case r := <-state.replyChan: if r.err != nil { - errs = append(errs, Error{r.nid, r.err}) + errs = append(errs, nodeError{nodeID: r.nid, cause: r.err}) break } replies[r.nid] = r.msg @@ -96,11 +96,11 @@ func (c RawConfiguration) handleAsyncCall(ctx context.Context, fut *Async, state return } case <-ctx.Done(): - fut.reply, fut.err = resp, QuorumCallError{ctx.Err().Error(), len(replies), errs} + fut.reply, fut.err = resp, QuorumCallError{Reason: ctx.Err().Error(), errors: errs, replies: len(replies)} return } if len(errs)+len(replies) == state.expectedReplies { - fut.reply, fut.err = resp, QuorumCallError{"incomplete call", len(replies), errs} + fut.reply, fut.err = resp, QuorumCallError{Reason: "incomplete call", errors: errs, replies: len(replies)} return } } diff --git a/correctable.go b/correctable.go index 787b9a9d..97ad4e33 100644 --- a/correctable.go +++ b/correctable.go @@ -132,7 +132,7 @@ func (c RawConfiguration) CorrectableCall(ctx context.Context, d CorrectableCall func (c RawConfiguration) handleCorrectableCall(ctx context.Context, corr *Correctable, state correctableCallState) { var ( resp protoreflect.ProtoMessage - errs []Error + errs []nodeError rlevel int clevel = LevelNotSet quorum bool @@ -149,7 +149,7 @@ func (c RawConfiguration) handleCorrectableCall(ctx context.Context, corr *Corre select { case r := <-state.replyChan: if r.err != nil { - errs = append(errs, Error{r.nid, r.err}) + errs = append(errs, nodeError{nodeID: r.nid, cause: r.err}) break } replies[r.nid] = r.msg @@ -164,12 +164,12 @@ func (c RawConfiguration) handleCorrectableCall(ctx context.Context, corr *Corre } } case <-ctx.Done(): - corr.set(resp, clevel, QuorumCallError{ctx.Err().Error(), len(replies), errs}, true) + corr.set(resp, clevel, QuorumCallError{Reason: ctx.Err().Error(), errors: errs, replies: len(replies)}, true) return } if (state.data.ServerStream && len(errs) == state.expectedReplies) || (!state.data.ServerStream && len(errs)+len(replies) == state.expectedReplies) { - corr.set(resp, clevel, QuorumCallError{"incomplete call", len(replies), errs}, true) + corr.set(resp, clevel, QuorumCallError{Reason: "incomplete call", errors: errs, replies: len(replies)}, true) return } } diff --git a/errors.go b/errors.go index bbbdf52c..6ecc178b 100644 --- a/errors.go +++ b/errors.go @@ -1,40 +1,39 @@ package gorums import ( - "bytes" "fmt" + "strings" ) -// A QuorumCallError is used to report that a quorum call failed. +// QuorumCallError reports on a failed quorum call. type QuorumCallError struct { - Reason string - ReplyCount int - Errors []Error + Reason string + errors []nodeError + replies int } func (e QuorumCallError) Error() string { - var b bytes.Buffer - b.WriteString("quorum call error: ") - b.WriteString(e.Reason) - b.WriteString(fmt.Sprintf(" (errors: %d, replies: %d)", len(e.Errors), e.ReplyCount)) - if len(e.Errors) == 0 { + s := fmt.Sprintf("quorum call error: %s (errors: %d, replies: %d)", e.Reason, len(e.errors), e.replies) + var b strings.Builder + b.WriteString(s) + if len(e.errors) == 0 { return b.String() } - b.WriteString("\ngrpc errors:\n") - for _, err := range e.Errors { + b.WriteString("\nnode errors:\n") + for _, err := range e.errors { b.WriteByte('\t') - b.WriteString(fmt.Sprintf("node %d: %v", err.NodeID, err.Cause)) + b.WriteString(err.Error()) b.WriteByte('\n') } return b.String() } -// Error is used to report that a single gRPC call failed. -type Error struct { - NodeID uint32 - Cause error +// nodeError reports on a failed RPC call. +type nodeError struct { + cause error + nodeID uint32 } -func (e Error) Error() string { - return fmt.Sprintf("node %d: %v", e.NodeID, e.Cause.Error()) +func (e nodeError) Error() string { + return fmt.Sprintf("node %d: %v", e.nodeID, e.cause) } diff --git a/quorumcall.go b/quorumcall.go index d8001f43..a0d7681b 100644 --- a/quorumcall.go +++ b/quorumcall.go @@ -40,7 +40,7 @@ func (c RawConfiguration) QuorumCall(ctx context.Context, d QuorumCallData) (res } var ( - errs []Error + errs []nodeError quorum bool replies = make(map[uint32]protoreflect.ProtoMessage) ) @@ -49,7 +49,7 @@ func (c RawConfiguration) QuorumCall(ctx context.Context, d QuorumCallData) (res select { case r := <-replyChan: if r.err != nil { - errs = append(errs, Error{r.nid, r.err}) + errs = append(errs, nodeError{nodeID: r.nid, cause: r.err}) break } replies[r.nid] = r.msg @@ -57,10 +57,10 @@ func (c RawConfiguration) QuorumCall(ctx context.Context, d QuorumCallData) (res return resp, nil } case <-ctx.Done(): - return resp, QuorumCallError{ctx.Err().Error(), len(replies), errs} + return resp, QuorumCallError{Reason: ctx.Err().Error(), errors: errs, replies: len(replies)} } if len(errs)+len(replies) == expectedReplies { - return resp, QuorumCallError{"incomplete call", len(replies), errs} + return resp, QuorumCallError{Reason: "incomplete call", errors: errs, replies: len(replies)} } } } From a438538a2f589b92c001a23a4a620d73ba4bcca7 Mon Sep 17 00:00:00 2001 From: Hein Meling Date: Sat, 23 Mar 2024 17:12:49 +0100 Subject: [PATCH 07/10] feat!: add support for errors.Is() on QuorumCallError This refactors the QuorumCallError to support the errors.Is() func. This is a breaking change since it unexports the Reason field; users of the QuorumCallError must update their code to use the errors.Is() function. This also adds the gorums.Incomplete sentinal error that can be used to check for incomplete quorum calls. --- async.go | 4 +-- correctable.go | 4 +-- errors.go | 17 ++++++++-- errors_test.go | 60 ++++++++++++++++++++++++++++++++++++ quorumcall.go | 4 +-- tests/ordering/order_test.go | 7 ++--- 6 files changed, 84 insertions(+), 12 deletions(-) create mode 100644 errors_test.go diff --git a/async.go b/async.go index a4648e07..68f909c5 100644 --- a/async.go +++ b/async.go @@ -96,11 +96,11 @@ func (c RawConfiguration) handleAsyncCall(ctx context.Context, fut *Async, state return } case <-ctx.Done(): - fut.reply, fut.err = resp, QuorumCallError{Reason: ctx.Err().Error(), errors: errs, replies: len(replies)} + fut.reply, fut.err = resp, QuorumCallError{cause: ctx.Err(), errors: errs, replies: len(replies)} return } if len(errs)+len(replies) == state.expectedReplies { - fut.reply, fut.err = resp, QuorumCallError{Reason: "incomplete call", errors: errs, replies: len(replies)} + fut.reply, fut.err = resp, QuorumCallError{cause: Incomplete, errors: errs, replies: len(replies)} return } } diff --git a/correctable.go b/correctable.go index 97ad4e33..901eacde 100644 --- a/correctable.go +++ b/correctable.go @@ -164,12 +164,12 @@ func (c RawConfiguration) handleCorrectableCall(ctx context.Context, corr *Corre } } case <-ctx.Done(): - corr.set(resp, clevel, QuorumCallError{Reason: ctx.Err().Error(), errors: errs, replies: len(replies)}, true) + corr.set(resp, clevel, QuorumCallError{cause: ctx.Err(), errors: errs, replies: len(replies)}, true) return } if (state.data.ServerStream && len(errs) == state.expectedReplies) || (!state.data.ServerStream && len(errs)+len(replies) == state.expectedReplies) { - corr.set(resp, clevel, QuorumCallError{Reason: "incomplete call", errors: errs, replies: len(replies)}, true) + corr.set(resp, clevel, QuorumCallError{cause: Incomplete, errors: errs, replies: len(replies)}, true) return } } diff --git a/errors.go b/errors.go index 6ecc178b..2ac77f9b 100644 --- a/errors.go +++ b/errors.go @@ -1,19 +1,32 @@ package gorums import ( + "errors" "fmt" "strings" ) +// Incomplete is the error returned by a quorum call when the call cannot completed +// due insufficient non-error replies to form a quorum according to the quorum function. +var Incomplete = errors.New("incomplete call") + // QuorumCallError reports on a failed quorum call. type QuorumCallError struct { - Reason string + cause error errors []nodeError replies int } +// Is reports whether the target error is the same as the cause of the QuorumCallError. +func (e QuorumCallError) Is(target error) bool { + if t, ok := target.(QuorumCallError); ok { + return e.cause == t.cause + } + return e.cause == target +} + func (e QuorumCallError) Error() string { - s := fmt.Sprintf("quorum call error: %s (errors: %d, replies: %d)", e.Reason, len(e.errors), e.replies) + s := fmt.Sprintf("quorum call error: %s (errors: %d, replies: %d)", e.cause, len(e.errors), e.replies) var b strings.Builder b.WriteString(s) if len(e.errors) == 0 { diff --git a/errors_test.go b/errors_test.go new file mode 100644 index 00000000..529288b9 --- /dev/null +++ b/errors_test.go @@ -0,0 +1,60 @@ +package gorums + +import ( + "context" + "errors" + "testing" +) + +func TestQuorumCallErrorIs(t *testing.T) { + tests := []struct { + name string + err error + target error + want bool + }{ + { + name: "SameCauseError", + err: QuorumCallError{cause: Incomplete}, + target: Incomplete, + want: true, + }, + { + name: "SameCauseQCError", + err: QuorumCallError{cause: Incomplete}, + target: QuorumCallError{cause: Incomplete}, + want: true, + }, + { + name: "DifferentError", + err: QuorumCallError{cause: Incomplete}, + target: errors.New("incomplete call"), + want: false, + }, + { + name: "DifferentQCError", + err: QuorumCallError{cause: Incomplete}, + target: QuorumCallError{cause: errors.New("incomplete call")}, + want: false, + }, + { + name: "ContextCanceled", + err: QuorumCallError{cause: context.Canceled}, + target: context.Canceled, + want: true, + }, + { + name: "ContextCanceledQC", + err: QuorumCallError{cause: context.Canceled}, + target: QuorumCallError{cause: context.Canceled}, + want: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := errors.Is(tt.err, tt.target); got != tt.want { + t.Errorf("QuorumCallError.Is(%v, %v) = %v, want %v", tt.err, tt.target, got, tt.want) + } + }) + } +} diff --git a/quorumcall.go b/quorumcall.go index a0d7681b..3e3f97e8 100644 --- a/quorumcall.go +++ b/quorumcall.go @@ -57,10 +57,10 @@ func (c RawConfiguration) QuorumCall(ctx context.Context, d QuorumCallData) (res return resp, nil } case <-ctx.Done(): - return resp, QuorumCallError{Reason: ctx.Err().Error(), errors: errs, replies: len(replies)} + return resp, QuorumCallError{cause: ctx.Err(), errors: errs, replies: len(replies)} } if len(errs)+len(replies) == expectedReplies { - return resp, QuorumCallError{Reason: "incomplete call", errors: errs, replies: len(replies)} + return resp, QuorumCallError{cause: Incomplete, errors: errs, replies: len(replies)} } } } diff --git a/tests/ordering/order_test.go b/tests/ordering/order_test.go index ae65561f..dbaf5b45 100644 --- a/tests/ordering/order_test.go +++ b/tests/ordering/order_test.go @@ -2,6 +2,7 @@ package ordering import ( "context" + "errors" "sync" "testing" "time" @@ -165,10 +166,8 @@ func TestQCAsyncOrdering(t *testing.T) { defer wg.Done() resp, err := promise.Get() if err != nil { - if qcError, ok := err.(gorums.QuorumCallError); ok { - if qcError.Reason == context.Canceled.Error() { - return - } + if errors.Is(err, context.Canceled) { + return } t.Errorf("QC error: %v", err) } From f8b29e4c98240910963bf1d4a23feebab4e90722 Mon Sep 17 00:00:00 2001 From: Hein Meling Date: Sat, 23 Mar 2024 17:35:40 +0100 Subject: [PATCH 08/10] chore: removed redundancy in node error closing --- mgr.go | 2 +- node.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mgr.go b/mgr.go index c961c891..92eb644f 100644 --- a/mgr.go +++ b/mgr.go @@ -58,7 +58,7 @@ func (m *RawManager) closeNodeConns() { for _, node := range m.nodes { err := node.close() if err != nil && m.logger != nil { - m.logger.Printf("node %d: error closing: %v", node.id, err) + m.logger.Printf("error closing: %v", err) } } } diff --git a/node.go b/node.go index 83b43449..634b7e0d 100644 --- a/node.go +++ b/node.go @@ -91,7 +91,7 @@ func (n *RawNode) close() error { return nil } if err := n.conn.Close(); err != nil { - return fmt.Errorf("%d: conn close error: %w", n.id, err) + return fmt.Errorf("node %d: %w", n.id, err) } n.cancel() return nil From 271e62eff185727fb9bc80114bcf63fa33e1cf66 Mon Sep 17 00:00:00 2001 From: Hein Meling Date: Sat, 23 Mar 2024 18:13:21 +0100 Subject: [PATCH 09/10] chore: updated protoc-gen-go to latest (v1.33.0) --- benchmark/benchmark.pb.go | 2 +- cmd/protoc-gen-gorums/dev/zorums.pb.go | 2 +- gorums.pb.go | 2 +- internal/correctable/opts.pb.go | 2 +- ordering/ordering.pb.go | 2 +- tests/config/config.pb.go | 2 +- tests/correctable/correctable.pb.go | 2 +- tests/dummy/dummy.pb.go | 2 +- tests/metadata/metadata.pb.go | 2 +- tests/oneway/oneway.pb.go | 2 +- tests/ordering/order.pb.go | 2 +- tests/qf/qf.pb.go | 2 +- tests/tls/tls.pb.go | 2 +- tests/unresponsive/unresponsive.pb.go | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/benchmark/benchmark.pb.go b/benchmark/benchmark.pb.go index d90b3f7d..e7e7040a 100644 --- a/benchmark/benchmark.pb.go +++ b/benchmark/benchmark.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 +// protoc-gen-go v1.33.0 // protoc v4.25.3 // source: benchmark/benchmark.proto diff --git a/cmd/protoc-gen-gorums/dev/zorums.pb.go b/cmd/protoc-gen-gorums/dev/zorums.pb.go index 0a26492e..8b4bbc2c 100644 --- a/cmd/protoc-gen-gorums/dev/zorums.pb.go +++ b/cmd/protoc-gen-gorums/dev/zorums.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 +// protoc-gen-go v1.33.0 // protoc v4.25.3 // source: zorums.proto diff --git a/gorums.pb.go b/gorums.pb.go index 8840b0ac..c4d807d2 100644 --- a/gorums.pb.go +++ b/gorums.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 +// protoc-gen-go v1.33.0 // protoc v4.25.3 // source: gorums.proto diff --git a/internal/correctable/opts.pb.go b/internal/correctable/opts.pb.go index f1184a1e..d1f15c0e 100644 --- a/internal/correctable/opts.pb.go +++ b/internal/correctable/opts.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 +// protoc-gen-go v1.33.0 // protoc v4.25.3 // source: internal/correctable/opts.proto diff --git a/ordering/ordering.pb.go b/ordering/ordering.pb.go index da0af6c4..990c7bd7 100644 --- a/ordering/ordering.pb.go +++ b/ordering/ordering.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 +// protoc-gen-go v1.33.0 // protoc v4.25.3 // source: ordering/ordering.proto diff --git a/tests/config/config.pb.go b/tests/config/config.pb.go index 9425484a..932cb218 100644 --- a/tests/config/config.pb.go +++ b/tests/config/config.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 +// protoc-gen-go v1.33.0 // protoc v4.25.3 // source: config/config.proto diff --git a/tests/correctable/correctable.pb.go b/tests/correctable/correctable.pb.go index 6c206f67..6445309e 100644 --- a/tests/correctable/correctable.pb.go +++ b/tests/correctable/correctable.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 +// protoc-gen-go v1.33.0 // protoc v4.25.3 // source: correctable/correctable.proto diff --git a/tests/dummy/dummy.pb.go b/tests/dummy/dummy.pb.go index 825fd4af..0f9b1ca0 100644 --- a/tests/dummy/dummy.pb.go +++ b/tests/dummy/dummy.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 +// protoc-gen-go v1.33.0 // protoc v4.25.3 // source: dummy/dummy.proto diff --git a/tests/metadata/metadata.pb.go b/tests/metadata/metadata.pb.go index 8e646fc6..b6e7f440 100644 --- a/tests/metadata/metadata.pb.go +++ b/tests/metadata/metadata.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 +// protoc-gen-go v1.33.0 // protoc v4.25.3 // source: metadata/metadata.proto diff --git a/tests/oneway/oneway.pb.go b/tests/oneway/oneway.pb.go index 06d2c7d0..3bc5bcf0 100644 --- a/tests/oneway/oneway.pb.go +++ b/tests/oneway/oneway.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 +// protoc-gen-go v1.33.0 // protoc v4.25.3 // source: oneway/oneway.proto diff --git a/tests/ordering/order.pb.go b/tests/ordering/order.pb.go index 1ac01b4b..3df5a76d 100644 --- a/tests/ordering/order.pb.go +++ b/tests/ordering/order.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 +// protoc-gen-go v1.33.0 // protoc v4.25.3 // source: ordering/order.proto diff --git a/tests/qf/qf.pb.go b/tests/qf/qf.pb.go index ca25eee9..7a8a720f 100644 --- a/tests/qf/qf.pb.go +++ b/tests/qf/qf.pb.go @@ -2,7 +2,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 +// protoc-gen-go v1.33.0 // protoc v4.25.3 // source: qf/qf.proto diff --git a/tests/tls/tls.pb.go b/tests/tls/tls.pb.go index de4bde7c..2c07c343 100644 --- a/tests/tls/tls.pb.go +++ b/tests/tls/tls.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 +// protoc-gen-go v1.33.0 // protoc v4.25.3 // source: tls/tls.proto diff --git a/tests/unresponsive/unresponsive.pb.go b/tests/unresponsive/unresponsive.pb.go index 0a86d466..a5a66b2f 100644 --- a/tests/unresponsive/unresponsive.pb.go +++ b/tests/unresponsive/unresponsive.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 +// protoc-gen-go v1.33.0 // protoc v4.25.3 // source: unresponsive/unresponsive.proto From 8060c4551cd546b9b394376effec35d8f7b73f79 Mon Sep 17 00:00:00 2001 From: Hein Meling Date: Sun, 24 Mar 2024 15:30:08 +0100 Subject: [PATCH 10/10] chore: use nodeError struct in three more places This will conflict with PR #179, but should be easy to resolve. --- node.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/node.go b/node.go index 634b7e0d..7a75da65 100644 --- a/node.go +++ b/node.go @@ -70,7 +70,7 @@ func (n *RawNode) connect(mgr *RawManager) error { defer cancel() n.conn, err = grpc.DialContext(ctx, n.addr, n.mgr.opts.grpcDialOpts...) if err != nil { - return fmt.Errorf("dialing node failed: %w", err) + return nodeError{nodeID: n.id, cause: err} } md := n.mgr.opts.metadata.Copy() if n.mgr.opts.perNodeMD != nil { @@ -80,7 +80,7 @@ func (n *RawNode) connect(mgr *RawManager) error { ctx, n.cancel = context.WithCancel(context.Background()) ctx = metadata.NewOutgoingContext(ctx, md) if err = n.channel.connect(ctx, n.conn); err != nil { - return fmt.Errorf("starting stream failed: %w", err) + return nodeError{nodeID: n.id, cause: err} } return nil } @@ -91,7 +91,7 @@ func (n *RawNode) close() error { return nil } if err := n.conn.Close(); err != nil { - return fmt.Errorf("node %d: %w", n.id, err) + return nodeError{nodeID: n.id, cause: err} } n.cancel() return nil