From 67f966dff7ad6cd59b125d14e85bb6a2b704c2a3 Mon Sep 17 00:00:00 2001 From: Praveen M Date: Tue, 4 Mar 2025 15:40:39 +0530 Subject: [PATCH] cleanup: move Destroy() method to journalledObject interface VolumeGroup interface has more than 10 methods and it causes golangci-lint to fail. Moving the `Destroy()` method to a base interface journalledObject. Signed-off-by: Praveen M (cherry picked from commit add4b36900d59160069190613343ce5749195ff6) # Conflicts: # internal/rbd/types/volume.go --- internal/rbd/types/group.go | 6 +++--- internal/rbd/types/snapshot.go | 3 --- internal/rbd/types/volume.go | 5 +++++ internal/rbd/types/volume_group_snapshot.go | 3 --- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/internal/rbd/types/group.go b/internal/rbd/types/group.go index 08183f9fb..dbf22c746 100644 --- a/internal/rbd/types/group.go +++ b/internal/rbd/types/group.go @@ -37,15 +37,15 @@ type journalledObject interface { // GetClusterID returns the ID of the cluster of the object. GetClusterID(ctx context.Context) (string, error) + + // Destroy frees the resources used by the object. + Destroy(ctx context.Context) } // VolumeGroup contains a number of volumes. type VolumeGroup interface { journalledObject - // Destroy frees the resources used by the VolumeGroup. - Destroy(ctx context.Context) - // GetIOContext returns the IOContext for performing librbd operations // on the VolumeGroup. This is used by the rbdVolume struct when it // needs to add/remove itself from the VolumeGroup. diff --git a/internal/rbd/types/snapshot.go b/internal/rbd/types/snapshot.go index 954878216..66fb47d8f 100644 --- a/internal/rbd/types/snapshot.go +++ b/internal/rbd/types/snapshot.go @@ -28,9 +28,6 @@ import ( type Snapshot interface { journalledObject - // Destroy frees the resources used by the Snapshot. - Destroy(ctx context.Context) - // Delete removes the snapshot from the storage backend. Delete(ctx context.Context) error diff --git a/internal/rbd/types/volume.go b/internal/rbd/types/volume.go index fde0125b1..6addd18bb 100644 --- a/internal/rbd/types/volume.go +++ b/internal/rbd/types/volume.go @@ -28,8 +28,13 @@ import ( //nolint:interfacebloat // more than 10 methods are needed for the interface type Volume interface { journalledObject +<<<<<<< HEAD // Destroy frees the resources used by the Volume. Destroy(ctx context.Context) +======= + snapshottableVolume + csiAddonsVolume +>>>>>>> add4b369 (cleanup: move Destroy() method to journalledObject interface) // Delete removes the volume from the storage backend. Delete(ctx context.Context) error diff --git a/internal/rbd/types/volume_group_snapshot.go b/internal/rbd/types/volume_group_snapshot.go index 7d9d42e28..fc4f41cb1 100644 --- a/internal/rbd/types/volume_group_snapshot.go +++ b/internal/rbd/types/volume_group_snapshot.go @@ -29,9 +29,6 @@ import ( type VolumeGroupSnapshot interface { journalledObject - // Destroy frees the resources used by the VolumeGroupSnapshot. - Destroy(ctx context.Context) - // Delete removes the VolumeGroupSnapshot from the storage backend. Delete(ctx context.Context) error