inmemory

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package inmemory implements an in-memory target locker. WARNING: since locking is done in memory, locally to the ConTest server, this will not prevent other ConTest servers to know that the target is in use.

Index

Constants

This section is empty.

Variables

View Source
var Name = "InMemory"

Name is the name used to look this plugin up.

Functions

func New

func New(clk clock.Clock) target.Locker

New initializes and returns a new InMemory target locker.

Types

type InMemory

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

InMemory locks targets in an in-memory map.

func (*InMemory) Close

func (tl *InMemory) Close() error

Close stops the brokern and releases resources.

func (*InMemory) Lock

func (tl *InMemory) Lock(ctx xcontext.Context, jobID types.JobID, duration time.Duration, targets []*target.Target) error

Lock locks the specified targets.

func (*InMemory) RefreshLocks

func (tl *InMemory) RefreshLocks(ctx xcontext.Context, jobID types.JobID, duration time.Duration, targets []*target.Target) error

RefreshLocks extends the lock duration by the internally configured timeout. If the owner is different, the request is rejected.

func (*InMemory) TryLock

func (tl *InMemory) TryLock(ctx xcontext.Context, jobID types.JobID, duration time.Duration, targets []*target.Target, limit uint) ([]string, error)

Lock locks the specified targets.

func (*InMemory) Unlock

func (tl *InMemory) Unlock(ctx xcontext.Context, jobID types.JobID, targets []*target.Target) error

Unlock unlocks the specified targets.

Jump to

Keyboard shortcuts

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