pipeline

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ManageInput

type ManageInput struct {
	PackageDir domain.PackagePath
	TargetDir  domain.TargetPath
	Packages   []string
}

ManageInput contains the input for manage operations

type ManagePipeline

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

ManagePipeline implements the complete manage workflow. It composes scanning, planning, resolution, and sorting stages.

func NewManagePipeline

func NewManagePipeline(opts ManagePipelineOpts) *ManagePipeline

NewManagePipeline creates a new Manage pipeline with the given options.

func (*ManagePipeline) Execute

Execute runs the complete manage pipeline. It performs: scan packages -> compute desired state -> resolve conflicts -> sort operations

type ManagePipelineOpts

type ManagePipelineOpts struct {
	FS                 domain.FS
	IgnoreSet          *ignore.IgnoreSet
	ScanConfig         scanner.ScanConfig
	Policies           planner.ResolutionPolicies
	BackupDir          string
	PackageNameMapping bool
}

ManagePipelineOpts contains options for the Manage pipeline

type Pipeline

type Pipeline[A, B any] func(context.Context, A) domain.Result[B]

Pipeline represents a functional pipeline stage that transforms input A to output B. Pipelines are pure functions that can be composed to build complex workflows. All operations are context-aware for cancellation and timeout support.

func Compose

func Compose[A, B, C any](p1 Pipeline[A, B], p2 Pipeline[B, C]) Pipeline[A, C]

Compose combines two pipeline stages sequentially. The output of the first pipeline becomes the input to the second. If the first pipeline fails, the second is not executed. This implements the monadic bind operation for pipelines.

func Filter

func Filter[A any](pred func(A) bool) Pipeline[A, A]

Filter creates a pipeline that only passes values matching a predicate. Values that don't match the predicate result in an error.

func FlatMap

func FlatMap[A, B any](fn func(A) domain.Result[B]) Pipeline[A, B]

FlatMap lifts a Result-returning function into a pipeline stage. This is useful for functions that can fail but don't need context.

func Map

func Map[A, B any](fn func(A) B) Pipeline[A, B]

Map lifts a pure function into a pipeline stage. The function is applied to the input value, transforming it to the output type. Since the function cannot fail, the pipeline always succeeds.

func Parallel

func Parallel[A, B any](pipelines []Pipeline[A, B]) Pipeline[A, []B]

Parallel executes multiple pipelines concurrently with the same input. All pipelines receive the same input value and execute in parallel. Returns a slice of results in the same order as the input pipelines. If any pipeline fails, the entire operation fails with the first error encountered.

func PlanStage

func PlanStage() Pipeline[PlanInput, planner.DesiredState]

PlanStage creates a pipeline stage that computes desired state. Takes scanned packages and computes what links should exist.

func ResolveStage

func ResolveStage() Pipeline[ResolveInput, planner.ResolveResult]

ResolveStage creates a pipeline stage that resolves conflicts. Takes desired state and current filesystem state to generate operations.

func ScanStage

func ScanStage() Pipeline[ScanInput, []domain.Package]

ScanStage creates a pipeline stage that scans packages. Returns a slice of scanned packages with their file trees.

func SortStage

func SortStage() Pipeline[SortInput, []domain.Operation]

SortStage creates a pipeline stage that sorts operations. Takes operations and returns them in dependency order.

type PlanInput

type PlanInput struct {
	Packages           []domain.Package
	TargetDir          domain.TargetPath
	PackageNameMapping bool
}

PlanInput contains the input for planning operations

type ResolveInput

type ResolveInput struct {
	Desired   planner.DesiredState
	TargetDir domain.TargetPath
	FS        domain.FS
	Policies  planner.ResolutionPolicies
	BackupDir string
}

ResolveInput contains the input for conflict resolution

type ScanInput

type ScanInput struct {
	PackageDir domain.PackagePath
	TargetDir  domain.TargetPath
	Packages   []string
	IgnoreSet  *ignore.IgnoreSet
	ScanConfig scanner.ScanConfig
	FS         domain.FS
}

ScanInput contains the input for scanning packages

type SortInput

type SortInput struct {
	Operations []domain.Operation
}

SortInput contains the input for topological sorting

Jump to

Keyboard shortcuts

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