Skip to content

Rename API to HostAPI #268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion integrationtests/disk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"time"

"github.com/kubernetes-csi/csi-proxy/pkg/disk"
diskapi "github.com/kubernetes-csi/csi-proxy/pkg/disk/api"
diskapi "github.com/kubernetes-csi/csi-proxy/pkg/disk/hostapi"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down
2 changes: 1 addition & 1 deletion integrationtests/filesystem_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/stretchr/testify/require"

"github.com/kubernetes-csi/csi-proxy/pkg/filesystem"
filesystemapi "github.com/kubernetes-csi/csi-proxy/pkg/filesystem/api"
filesystemapi "github.com/kubernetes-csi/csi-proxy/pkg/filesystem/hostapi"
)

func TestFilesystem(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions integrationtests/iscsi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
"testing"

disk "github.com/kubernetes-csi/csi-proxy/pkg/disk"
diskapi "github.com/kubernetes-csi/csi-proxy/pkg/disk/api"
diskapi "github.com/kubernetes-csi/csi-proxy/pkg/disk/hostapi"
iscsi "github.com/kubernetes-csi/csi-proxy/pkg/iscsi"
iscsiapi "github.com/kubernetes-csi/csi-proxy/pkg/iscsi/api"
iscsiapi "github.com/kubernetes-csi/csi-proxy/pkg/iscsi/hostapi"
system "github.com/kubernetes-csi/csi-proxy/pkg/system"
systemapi "github.com/kubernetes-csi/csi-proxy/pkg/system/api"
systemapi "github.com/kubernetes-csi/csi-proxy/pkg/system/hostapi"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down
4 changes: 2 additions & 2 deletions integrationtests/smb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import (
"github.com/stretchr/testify/require"

fs "github.com/kubernetes-csi/csi-proxy/pkg/filesystem"
fsapi "github.com/kubernetes-csi/csi-proxy/pkg/filesystem/api"
fsapi "github.com/kubernetes-csi/csi-proxy/pkg/filesystem/hostapi"
"github.com/kubernetes-csi/csi-proxy/pkg/smb"
smbapi "github.com/kubernetes-csi/csi-proxy/pkg/smb/api"
smbapi "github.com/kubernetes-csi/csi-proxy/pkg/smb/hostapi"
)

func TestSMB(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion integrationtests/system_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"testing"

system "github.com/kubernetes-csi/csi-proxy/pkg/system"
systemapi "github.com/kubernetes-csi/csi-proxy/pkg/system/api"
systemapi "github.com/kubernetes-csi/csi-proxy/pkg/system/hostapi"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down
4 changes: 2 additions & 2 deletions integrationtests/volume_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"testing"

disk "github.com/kubernetes-csi/csi-proxy/pkg/disk"
diskapi "github.com/kubernetes-csi/csi-proxy/pkg/disk/api"
diskapi "github.com/kubernetes-csi/csi-proxy/pkg/disk/hostapi"
volume "github.com/kubernetes-csi/csi-proxy/pkg/volume"
volumeapi "github.com/kubernetes-csi/csi-proxy/pkg/volume/api"
volumeapi "github.com/kubernetes-csi/csi-proxy/pkg/volume/hostapi"

"github.com/stretchr/testify/require"
)
Expand Down
6 changes: 3 additions & 3 deletions pkg/disk/disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package disk
import (
"context"

diskapi "github.com/kubernetes-csi/csi-proxy/pkg/disk/api"
diskapi "github.com/kubernetes-csi/csi-proxy/pkg/disk/hostapi"
"k8s.io/klog/v2"
)

type Disk struct {
hostAPI diskapi.API
hostAPI diskapi.HostAPI
}

type Interface interface {
Expand Down Expand Up @@ -39,7 +39,7 @@ type Interface interface {
// check that Disk implements Interface
var _ Interface = &Disk{}

func New(hostAPI diskapi.API) (*Disk, error) {
func New(hostAPI diskapi.HostAPI) (*Disk, error) {
return &Disk{
hostAPI: hostAPI,
}, nil
Expand Down
6 changes: 3 additions & 3 deletions pkg/disk/api/api.go → pkg/disk/hostapi/hostapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ const (
IOCTL_STORAGE_QUERY_PROPERTY = 0x002d1400
)

// API declares the interface exposed by the internal API
type API interface {
// HostAPI declares the interface exposed by the internal API
type HostAPI interface {
// ListDiskLocations - constructs a map with the disk number as the key and the DiskLocation structure
// as the value. The DiskLocation struct has various fields like the Adapter, Bus, Target and LUNID.
ListDiskLocations() (map[uint32]DiskLocation, error)
Expand Down Expand Up @@ -55,7 +55,7 @@ type API interface {
type DiskAPI struct{}

// ensure that DiskAPI implements the exposed API
var _ API = &DiskAPI{}
var _ HostAPI = &DiskAPI{}

func New() DiskAPI {
return DiskAPI{}
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions pkg/filesystem/filesystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package filesystem
import (
"context"

filesystemapi "github.com/kubernetes-csi/csi-proxy/pkg/filesystem/api"
filesystemapi "github.com/kubernetes-csi/csi-proxy/pkg/filesystem/hostapi"
"k8s.io/klog/v2"
)

type Filesystem struct {
hostAPI filesystemapi.API
hostAPI filesystemapi.HostAPI
}

type Interface interface {
Expand Down Expand Up @@ -41,7 +41,7 @@ type Interface interface {
// check that Filesystem implements Interface
var _ Interface = &Filesystem{}

func New(hostAPI filesystemapi.API) (*Filesystem, error) {
func New(hostAPI filesystemapi.HostAPI) (*Filesystem, error) {
return &Filesystem{
hostAPI: hostAPI,
}, nil
Expand Down
4 changes: 2 additions & 2 deletions pkg/filesystem/filesystem_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import (
"context"
"testing"

fsapi "github.com/kubernetes-csi/csi-proxy/pkg/filesystem/api"
fsapi "github.com/kubernetes-csi/csi-proxy/pkg/filesystem/hostapi"
)

type fakeFileSystemAPI struct{}

var _ fsapi.API = &fakeFileSystemAPI{}
var _ fsapi.HostAPI = &fakeFileSystemAPI{}

func (fakeFileSystemAPI) PathExists(path string) (bool, error) {
return true, nil
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions pkg/filesystem/api/api.go → pkg/filesystem/hostapi/hotsapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
// pkg/filesystem/filesystem.go so that logic can be easily unit-tested
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed a typo in the filename, hots -> host

// without requiring specific OS environments.

// API is the exposed Filesystem API
type API interface {
// HostAPI is the exposed Filesystem API
type HostAPI interface {
PathExists(path string) (bool, error)
PathValid(path string) (bool, error)
Mkdir(path string) error
Expand All @@ -27,10 +27,10 @@ type API interface {

type filesystemAPI struct{}

// check that filesystemAPI implements API
var _ API = &filesystemAPI{}
// check that filesystemAPI implements HostAPI
var _ HostAPI = &filesystemAPI{}

func New() API {
func New() HostAPI {
return filesystemAPI{}
}

Expand Down
8 changes: 4 additions & 4 deletions pkg/iscsi/api/api.go → pkg/iscsi/hostapi/hostapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
// pkg/iscsi/iscsi.go so that logic can be easily unit-tested
// without requiring specific OS environments.

type API interface {
type HostAPI interface {
AddTargetPortal(portal *TargetPortal) error
DiscoverTargetPortal(portal *TargetPortal) ([]string, error)
ListTargetPortals() ([]TargetPortal, error)
Expand All @@ -26,10 +26,10 @@ type API interface {

type iscsiAPI struct{}

// check that iscsiAPI implements API
var _ API = &iscsiAPI{}
// check that iscsiAPI implements HostAPI
var _ HostAPI = &iscsiAPI{}

func New() API {
func New() HostAPI {
return iscsiAPI{}
}

Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions pkg/iscsi/iscsi.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import (
"context"
"fmt"

iscsiapi "github.com/kubernetes-csi/csi-proxy/pkg/iscsi/api"
iscsiapi "github.com/kubernetes-csi/csi-proxy/pkg/iscsi/hostapi"
"k8s.io/klog/v2"
)

const defaultISCSIPort = 3260

type ISCSI struct {
hostAPI iscsiapi.API
hostAPI iscsiapi.HostAPI
}

type Interface interface {
Expand Down Expand Up @@ -53,7 +53,7 @@ type Interface interface {

var _ Interface = &ISCSI{}

func New(hostAPI iscsiapi.API) (*ISCSI, error) {
func New(hostAPI iscsiapi.HostAPI) (*ISCSI, error) {
return &ISCSI{
hostAPI: hostAPI,
}, nil
Expand Down
6 changes: 3 additions & 3 deletions pkg/smb/api/api.go → pkg/smb/hostapi/hostapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/kubernetes-csi/csi-proxy/pkg/utils"
)

type API interface {
type HostAPI interface {
IsSMBMapped(remotePath string) (bool, error)
NewSMBLink(remotePath, localPath string) error
NewSMBGlobalMapping(remotePath, username, password string) error
Expand All @@ -16,9 +16,9 @@ type API interface {

type smbAPI struct{}

var _ API = &smbAPI{}
var _ HostAPI = &smbAPI{}

func New() API {
func New() HostAPI {
return smbAPI{}
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/smb/smb.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import (
"strings"

fs "github.com/kubernetes-csi/csi-proxy/pkg/filesystem"
smbapi "github.com/kubernetes-csi/csi-proxy/pkg/smb/api"
smbapi "github.com/kubernetes-csi/csi-proxy/pkg/smb/hostapi"
"k8s.io/klog/v2"
)

type SMB struct {
hostAPI smbapi.API
hostAPI smbapi.HostAPI
fs fs.Interface
}

Expand Down Expand Up @@ -51,7 +51,7 @@ func getRootMappingPath(path string) (string, error) {
return strings.ToLower("\\\\" + parts[0] + "\\" + parts[1]), nil
}

func New(hostAPI smbapi.API, fsClient fs.Interface) (*SMB, error) {
func New(hostAPI smbapi.HostAPI, fsClient fs.Interface) (*SMB, error) {
return &SMB{
hostAPI: hostAPI,
fs: fsClient,
Expand Down
8 changes: 4 additions & 4 deletions pkg/smb/smb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import (
"testing"

fs "github.com/kubernetes-csi/csi-proxy/pkg/filesystem"
fsapi "github.com/kubernetes-csi/csi-proxy/pkg/filesystem/api"
smbapi "github.com/kubernetes-csi/csi-proxy/pkg/smb/api"
fsapi "github.com/kubernetes-csi/csi-proxy/pkg/filesystem/hostapi"
smbapi "github.com/kubernetes-csi/csi-proxy/pkg/smb/hostapi"
)

type fakeSMBAPI struct{}

var _ smbapi.API = &fakeSMBAPI{}
var _ smbapi.HostAPI = &fakeSMBAPI{}

func (fakeSMBAPI) NewSMBGlobalMapping(remotePath, username, password string) error {
return nil
Expand All @@ -31,7 +31,7 @@ func (fakeSMBAPI) NewSMBLink(remotePath, localPath string) error {

type fakeFileSystemAPI struct{}

var _ fsapi.API = &fakeFileSystemAPI{}
var _ fsapi.HostAPI = &fakeFileSystemAPI{}

func (fakeFileSystemAPI) PathExists(path string) (bool, error) {
return true, nil
Expand Down
7 changes: 5 additions & 2 deletions pkg/system/api/api.go → pkg/system/hostapi/hostapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
// pkg/system/system.go so that logic can be easily unit-tested
// without requiring specific OS environments.

type API interface {
type HostAPI interface {
GetBIOSSerialNumber() (string, error)
GetService(name string) (*ServiceInfo, error)
StartService(name string) error
Expand All @@ -23,7 +23,10 @@ type API interface {

type systemAPI struct{}

func New() API {
// check that systemAPI implements HostAPI
var _ HostAPI = &systemAPI{}

func New() HostAPI {
return systemAPI{}
}

Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions pkg/system/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package system
import (
"context"

systemapi "github.com/kubernetes-csi/csi-proxy/pkg/system/api"
systemapi "github.com/kubernetes-csi/csi-proxy/pkg/system/hostapi"
"k8s.io/klog/v2"
)

type System struct {
hostAPI systemapi.API
hostAPI systemapi.HostAPI
}

type Interface interface {
Expand All @@ -32,7 +32,7 @@ type Interface interface {
// check that System implements Interface
var _ Interface = &System{}

func New(hostAPI systemapi.API) (*System, error) {
func New(hostAPI systemapi.HostAPI) (*System, error) {
return &System{
hostAPI: hostAPI,
}, nil
Expand Down
10 changes: 5 additions & 5 deletions pkg/volume/api/api.go → pkg/volume/hostapi/hostapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
"k8s.io/klog/v2"
)

// API exposes the internal volume operations available in the server
type API interface {
// HostAPI exposes the internal volume operations available in the server
type HostAPI interface {
// ListVolumesOnDisk lists volumes on a disk identified by a `diskNumber` and optionally a partition identified by `partitionNumber`.
ListVolumesOnDisk(diskNumber uint32, partitionNumber uint32) (volumeIDs []string, err error)
// MountVolume mounts the volume at the requested global staging target path.
Expand Down Expand Up @@ -42,8 +42,8 @@ type API interface {
// volumeAPI implements the internal Volume APIs
type volumeAPI struct{}

// verifies that the API is implemented
var _ API = &volumeAPI{}
// verifies that HostAPI is implemented
var _ HostAPI = &volumeAPI{}

var (
// VolumeRegexp matches a Windows Volume
Expand All @@ -57,7 +57,7 @@ var (
)

// New - Construct a new Volume API Implementation.
func New() API {
func New() HostAPI {
return &volumeAPI{}
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/volume/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import (
"context"
"fmt"

volumeapi "github.com/kubernetes-csi/csi-proxy/pkg/volume/api"
volumeapi "github.com/kubernetes-csi/csi-proxy/pkg/volume/hostapi"
"k8s.io/klog/v2"
)

// Volume wraps the host API and implements the interface
type Volume struct {
hostAPI volumeapi.API
hostAPI volumeapi.HostAPI
}

type Interface interface {
Expand Down Expand Up @@ -53,7 +53,7 @@ type Interface interface {

var _ Interface = &Volume{}

func New(hostAPI volumeapi.API) (*Volume, error) {
func New(hostAPI volumeapi.HostAPI) (*Volume, error) {
return &Volume{
hostAPI: hostAPI,
}, nil
Expand Down
Loading