cleanup: make VolumeGroupJournalConnection a private type

VolumeGroupJournalConnection is not used outside the internal/journal
package. There is no need to expose the type outside of the package, it
causes only confusion about the usage of the journalling API.

Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
Niels de Vos 2024-07-16 17:23:49 +02:00 committed by mergify[bot]
parent d46b7d7ff4
commit 435e26d948

View File

@ -77,11 +77,15 @@ type VolumeGroupJournalConfig struct {
Config Config
} }
type VolumeGroupJournalConnection struct { type volumeGroupJournalConnection struct {
config *VolumeGroupJournalConfig config *VolumeGroupJournalConfig
connection *Connection connection *Connection
} }
// assert that volumeGroupJournalConnection implements the VolumeGroupJournal
// interface.
var _ VolumeGroupJournal = &volumeGroupJournalConnection{}
// NewCSIVolumeGroupJournal returns an instance of VolumeGroupJournal for groups. // NewCSIVolumeGroupJournal returns an instance of VolumeGroupJournal for groups.
func NewCSIVolumeGroupJournal(suffix string) VolumeGroupJournalConfig { func NewCSIVolumeGroupJournal(suffix string) VolumeGroupJournalConfig {
return VolumeGroupJournalConfig{ return VolumeGroupJournalConfig{
@ -116,7 +120,7 @@ func (vgc *VolumeGroupJournalConfig) Connect(
namespace string, namespace string,
cr *util.Credentials, cr *util.Credentials,
) (VolumeGroupJournal, error) { ) (VolumeGroupJournal, error) {
vgjc := &VolumeGroupJournalConnection{} vgjc := &volumeGroupJournalConnection{}
vgjc.config = &VolumeGroupJournalConfig{ vgjc.config = &VolumeGroupJournalConfig{
Config: vgc.Config, Config: vgc.Config,
} }
@ -130,7 +134,7 @@ func (vgc *VolumeGroupJournalConfig) Connect(
} }
// Destroy frees any resources and invalidates the journal connection. // Destroy frees any resources and invalidates the journal connection.
func (vgjc *VolumeGroupJournalConnection) Destroy() { func (vgjc *volumeGroupJournalConnection) Destroy() {
vgjc.connection.Destroy() vgjc.connection.Destroy()
} }
@ -167,7 +171,7 @@ Return values:
reservation found. reservation found.
- error: non-nil in case of any errors. - error: non-nil in case of any errors.
*/ */
func (vgjc *VolumeGroupJournalConnection) CheckReservation(ctx context.Context, func (vgjc *volumeGroupJournalConnection) CheckReservation(ctx context.Context,
journalPool, reqName, namePrefix string, journalPool, reqName, namePrefix string,
) (*VolumeGroupData, error) { ) (*VolumeGroupData, error) {
var ( var (
@ -244,7 +248,7 @@ Input arguments:
- groupID: ID of the volume group, generated from the UUID - groupID: ID of the volume group, generated from the UUID
- reqName: Request name for the volume group - reqName: Request name for the volume group
*/ */
func (vgjc *VolumeGroupJournalConnection) UndoReservation(ctx context.Context, func (vgjc *volumeGroupJournalConnection) UndoReservation(ctx context.Context,
csiJournalPool, groupID, reqName string, csiJournalPool, groupID, reqName string,
) error { ) error {
// delete volume UUID omap (first, inverse of create order) // delete volume UUID omap (first, inverse of create order)
@ -303,7 +307,7 @@ Return values:
- string: Contains the VolumeGroup name that was reserved for the passed in reqName - string: Contains the VolumeGroup name that was reserved for the passed in reqName
- error: non-nil in case of any errors - error: non-nil in case of any errors
*/ */
func (vgjc *VolumeGroupJournalConnection) ReserveName(ctx context.Context, func (vgjc *volumeGroupJournalConnection) ReserveName(ctx context.Context,
journalPool, reqName, namePrefix string, journalPool, reqName, namePrefix string,
) (string, string, error) { ) (string, string, error) {
cj := vgjc.config cj := vgjc.config
@ -366,7 +370,7 @@ type VolumeGroupAttributes struct {
VolumeMap map[string]string // Contains the volumeID and the corresponding value mapping VolumeMap map[string]string // Contains the volumeID and the corresponding value mapping
} }
func (vgjc *VolumeGroupJournalConnection) GetVolumeGroupAttributes( func (vgjc *volumeGroupJournalConnection) GetVolumeGroupAttributes(
ctx context.Context, ctx context.Context,
pool, objectUUID string, pool, objectUUID string,
) (*VolumeGroupAttributes, error) { ) (*VolumeGroupAttributes, error) {
@ -401,7 +405,7 @@ func (vgjc *VolumeGroupJournalConnection) GetVolumeGroupAttributes(
return groupAttributes, nil return groupAttributes, nil
} }
func (vgjc *VolumeGroupJournalConnection) AddVolumesMapping( func (vgjc *volumeGroupJournalConnection) AddVolumesMapping(
ctx context.Context, ctx context.Context,
pool, pool,
reservedUUID string, reservedUUID string,
@ -418,7 +422,7 @@ func (vgjc *VolumeGroupJournalConnection) AddVolumesMapping(
return nil return nil
} }
func (vgjc *VolumeGroupJournalConnection) RemoveVolumesMapping( func (vgjc *volumeGroupJournalConnection) RemoveVolumesMapping(
ctx context.Context, ctx context.Context,
pool, pool,
reservedUUID string, reservedUUID string,