From fd2053666227fa7546535a37df9c4667171a5f1a Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Fri, 19 Jul 2024 20:21:57 +0200 Subject: [PATCH] rbd: add journalledObject as base for VolumeGroup interface Signed-off-by: Niels de Vos --- internal/rbd/types/group.go | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/internal/rbd/types/group.go b/internal/rbd/types/group.go index d3c806a3b..322230952 100644 --- a/internal/rbd/types/group.go +++ b/internal/rbd/types/group.go @@ -23,9 +23,24 @@ import ( "github.com/csi-addons/spec/lib/go/volumegroup" ) -// VolumeGroup contains a number of volumes, and can be used to create a -// VolumeGroupSnapshot. +type journalledObject interface { + // GetID returns the CSI-Addons VolumeGroupId of the VolumeGroup. + GetID(ctx context.Context) (string, error) + + // GetName returns the name in the backend storage for the VolumeGroup. + GetName(ctx context.Context) (string, error) + + // GetPool returns the name of the pool that holds the VolumeGroup. + GetPool(ctx context.Context) (string, error) + + // GetClusterID returns the ID of the cluster of the VolumeGroup. + GetClusterID(ctx context.Context) (string, error) +} + +// VolumeGroup contains a number of volumes. type VolumeGroup interface { + journalledObject + // Destroy frees the resources used by the VolumeGroup. Destroy(ctx context.Context) @@ -34,12 +49,6 @@ type VolumeGroup interface { // needs to add/remove itself from the VolumeGroup. GetIOContext(ctx context.Context) (*rados.IOContext, error) - // GetID returns the CSI-Addons VolumeGroupId of the VolumeGroup. - GetID(ctx context.Context) (string, error) - - // GetName returns the name in the backend storage for the VolumeGroup. - GetName(ctx context.Context) (string, error) - // ToCSI creates a CSI-Addons type for the VolumeGroup. ToCSI(ctx context.Context) (*volumegroup.VolumeGroup, error)