Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrLocked when locking an key that is already locked. ErrLocked = errors.New("key is locked") )
Functions ¶
This section is empty.
Types ¶
type Client ¶ added in v1.0.0
type Client struct {
// contains filtered or unexported fields
}
Client holds lock configuration.
func NewTestClient ¶ added in v1.0.0
NewTestClient returns a test client with in-memory storage that can be used for lock testing.
func (*Client) Lock ¶ added in v1.0.0
Lock creates a new lock with "key" as a unique identifier. The lock will expire after the specified duration. Returns ErrLocked if the lock already exists and has not expired.
func (*Client) Run ¶ added in v1.0.0
Run acquires a lock under the specified key, executes the command, and then unlocks the key. Returns ErrLocked if the key is already locked. Otherwise returns combined stdout and stderr of the command and the command error. If the unlock step fails the lock expires after 24 hours.
Click to show internal directories.
Click to hide internal directories.