sync

package
v0.0.0-...-0abd718 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2025 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BuildPath string = os.ExpandEnv("$HOME/conflowci/build")

Functions

func ConcurrentAppendToArray

func ConcurrentAppendToArray[T any](mu *sync.Mutex, val T, arr *[]T)

func GetProtoWorkerError

func GetProtoWorkerError(prefix string, err error, resp *pb.SyncResponse) string

Types

type BuildMetadata

type BuildMetadata struct {
	Repository RepositoryMetadata `toml:"Repository"`
	State      StateMetadata      `toml:"state"`
}

type BuildState

type BuildState uint

Current state of a task.

const (
	StartingBuild BuildState = iota
	RunningBuild
	CompletedBuild
	ErrorInBuild
	CompleteBuildWithErrors
)

func (BuildState) String

func (s BuildState) String() string

type CheckSumError

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

func (CheckSumError) Error

func (e CheckSumError) Error() string

type MetadataEncodeError

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

func (MetadataEncodeError) Error

func (e MetadataEncodeError) Error() string

type RepositoryMetadata

type RepositoryMetadata struct {
	Name    string  `toml:"name"`
	Source  string  `toml:"source"`
	Version float32 `toml:"project_version"`
}

type StateMetadata

type StateMetadata struct {
	ClonedAt  string `toml:"cloned_at"`
	LastBuild string `toml:"last_build"`
	Checksum  string `toml:"checksum"`
}

type TaskExecutor

type TaskExecutor struct {
	TaskID  uuid.UUID
	State   TaskState
	RunsOn  []config.EndpointInfo
	Files   []string
	Cmds    []string
	Outputs []string
	Errors  []string
}

TaskExecutor represents a task syncing for remote machines it tracks each state of the task, and is responsible for dispatching tasks to remote machines. It does the dispatching after the project is already built

func NewTaskExecutor

func NewTaskExecutor(cfg config.ValidatedConfig, task config.TaskConsumerJobs, wsName string) (*TaskExecutor, error)

Creates a new task executor, the task executor is responsible for executing tasks on a remote machine it dispatches each cmd with file/pattern to a remote machine in a concurrent way using the RunTaskOnAllMachines func. there is no guarantee that the commands will be executed in the order they were dispatched.

func (*TaskExecutor) RunTaskOnAllMachines

func (te *TaskExecutor) RunTaskOnAllMachines() error

RunTaskOnAllMachines distributes tasks across all endpoints

type TaskExecutorServer

type TaskExecutorServer struct{}

func (*TaskExecutorServer) GetFilesByRegex

func (te *TaskExecutorServer) GetFilesByRegex(ctx context.Context, finder *pb.TaskFileFinder) (*pb.FileList, error)

type TaskState

type TaskState uint

Current state of a task.

const (
	StartingTask TaskState = iota
	RunningTask
	CompletedTask
	ErrorInTask
	CompleteTaskWithErrors
)

func (TaskState) String

func (s TaskState) String() string

type WorkerBuilderServer

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

func (*WorkerBuilderServer) BuildRepository

func (*WorkerBuilderServer) RemoveRepositoryWorkspace

func (s *WorkerBuilderServer) RemoveRepositoryWorkspace(ctx context.Context, cfg *syncPB.WorkerConfig) (*emptypb.Empty, error)

type WorkersBuilder

type WorkersBuilder struct {
	Name       string
	BuildID    uuid.UUID
	State      BuildState
	RunsOn     []config.EndpointInfo
	Steps      []string
	CloneURL   string
	Remote     string
	BranchName string
	Token      string
	BranchRef  string
}

func NewWorkerBuilder

func NewWorkerBuilder(cfg config.ValidatedConfig, remote, branch, branchRef string) *WorkersBuilder

func (*WorkersBuilder) BuildAllEndpoints

func (wb *WorkersBuilder) BuildAllEndpoints() []*syncPB.WorkerBuildOutput

func (*WorkersBuilder) RemoveAllRepositoryWorkspaces

func (wb *WorkersBuilder) RemoveAllRepositoryWorkspaces() []error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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