From 86b9fb158450be68bdc8952ab454e945e580d36a Mon Sep 17 00:00:00 2001 From: Artsiom Koltun Date: Fri, 12 Jan 2024 13:45:06 +0100 Subject: [PATCH] refactor(storage): rename create*Client to createFrontend*Client Signed-off-by: Artsiom Koltun --- storage/client.go | 26 +++++++++++++------------- storage/nvme_controller.go | 8 ++++---- storage/nvme_controller_test.go | 2 +- storage/nvme_namespace.go | 6 +++--- storage/nvme_namespace_test.go | 2 +- storage/nvme_subsystem.go | 6 +++--- storage/nvme_subsystem_test.go | 2 +- storage/virtio_blk.go | 4 ++-- 8 files changed, 28 insertions(+), 28 deletions(-) diff --git a/storage/client.go b/storage/client.go index 07991c0..ee14493 100644 --- a/storage/client.go +++ b/storage/client.go @@ -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 } @@ -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 } diff --git a/storage/nvme_controller.go b/storage/nvme_controller.go index 15521c9..145f390 100644 --- a/storage/nvme_controller.go +++ b/storage/nvme_controller.go @@ -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 @@ -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{ @@ -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{ @@ -106,7 +106,7 @@ func (c *Client) DeleteNvmeController( } defer connClose() - client := c.createClient(conn) + client := c.createFrontendNvmeClient(conn) _, err = client.DeleteNvmeController( ctx, &pb.DeleteNvmeControllerRequest{ diff --git a/storage/nvme_controller_test.go b/storage/nvme_controller_test.go index e45341a..62e372b 100644 --- a/storage/nvme_controller_test.go +++ b/storage/nvme_controller_test.go @@ -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 diff --git a/storage/nvme_namespace.go b/storage/nvme_namespace.go index 7cb26d2..dea6676 100644 --- a/storage/nvme_namespace.go +++ b/storage/nvme_namespace.go @@ -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 @@ -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{ @@ -49,7 +49,7 @@ func (c *Client) DeleteNvmeNamespace( } defer connClose() - client := c.createClient(conn) + client := c.createFrontendNvmeClient(conn) _, err = client.DeleteNvmeNamespace( ctx, &pb.DeleteNvmeNamespaceRequest{ diff --git a/storage/nvme_namespace_test.go b/storage/nvme_namespace_test.go index b7b3a9b..93e9035 100644 --- a/storage/nvme_namespace_test.go +++ b/storage/nvme_namespace_test.go @@ -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 diff --git a/storage/nvme_subsystem.go b/storage/nvme_subsystem.go index 89f4d7a..90276dc 100644 --- a/storage/nvme_subsystem.go +++ b/storage/nvme_subsystem.go @@ -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 @@ -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{ @@ -49,7 +49,7 @@ func (c *Client) DeleteNvmeSubsystem( } defer connClose() - client := c.createClient(conn) + client := c.createFrontendNvmeClient(conn) _, err = client.DeleteNvmeSubsystem( ctx, &pb.DeleteNvmeSubsystemRequest{ diff --git a/storage/nvme_subsystem_test.go b/storage/nvme_subsystem_test.go index 6eda6ff..37cd087 100644 --- a/storage/nvme_subsystem_test.go +++ b/storage/nvme_subsystem_test.go @@ -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 diff --git a/storage/virtio_blk.go b/storage/virtio_blk.go index 250656f..344b854 100644 --- a/storage/virtio_blk.go +++ b/storage/virtio_blk.go @@ -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{ @@ -54,7 +54,7 @@ func (c *Client) DeleteVirtioBlk( } defer connClose() - client := c.createVirtioBlkClient(conn) + client := c.createFrontendVirtioBlkClient(conn) _, err = client.DeleteVirtioBlk( ctx, &pb.DeleteVirtioBlkRequest{