bootstrapper

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseExecutor

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

BaseExecutor provides common functionality for bootstrap and unbootstrap operations

func NewBaseExecutor

func NewBaseExecutor(cfg *config.Config, logger *logrus.Logger) *BaseExecutor

NewBaseExecutor creates a new base executor

func (*BaseExecutor) ExecuteSteps

func (be *BaseExecutor) ExecuteSteps(ctx context.Context, steps []Executor, stepType string) (*ExecutionResult, error)

ExecuteSteps executes a list of steps and returns results

type Bootstrapper

type Bootstrapper struct {
	*BaseExecutor
	// contains filtered or unexported fields
}

Bootstrapper executes bootstrap steps sequentially

func New

func New(
	cfg *config.Config,
	logger *logrus.Logger,
	componentsAPIConn *grpc.ClientConn,
) *Bootstrapper

New creates a new bootstrapper

func (*Bootstrapper) Bootstrap

func (b *Bootstrapper) Bootstrap(ctx context.Context) (*ExecutionResult, error)

Bootstrap executes all bootstrap steps sequentially

func (*Bootstrapper) Unbootstrap

func (b *Bootstrapper) Unbootstrap(ctx context.Context) (*ExecutionResult, error)

Unbootstrap executes all cleanup steps sequentially (in reverse order of bootstrap)

type ExecutionResult

type ExecutionResult struct {
	Success     bool          `json:"success"`
	StepCount   int           `json:"step_count"`
	Duration    time.Duration `json:"duration"`
	StepResults []StepResult  `json:"step_results"`
	Error       string        `json:"error,omitempty"`
}

ExecutionResult represents the result of bootstrap or unbootstrap process

type Executor

type Executor interface {
	// Execute performs the step's main operation
	Execute(ctx context.Context) error

	// IsCompleted checks if the step has already been completed
	IsCompleted(ctx context.Context) bool

	// GetName returns the step name
	GetName() string
}

executor is a common base interface for all executors Every installer and uninstaller implements this interface

type StepExecutor

type StepExecutor interface {
	Executor

	// Validate validates preconditions before execution (optional)
	Validate(ctx context.Context) error
}

stepExecutor interface defines the contract for bootstrap step implementations only installers need to implement this interface

type StepResult

type StepResult struct {
	StepName string        `json:"step_name"`
	Success  bool          `json:"success"`
	Duration time.Duration `json:"duration"`
	Error    string        `json:"error,omitempty"`
}

StepResult represents the result of a single step

Jump to

Keyboard shortcuts

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