lock

package
v0.0.0-...-52cd4e6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package lock provide Lock and Unlock when manage the disk

Package lock provide Lock and Unlock when manage the disk

Index

Constants

View Source
const (

	// GetLockTimeoutSec is the maximum number of seconds to acquire a lock
	GetLockTimeoutSec = 30
	// GetSemaphoreTimeout is used to determine whether the acquisition of semaphore is time out
	GetSemaphoreTimeout = "get semaphore timeout"
	// GetLockTimeout is used to determine whether the acquisition of semaphore is time out
	GetLockTimeout = "get lock timeout"
)

Variables

This section is empty.

Functions

func InitLock

func InitLock(driverName string) error

InitLock provide three semaphores for device connect, disconnect and expand

func SyncLock

func SyncLock(ctx context.Context, lockName, operationType string) error

SyncLock provide lock for device connect, disconnect and expand

func SyncUnlock

func SyncUnlock(ctx context.Context, lockName, operationType string) error

SyncUnlock provide unlock for device connect, disconnect and expand

Types

type Lock

type Lock interface {
	SyncLock(lockName string)

	SyncUnlock(lockName string)
}

Lock is a special lock interface provided for disk management

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL