util: pass Servers by reference to Start()

This commit modifies nonBlockingGRPCServer.Start()
to accept Servers parameter by reference rather
than value to prevent copy of a large struct.

Signed-off-by: Rakshith R <rar@redhat.com>
This commit is contained in:
Rakshith R 2025-06-02 17:34:26 +05:30 committed by mergify[bot]
parent 2217e5cc35
commit dd93de0bfc
4 changed files with 6 additions and 6 deletions

View File

@ -193,7 +193,7 @@ func (fs *Driver) Run(conf *util.Config) {
} }
server := csicommon.NewNonBlockingGRPCServer() server := csicommon.NewNonBlockingGRPCServer()
srv := csicommon.Servers{ srv := &csicommon.Servers{
IS: fs.is, IS: fs.is,
CS: fs.cs, CS: fs.cs,
NS: fs.ns, NS: fs.ns,

View File

@ -31,7 +31,7 @@ import (
// NonBlockingGRPCServer defines Non blocking GRPC server interfaces. // NonBlockingGRPCServer defines Non blocking GRPC server interfaces.
type NonBlockingGRPCServer interface { type NonBlockingGRPCServer interface {
// Start services at the endpoint // Start services at the endpoint
Start(endpoint string, srv Servers, middlewareConfig MiddlewareServerOptionConfig) Start(endpoint string, srv *Servers, middlewareConfig MiddlewareServerOptionConfig)
// Waits for the service to stop // Waits for the service to stop
Wait() Wait()
// Stops the service gracefully // Stops the service gracefully
@ -62,11 +62,11 @@ type nonBlockingGRPCServer struct {
// Start start service on endpoint. // Start start service on endpoint.
func (s *nonBlockingGRPCServer) Start( func (s *nonBlockingGRPCServer) Start(
endpoint string, endpoint string,
srv Servers, srv *Servers,
middlewareConfig MiddlewareServerOptionConfig, middlewareConfig MiddlewareServerOptionConfig,
) { ) {
s.wg.Add(1) s.wg.Add(1)
go s.serve(endpoint, srv, middlewareConfig) go s.serve(endpoint, *srv, middlewareConfig)
} }
// Wait blocks until the WaitGroup counter. // Wait blocks until the WaitGroup counter.

View File

@ -63,7 +63,7 @@ func (fs *Driver) Run(conf *util.Config) {
// Create gRPC servers // Create gRPC servers
server := csicommon.NewNonBlockingGRPCServer() server := csicommon.NewNonBlockingGRPCServer()
srv := csicommon.Servers{ srv := &csicommon.Servers{
IS: identity.NewIdentityServer(cd), IS: identity.NewIdentityServer(cd),
} }

View File

@ -189,7 +189,7 @@ func (r *Driver) Run(conf *util.Config) {
} }
s := csicommon.NewNonBlockingGRPCServer() s := csicommon.NewNonBlockingGRPCServer()
srv := csicommon.Servers{ srv := &csicommon.Servers{
IS: r.ids, IS: r.ids,
CS: r.cs, CS: r.cs,
NS: r.ns, NS: r.ns,