forked from TrueCloudLab/frostfs-api-go
[#263] Implement client for exchanging raw messages using gRPC protocol
Implement gRPC client that can uniformly execute any RPC on the remote server. In the primary implementation, the client is a thin wrapper over gRPC client connection that is required to create the client. In the future, it is planned to expand the library with convenient functionality. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
ae2fb263f1
commit
cf765a61a6
7 changed files with 271 additions and 0 deletions
21
rpc/grpc/options.go
Normal file
21
rpc/grpc/options.go
Normal file
|
@ -0,0 +1,21 @@
|
|||
package grpc
|
||||
|
||||
import (
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
type cfg struct {
|
||||
con *grpc.ClientConn
|
||||
}
|
||||
|
||||
func defaultCfg() *cfg {
|
||||
return new(cfg)
|
||||
}
|
||||
|
||||
// WithClientConnection returns option to set gRPC connection
|
||||
// to the remote server.
|
||||
func WithClientConnection(con *grpc.ClientConn) Option {
|
||||
return func(c *cfg) {
|
||||
c.con = con
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue