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 ¶
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 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
Click to show internal directories.
Click to hide internal directories.