Skip to content

Commit

Permalink
rbd: refractor mirroring of image
Browse files Browse the repository at this point in the history
refractoring rbd image methods to
implement Mirror interface.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
  • Loading branch information
Madhu-1 committed Jul 26, 2024
1 parent fab3289 commit 7852a78
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions internal/rbd/types/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@ import (
"context"

"github.com/container-storage-interface/spec/lib/go/csi"
"google.golang.org/protobuf/types/known/timestamppb"
)

//nolint:interfacebloat // more than 10 methods are needed for the interface
type Volume interface {
// Mirror interface implementation
Mirror
// Destroy frees the resources used by the Volume.
Destroy(ctx context.Context)

Expand All @@ -40,4 +44,21 @@ type Volume interface {

// RemoveFromGroup removes the Volume from the VolumeGroup.
RemoveFromGroup(ctx context.Context, vg VolumeGroup) error

// GetPoolName returns the name of the pool where the volume is stored.
GetPoolName() string
// GetCreationTime returns the creation time of the volume.
GetCreationTime() (*timestamppb.Timestamp, error)
// GetMetadata returns the value of the metadata key from the volume.
GetMetadata(key string) (string, error)
// SetMetadata sets the value of the metadata key on the volume.
SetMetadata(key, value string) error
// RepairResyncedImageID updates the existing image ID with new one in OMAP.
RepairResyncedImageID(ctx context.Context, ready bool) error
// HandleParentImageExistence checks the image's parent.
// if the parent image does not exist and is not in trash, it returns nil.
// if the flattenMode is FlattenModeForce, it flattens the image itself.
// if the parent image is in trash, it returns an error.
// if the parent image exists and is not enabled for mirroring, it returns an error.
HandleParentImageExistence(ctx context.Context, flattenMode FlattenMode) error
}

0 comments on commit 7852a78

Please sign in to comment.