mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 02:43:36 +00:00
cleanup: address golangci 'funcorder' linter problems
The new 'funcorder' linter expects all public functions to be placed before private functions of a struct. Many private functions needed moving further down into their files. Some files had many issues reported. To reduce the churn in those files, they have been annotated with a `//nolint:funcorder` comment. Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
committed by
mergify[bot]
parent
0907f39d95
commit
0a22e3a186
@ -108,6 +108,59 @@ func NewOperationLock() *OperationLock {
|
||||
}
|
||||
}
|
||||
|
||||
// GetSnapshotCreateLock gets the snapshot lock on given volumeID.
|
||||
func (ol *OperationLock) GetSnapshotCreateLock(volumeID string) error {
|
||||
return ol.tryAcquire(createOp, volumeID)
|
||||
}
|
||||
|
||||
// GetCloneLock gets the clone lock on given volumeID.
|
||||
func (ol *OperationLock) GetCloneLock(volumeID string) error {
|
||||
return ol.tryAcquire(cloneOpt, volumeID)
|
||||
}
|
||||
|
||||
// GetDeleteLock gets the delete lock on given volumeID,ensures that there is
|
||||
// no clone,restore and expand operation on given volumeID.
|
||||
func (ol *OperationLock) GetDeleteLock(volumeID string) error {
|
||||
return ol.tryAcquire(deleteOp, volumeID)
|
||||
}
|
||||
|
||||
// GetRestoreLock gets the restore lock on given volumeID,ensures that there is
|
||||
// no delete operation on given volumeID.
|
||||
func (ol *OperationLock) GetRestoreLock(volumeID string) error {
|
||||
return ol.tryAcquire(restoreOp, volumeID)
|
||||
}
|
||||
|
||||
// GetExpandLock gets the expand lock on given volumeID,ensures that there is
|
||||
// no delete and clone operation on given volumeID.
|
||||
func (ol *OperationLock) GetExpandLock(volumeID string) error {
|
||||
return ol.tryAcquire(expandOp, volumeID)
|
||||
}
|
||||
|
||||
// ReleaseSnapshotCreateLock releases the create lock on given volumeID.
|
||||
func (ol *OperationLock) ReleaseSnapshotCreateLock(volumeID string) {
|
||||
ol.release(createOp, volumeID)
|
||||
}
|
||||
|
||||
// ReleaseCloneLock releases the clone lock on given volumeID.
|
||||
func (ol *OperationLock) ReleaseCloneLock(volumeID string) {
|
||||
ol.release(cloneOpt, volumeID)
|
||||
}
|
||||
|
||||
// ReleaseDeleteLock releases the delete lock on given volumeID.
|
||||
func (ol *OperationLock) ReleaseDeleteLock(volumeID string) {
|
||||
ol.release(deleteOp, volumeID)
|
||||
}
|
||||
|
||||
// ReleaseRestoreLock releases the restore lock on given volumeID.
|
||||
func (ol *OperationLock) ReleaseRestoreLock(volumeID string) {
|
||||
ol.release(restoreOp, volumeID)
|
||||
}
|
||||
|
||||
// ReleaseExpandLock releases the expand lock on given volumeID.
|
||||
func (ol *OperationLock) ReleaseExpandLock(volumeID string) {
|
||||
ol.release(expandOp, volumeID)
|
||||
}
|
||||
|
||||
// tryAcquire tries to acquire the lock for operating on volumeID and returns true if successful.
|
||||
// If another operation is already using volumeID, returns false.
|
||||
func (ol *OperationLock) tryAcquire(op operation, volumeID string) error {
|
||||
@ -178,59 +231,6 @@ func (ol *OperationLock) tryAcquire(op operation, volumeID string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetSnapshotCreateLock gets the snapshot lock on given volumeID.
|
||||
func (ol *OperationLock) GetSnapshotCreateLock(volumeID string) error {
|
||||
return ol.tryAcquire(createOp, volumeID)
|
||||
}
|
||||
|
||||
// GetCloneLock gets the clone lock on given volumeID.
|
||||
func (ol *OperationLock) GetCloneLock(volumeID string) error {
|
||||
return ol.tryAcquire(cloneOpt, volumeID)
|
||||
}
|
||||
|
||||
// GetDeleteLock gets the delete lock on given volumeID,ensures that there is
|
||||
// no clone,restore and expand operation on given volumeID.
|
||||
func (ol *OperationLock) GetDeleteLock(volumeID string) error {
|
||||
return ol.tryAcquire(deleteOp, volumeID)
|
||||
}
|
||||
|
||||
// GetRestoreLock gets the restore lock on given volumeID,ensures that there is
|
||||
// no delete operation on given volumeID.
|
||||
func (ol *OperationLock) GetRestoreLock(volumeID string) error {
|
||||
return ol.tryAcquire(restoreOp, volumeID)
|
||||
}
|
||||
|
||||
// GetExpandLock gets the expand lock on given volumeID,ensures that there is
|
||||
// no delete and clone operation on given volumeID.
|
||||
func (ol *OperationLock) GetExpandLock(volumeID string) error {
|
||||
return ol.tryAcquire(expandOp, volumeID)
|
||||
}
|
||||
|
||||
// ReleaseSnapshotCreateLock releases the create lock on given volumeID.
|
||||
func (ol *OperationLock) ReleaseSnapshotCreateLock(volumeID string) {
|
||||
ol.release(createOp, volumeID)
|
||||
}
|
||||
|
||||
// ReleaseCloneLock releases the clone lock on given volumeID.
|
||||
func (ol *OperationLock) ReleaseCloneLock(volumeID string) {
|
||||
ol.release(cloneOpt, volumeID)
|
||||
}
|
||||
|
||||
// ReleaseDeleteLock releases the delete lock on given volumeID.
|
||||
func (ol *OperationLock) ReleaseDeleteLock(volumeID string) {
|
||||
ol.release(deleteOp, volumeID)
|
||||
}
|
||||
|
||||
// ReleaseRestoreLock releases the restore lock on given volumeID.
|
||||
func (ol *OperationLock) ReleaseRestoreLock(volumeID string) {
|
||||
ol.release(restoreOp, volumeID)
|
||||
}
|
||||
|
||||
// ReleaseExpandLock releases the expand lock on given volumeID.
|
||||
func (ol *OperationLock) ReleaseExpandLock(volumeID string) {
|
||||
ol.release(expandOp, volumeID)
|
||||
}
|
||||
|
||||
// release deletes the lock on volumeID.
|
||||
func (ol *OperationLock) release(op operation, volumeID string) {
|
||||
ol.mux.Lock()
|
||||
|
Reference in New Issue
Block a user