out

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLockActive = errors.New("lock found")
View Source
var ErrLockConflict = errors.New("pool state out of date")
View Source
var ErrNoLocksAvailable = errors.New("no locks to claim")

Functions

This section is empty.

Types

type GitLockHandler

type GitLockHandler struct {
	Source Source
	// contains filtered or unexported fields
}

func NewGitLockHandler

func NewGitLockHandler(source Source) *GitLockHandler

func (*GitLockHandler) AddLock

func (glh *GitLockHandler) AddLock(lock string, contents []byte, initiallyClaimed bool) (string, error)

func (*GitLockHandler) BroadcastLockPool

func (glh *GitLockHandler) BroadcastLockPool() ([]byte, error)

func (*GitLockHandler) CheckLock added in v1.4.0

func (glh *GitLockHandler) CheckLock(lockName string) (string, error)

func (*GitLockHandler) ClaimLock

func (glh *GitLockHandler) ClaimLock(lockName string) (string, error)

func (*GitLockHandler) GrabAvailableLock

func (glh *GitLockHandler) GrabAvailableLock() (string, string, error)

func (*GitLockHandler) RemoveLock

func (glh *GitLockHandler) RemoveLock(lockName string) (string, error)

func (*GitLockHandler) ResetLock

func (glh *GitLockHandler) ResetLock() error

func (*GitLockHandler) Setup

func (glh *GitLockHandler) Setup() error

func (*GitLockHandler) UnclaimLock

func (glh *GitLockHandler) UnclaimLock(lockName string) (string, error)

func (*GitLockHandler) UpdateLock

func (glh *GitLockHandler) UpdateLock(lockName string, contents []byte) (string, error)

type LockHandler

type LockHandler interface {
	GrabAvailableLock() (lock string, version string, err error)
	UnclaimLock(lock string) (version string, err error)
	AddLock(lock string, contents []byte, initiallyClaimed bool) (version string, err error)
	RemoveLock(lock string) (version string, err error)
	ClaimLock(lock string) (version string, err error)
	UpdateLock(lock string, contents []byte) (version string, err error)
	CheckLock(lock string) (version string, err error)

	Setup() error
	BroadcastLockPool() ([]byte, error)
	ResetLock() error
}

type LockPool

type LockPool struct {
	Source Source
	Output io.Writer

	LockHandler LockHandler
	// contains filtered or unexported fields
}

func NewLockPool

func NewLockPool(source Source, output io.Writer) LockPool

func (*LockPool) AcquireLock

func (lp *LockPool) AcquireLock() (string, Version, error)

func (*LockPool) AddClaimedLock

func (lp *LockPool) AddClaimedLock(inDir string) (string, Version, error)

func (*LockPool) AddUnclaimedLock

func (lp *LockPool) AddUnclaimedLock(inDir string) (string, Version, error)

func (*LockPool) CheckLock added in v1.4.0

func (lp *LockPool) CheckLock(inDir string) (string, Version, error)

func (*LockPool) ClaimLock

func (lp *LockPool) ClaimLock(lock string) (Version, error)

func (*LockPool) ReleaseLock

func (lp *LockPool) ReleaseLock(inDir string) (string, Version, error)

func (*LockPool) RemoveLock

func (lp *LockPool) RemoveLock(inDir string) (string, Version, error)

func (*LockPool) UpdateLock

func (lp *LockPool) UpdateLock(inDir string) (string, Version, error)

type MetadataPair

type MetadataPair struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type OutParams

type OutParams struct {
	Release    string `json:"release"`
	Acquire    bool   `json:"acquire"`
	Add        string `json:"add"`
	AddClaimed string `json:"add_claimed"`
	Remove     string `json:"remove"`
	Claim      string `json:"claim"`
	Update     string `json:"update"`
	Check      string `json:"check"`
}

type OutRequest

type OutRequest struct {
	Source Source    `json:"source"`
	Params OutParams `json:"params"`
}

func (OutRequest) Validate

func (request OutRequest) Validate() []string

type OutResponse

type OutResponse struct {
	Version  Version        `json:"version"`
	Metadata []MetadataPair `json:"metadata"`
}

type Source

type Source struct {
	URI        string        `json:"uri"`
	Branch     string        `json:"branch"`
	PrivateKey string        `json:"private_key" mapstructure:"private_key"`
	Pool       string        `json:"pool"`
	RetryDelay time.Duration `json:"retry_delay" mapstructure:"retry_delay"`
}

func (*Source) UnmarshalJSON

func (s *Source) UnmarshalJSON(b []byte) error

type Version

type Version struct {
	Ref string `json:"ref"`
}

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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