lxd: github.com/lxc/lxd/lxd/instance/operationlock Index | Files

package operationlock

import "github.com/lxc/lxd/lxd/instance/operationlock"

Index

Package Files

operationlock.go

type InstanceOperation Uses

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

InstanceOperation operation locking.

func Create Uses

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 Uses

func Get(instanceID int) *InstanceOperation

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

func (InstanceOperation) Action Uses

func (op InstanceOperation) Action() string

Action returns operation's action.

func (*InstanceOperation) Done Uses

func (op *InstanceOperation) Done(err error)

Done indicates the operation has finished.

func (*InstanceOperation) Reset Uses

func (op *InstanceOperation) Reset() error

Reset resets an operation.

func (*InstanceOperation) Wait Uses

func (op *InstanceOperation) Wait() error

Wait waits for an operation to finish.

Package operationlock imports 3 packages (graph) and is imported by 4 packages. Updated 2019-11-14. Refresh now. Tools for package owners.