executor

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrIsRebasing = fmt.Errorf("unexpected git executor state, is rebasing")
View Source
var ErrUnexpectedBranch = fmt.Errorf("unexpected git executor state, on unexpected branch")

Functions

func Module

func Module(c *di.Container)

Types

type ExecuteFunc

type ExecuteFunc func(repoProvider provider.RepoProvider) error

ExecuteFunc is deprecated. Use ExecuteRepoFunc instead

type Executor

type Executor interface {
	// Read schedules a function that can read files from the filesystem.
	Read(FileReadFunc) Executor
	// Write schedules a function that can write files to the filesystem.
	Write(FileWriteFunc) Executor
	// GitRead schedules a function that can read .git repository, but not the files on the filesystem.
	GitRead(fn GitReadFunc) Executor
	// GitWrite schedules a function that can read and write .git repository, but not the files on the filesystem.
	GitWrite(fn GitWriteFunc) Executor
	// FileReadGitWrite schedules a function that can read files from the filesystem, as well as read/write files in .git
	FileReadGitWrite(fn FileReadGitWriteFunc) Executor

	// Schedule schedules a function that can access repo provider. It is deprecated, prefer to use
	// Read, Write or Git functions instead to get more granular locking.
	Schedule(fn ExecuteFunc) Executor

	// AllowRebasingState allows the executor to open a repo in a rebasing state. By default this is not allowed.
	AllowRebasingState() Executor
	// AssertBranchName asserts that the repo is in the expected branch.
	AssertBranchName(string) Executor

	// ExecView executes all of the scheduled functions for the given view repository.
	ExecView(codebaseID, viewID, actionName string) error
	// ExecTrunk executes all of the scheduled functions for the given trunk repository.
	ExecTrunk(codebaseID, actionName string) error
	// ExecTemporaryView creates a view for the given codebase, cloning it from the trunk,
	// executes all the scheduled functions, and then deletes the view.
	ExecTemporaryView(codebaseID, actionName string) error
}

Executor proves an interface to schedule git operations, to be executed synchronously, in an expected state, and exclusively.

This executor replaces earlier direct access to provider.RepoProvider, which when using the executor will be injected instead.

type FileLock

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

func New

func New(filename string) *FileLock

func (*FileLock) Lock

func (fl *FileLock) Lock() error

func (*FileLock) RLock

func (fl *FileLock) RLock() error

func (*FileLock) RUnlock

func (fl *FileLock) RUnlock() error

func (*FileLock) Unlock

func (fl *FileLock) Unlock() error

type FileReadFunc

type FileReadFunc func(vcs.RepoReader) error

type FileReadGitWriteFunc

type FileReadGitWriteFunc func(repo vcs.RepoReaderGitWriter) error

type FileWriteFunc

type FileWriteFunc func(vcs.RepoWriter) error

type GitReadFunc

type GitReadFunc func(repo vcs.RepoGitReader) error

type GitWriteFunc

type GitWriteFunc func(repo vcs.RepoGitWriter) error

type Provider

type Provider interface {
	New() Executor
}

func NewProvider

func NewProvider(logger *zap.Logger, repoProvider provider.RepoProvider) Provider

Jump to

Keyboard shortcuts

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