executor

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RemoteOrigin = "origin"
	RemoteTarget = "target"
)

Git remote name constants

View Source
const (
	RepoDir = "repo"
)

Work directory subdirectory name

Variables

This section is empty.

Functions

func ClassifyError

func ClassifyError(err error) string

ClassifyError categorizes an error into one of the predefined error types based on the error message content.

Types

type Executor

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

func NewExecutor

func NewExecutor(svc Service) (*Executor, error)

func (*Executor) Execute

func (e *Executor) Execute(ctx context.Context, task *model.SyncTask, trigger string, webhookEventID *uint) (*model.SyncRun, error)

func (*Executor) Preview

func (e *Executor) Preview(ctx context.Context, task *model.SyncTask) (*SyncPreview, error)

Preview checks if a sync operation can be performed.

type PlatformProvider

type PlatformProvider interface {
	GetPlatformByID(id uint) (*model.Platform, error)
}

PlatformProvider provides platform lookup by ID.

type RepoProvider

type RepoProvider interface {
	GetRepoByKey(key string) (*model.Repo, error)
}

RepoProvider provides repository lookup by key.

type RunManager

type RunManager interface {
	CreateRun(task *model.SyncTask, trigger string, webhookEventID *uint) (*model.SyncRun, error)
	CreateRunStep(step *model.SyncRunStep) error
	UpdateRunStep(step *model.SyncRunStep) error
	CompleteRun(run *model.SyncRun) error
	UpdateTaskLastRun(task *model.SyncTask, run *model.SyncRun) error
}

RunManager handles sync run lifecycle operations.

type Service

type Service interface {
	GetTempDir(taskKey string) string
	GetConfig() *model.Config
	RunManager
	RepoProvider
	PlatformProvider
}

Service is the interface the executor depends on. It exposes only the operations the executor needs — no DAO leakage.

type SyncPreview

type SyncPreview struct {
	CanSync       bool
	SourceExists  bool
	TargetExists  bool
	CommitsBehind int
	CommitsAhead  int
	LatestCommit  string
	Message       string
}

SyncPreview contains the result of a sync preview operation.

Jump to

Keyboard shortcuts

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