operationlock

package
v0.0.0-...-04e5504 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InstanceOperation

type InstanceOperation struct {
	// contains filtered or unexported fields
}

InstanceOperation operation locking.

func Create

func Create(instanceID int, action string, reusable bool, reuse bool) (*InstanceOperation, error)

Create creates a new operation lock for an Instance if one does not already exist and returns it. The lock will be released after 30s or when Done() is called, which ever occurs first. If reusable is set as true then future lock attempts can specify the reuse argument as true which will then trigger a reset of the 30s timeout on the existing lock and return it.

func Get

func Get(instanceID int) *InstanceOperation

Get retrieves an existing lock or returns nil if no lock exists.

func (InstanceOperation) Action

func (op InstanceOperation) Action() string

Action returns operation's action.

func (*InstanceOperation) Done

func (op *InstanceOperation) Done(err error)

Done indicates the operation has finished.

func (*InstanceOperation) Reset

func (op *InstanceOperation) Reset() error

Reset resets an operation.

func (*InstanceOperation) Wait

func (op *InstanceOperation) Wait() error

Wait waits for an operation to finish.

Jump to

Keyboard shortcuts

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