Skip to content

Commit

Permalink
refactor(storage): rename create*Client to createFrontend*Client
Browse files Browse the repository at this point in the history
Signed-off-by: Artsiom Koltun <artsiom.koltun@intel.com>
  • Loading branch information
artek-koltun committed Jan 15, 2024
1 parent ab81fcd commit 9b0d83b
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 28 deletions.
26 changes: 13 additions & 13 deletions storage/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ import (

const defaultTimeout = 10 * time.Second

// CreateNvmeClient defines the function type used to retrieve FrontendNvmeServiceClient
type CreateNvmeClient func(cc grpc.ClientConnInterface) pb.FrontendNvmeServiceClient
// CreateFrontendNvmeClient defines the function type used to retrieve FrontendNvmeServiceClient
type CreateFrontendNvmeClient func(cc grpc.ClientConnInterface) pb.FrontendNvmeServiceClient

// CreateVirtioBlkClient defines the function type used to retrieve FrontendVirtioBlkServiceClient
type CreateVirtioBlkClient func(cc grpc.ClientConnInterface) pb.FrontendVirtioBlkServiceClient
// CreateFrontendVirtioBlkClient defines the function type used to retrieve FrontendVirtioBlkServiceClient
type CreateFrontendVirtioBlkClient func(cc grpc.ClientConnInterface) pb.FrontendVirtioBlkServiceClient

// Client is used for managing storage devices on OPI server
type Client struct {
connector grpcOpi.Connector
createClient CreateNvmeClient
createVirtioBlkClient CreateVirtioBlkClient
connector grpcOpi.Connector
createFrontendNvmeClient CreateFrontendNvmeClient
createFrontendVirtioBlkClient CreateFrontendVirtioBlkClient

timeout time.Duration
}
Expand All @@ -46,13 +46,13 @@ func New(addr string) (*Client, error) {
// NewWithArgs creates a new instance of Client with non-default members
func NewWithArgs(
connector grpcOpi.Connector,
createClient CreateNvmeClient,
createVirtioBlkClient CreateVirtioBlkClient,
createFrontendNvmeClient CreateFrontendNvmeClient,
createFrontendVirtioBlkClient CreateFrontendVirtioBlkClient,
) (*Client, error) {
return &Client{
connector: connector,
createClient: createClient,
createVirtioBlkClient: createVirtioBlkClient,
timeout: defaultTimeout,
connector: connector,
createFrontendNvmeClient: createFrontendNvmeClient,
createFrontendVirtioBlkClient: createFrontendVirtioBlkClient,
timeout: defaultTimeout,
}, nil
}
8 changes: 4 additions & 4 deletions storage/nvme_controller.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 Intel Corporation
// Copyright (C) 2023-2024 Intel Corporation

// Package storage implements the go library for OPI to be used in storage, for example, CSI drivers
package storage
Expand Down Expand Up @@ -36,7 +36,7 @@ func (c *Client) CreateNvmeTCPController(
return nil, fmt.Errorf("invalid ip address format: %v", ip)
}

client := c.createClient(conn)
client := c.createFrontendNvmeClient(conn)
response, err := client.CreateNvmeController(
ctx,
&pb.CreateNvmeControllerRequest{
Expand Down Expand Up @@ -71,7 +71,7 @@ func (c *Client) CreateNvmePcieController(
}
defer connClose()

client := c.createClient(conn)
client := c.createFrontendNvmeClient(conn)
response, err := client.CreateNvmeController(
ctx,
&pb.CreateNvmeControllerRequest{
Expand Down Expand Up @@ -106,7 +106,7 @@ func (c *Client) DeleteNvmeController(
}
defer connClose()

client := c.createClient(conn)
client := c.createFrontendNvmeClient(conn)
_, err = client.DeleteNvmeController(
ctx,
&pb.DeleteNvmeControllerRequest{
Expand Down
2 changes: 1 addition & 1 deletion storage/nvme_controller_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 Intel Corporation
// Copyright (C) 2023-2024 Intel Corporation

// Package storage implements the go library for OPI to be used in storage, for example, CSI drivers
package storage
Expand Down
6 changes: 3 additions & 3 deletions storage/nvme_namespace.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 Intel Corporation
// Copyright (C) 2023-2024 Intel Corporation

// Package storage implements the go library for OPI to be used in storage, for example, CSI drivers
package storage
Expand All @@ -21,7 +21,7 @@ func (c *Client) CreateNvmeNamespace(
}
defer connClose()

client := c.createClient(conn)
client := c.createFrontendNvmeClient(conn)
response, err := client.CreateNvmeNamespace(
ctx,
&pb.CreateNvmeNamespaceRequest{
Expand Down Expand Up @@ -49,7 +49,7 @@ func (c *Client) DeleteNvmeNamespace(
}
defer connClose()

client := c.createClient(conn)
client := c.createFrontendNvmeClient(conn)
_, err = client.DeleteNvmeNamespace(
ctx,
&pb.DeleteNvmeNamespaceRequest{
Expand Down
2 changes: 1 addition & 1 deletion storage/nvme_namespace_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 Intel Corporation
// Copyright (C) 2023-2024 Intel Corporation

// Package storage implements the go library for OPI to be used in storage, for example, CSI drivers
package storage
Expand Down
6 changes: 3 additions & 3 deletions storage/nvme_subsystem.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 Intel Corporation
// Copyright (C) 2023-2024 Intel Corporation

// Package storage implements the go library for OPI to be used in storage, for example, CSI drivers
package storage
Expand All @@ -21,7 +21,7 @@ func (c *Client) CreateNvmeSubsystem(
}
defer connClose()

client := c.createClient(conn)
client := c.createFrontendNvmeClient(conn)
response, err := client.CreateNvmeSubsystem(
ctx,
&pb.CreateNvmeSubsystemRequest{
Expand Down Expand Up @@ -49,7 +49,7 @@ func (c *Client) DeleteNvmeSubsystem(
}
defer connClose()

client := c.createClient(conn)
client := c.createFrontendNvmeClient(conn)
_, err = client.DeleteNvmeSubsystem(
ctx,
&pb.DeleteNvmeSubsystemRequest{
Expand Down
2 changes: 1 addition & 1 deletion storage/nvme_subsystem_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 Intel Corporation
// Copyright (C) 2023-2024 Intel Corporation

// Package storage implements the go library for OPI to be used in storage, for example, CSI drivers
package storage
Expand Down
4 changes: 2 additions & 2 deletions storage/virtio_blk.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func (c *Client) CreateVirtioBlk(
}
defer connClose()

client := c.createVirtioBlkClient(conn)
client := c.createFrontendVirtioBlkClient(conn)
response, err := client.CreateVirtioBlk(
ctx,
&pb.CreateVirtioBlkRequest{
Expand Down Expand Up @@ -54,7 +54,7 @@ func (c *Client) DeleteVirtioBlk(
}
defer connClose()

client := c.createVirtioBlkClient(conn)
client := c.createFrontendVirtioBlkClient(conn)
_, err = client.DeleteVirtioBlk(
ctx,
&pb.DeleteVirtioBlkRequest{
Expand Down

0 comments on commit 9b0d83b

Please sign in to comment.