From 164d10a824fb802a83463b28628712daa734d1b8 Mon Sep 17 00:00:00 2001 From: Humble Chirammal Date: Sun, 6 Jan 2019 14:48:53 +0530 Subject: [PATCH] Update exported function details with source code comments. Signed-off-by: Humble Chirammal --- pkg/apis/volumesnapshot/v1alpha1/types.go | 2 +- pkg/connection/connection.go | 1 + pkg/controller/csi_handler.go | 1 + pkg/controller/snapshot_controller.go | 1 + pkg/controller/util.go | 2 +- 5 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/apis/volumesnapshot/v1alpha1/types.go b/pkg/apis/volumesnapshot/v1alpha1/types.go index c0740683..65c1aafa 100644 --- a/pkg/apis/volumesnapshot/v1alpha1/types.go +++ b/pkg/apis/volumesnapshot/v1alpha1/types.go @@ -214,7 +214,7 @@ type VolumeSnapshotSource struct { CSI *CSIVolumeSnapshotSource `json:"csiVolumeSnapshotSource,omitempty"` } -// Represents the source from CSI volume snapshot +// CSIVolumeSnapshotSource represents the source from CSI volume snapshot type CSIVolumeSnapshotSource struct { // Driver is the name of the driver to use for this snapshot. // This MUST be the same name returned by the CSI GetPluginName() call for diff --git a/pkg/connection/connection.go b/pkg/connection/connection.go index f83b7765..45e94815 100644 --- a/pkg/connection/connection.go +++ b/pkg/connection/connection.go @@ -72,6 +72,7 @@ var ( _ CSIConnection = &csiConnection{} ) +// New returns a CSI connection object. func New(address string, timeout time.Duration) (CSIConnection, error) { conn, err := connect(address, timeout) if err != nil { diff --git a/pkg/controller/csi_handler.go b/pkg/controller/csi_handler.go index 3a00e76e..e0c7e7e3 100644 --- a/pkg/controller/csi_handler.go +++ b/pkg/controller/csi_handler.go @@ -42,6 +42,7 @@ type csiHandler struct { snapshotNameUUIDLength int } +// NewCSIHandler returns a handler which includes the csi connection and Snapshot name details func NewCSIHandler( csiConnection connection.CSIConnection, timeout time.Duration, diff --git a/pkg/controller/snapshot_controller.go b/pkg/controller/snapshot_controller.go index d462a555..621aedd2 100644 --- a/pkg/controller/snapshot_controller.go +++ b/pkg/controller/snapshot_controller.go @@ -440,6 +440,7 @@ func getSnapshotStatusForLogging(snapshot *crdv1.VolumeSnapshot) string { return fmt.Sprintf("bound to: %q, Completed: %v", snapshot.Spec.SnapshotContentName, snapshot.Status.ReadyToUse) } +// IsSnapshotBound returns true/false if snapshot is bound func IsSnapshotBound(snapshot *crdv1.VolumeSnapshot, content *crdv1.VolumeSnapshotContent) bool { if content.Spec.VolumeSnapshotRef != nil && content.Spec.VolumeSnapshotRef.Name == snapshot.Name && content.Spec.VolumeSnapshotRef.UID == snapshot.UID { diff --git a/pkg/controller/util.go b/pkg/controller/util.go index 570099c4..076bb1af 100644 --- a/pkg/controller/util.go +++ b/pkg/controller/util.go @@ -320,7 +320,7 @@ func getCredentials(k8s kubernetes.Interface, ref *v1.SecretReference) (map[stri return credentials, nil } -// Returns 0 for resyncPeriod in case resyncing is not needed. +// NoResyncPeriodFunc Returns 0 for resyncPeriod in case resyncing is not needed. func NoResyncPeriodFunc() time.Duration { return 0 }