job

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Job

type Job struct {
	// JobType is to select operation type that will be applied to repository
	JobType Type
	// Repository points to the repository that will be used for operation
	Repository *git.Repository
	// Options is a placeholder for operation options
	Options interface{}
}

Job relates the type of the operation and the entity

func (*Job) Start added in v0.9.2

func (j *Job) Start() error

Start executes the job by scheduling the appropriate git command. The job will be processed asynchronously by the git queue.

type PullJobConfig added in v0.9.0

type PullJobConfig struct {
	Options         *command.PullOptions
	SuppressSuccess bool
}

PullJobConfig wraps pull options with queue behaviour flags.

type PushJobConfig added in v0.9.0

type PushJobConfig struct {
	Options         *command.PushOptions
	SuppressSuccess bool
	AllowForce      bool
}

PushJobConfig wraps push options with queue behaviour flags.

type Queue

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

Queue holds the slice of Jobs

func CreateJobQueue

func CreateJobQueue() (jq *Queue)

CreateJobQueue creates a jobqueue struct and initialize its slice then return its pointer

func (*Queue) AddJob

func (jq *Queue) AddJob(j *Job) error

AddJob adds a job to the queue

func (*Queue) IsInTheQueue

func (jq *Queue) IsInTheQueue(r *git.Repository) (inTheQueue bool, j *Job)

IsInTheQueue function; since the job and entity is not tied with its own struct, this function returns true if that entity is in the queue along with the jobs type

func (*Queue) RemoveFromQueue

func (jq *Queue) RemoveFromQueue(r *git.Repository) error

RemoveFromQueue deletes the given entity and its job from the queue

func (*Queue) StartJobsAsync

func (jq *Queue) StartJobsAsync() map[*Job]error

StartJobsAsync starts all jobs in the queue asynchronously. Concurrency is limited by the git queue semaphore in internal/git/repository.go, which caps concurrent git operations globally across all repositories.

func (*Queue) StartNext

func (jq *Queue) StartNext() (j *Job, finished bool, err error)

StartNext starts the next job in the queue

type Type

type Type string

Type is the a git operation supported

const (
	// FetchJob is wrapper of git fetch command
	FetchJob Type = "fetch"

	// PullJob is wrapper of git pull command
	PullJob Type = "pull"

	// MergeJob is wrapper of git merge command
	MergeJob Type = "merge"

	// RebaseJob is wrapper of git pull --rebase command
	RebaseJob Type = "rebase"

	// PushJob is wrapper of git push command
	PushJob Type = "push"
)

Jump to

Keyboard shortcuts

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