devnet

package
v1.0.0-rc0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package devnet contains UseCases for devnet lifecycle management.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDefaultNodePorts

func GetDefaultNodePorts(basePort, nodeIndex int) *node.NodePorts

GetDefaultNodePorts returns default ports for a node at given index in Docker mode

Types

type DestroyUseCase

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

DestroyUseCase handles complete devnet destruction.

func NewDestroyUseCase

func NewDestroyUseCase(
	devnetRepo ports.DevnetRepository,
	stopUC *StopUseCase,
	logger ports.Logger,
) *DestroyUseCase

NewDestroyUseCase creates a new DestroyUseCase.

func (*DestroyUseCase) Execute

func (uc *DestroyUseCase) Execute(ctx context.Context, input dto.DestroyInput) (*dto.DestroyOutput, error)

Execute destroys the devnet completely.

type DockerDeployUseCase

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

DockerDeployUseCase handles Docker-based devnet deployment with network isolation

func NewDockerDeployUseCase

func NewDockerDeployUseCase(
	orchestrator domainports.DeploymentOrchestrator,
	devnetRepo ports.DevnetRepository,
	nodeRepo ports.NodeRepository,
	provisionUC *ProvisionUseCase,
	logger ports.Logger,
) *DockerDeployUseCase

NewDockerDeployUseCase creates a new Docker deployment use case

func (*DockerDeployUseCase) Execute

Execute performs a Docker-based deployment

type DockerDestroyUseCase

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

DockerDestroyUseCase handles cleanup of Docker-based devnets

func NewDockerDestroyUseCase

func NewDockerDestroyUseCase(
	orchestrator domainports.DeploymentOrchestrator,
	networkManager domainports.NetworkManager,
	portAllocator domainports.PortAllocator,
	devnetRepo ports.DevnetRepository,
	logger ports.Logger,
) *DockerDestroyUseCase

NewDockerDestroyUseCase creates a new Docker destroy use case

func (*DockerDestroyUseCase) Execute

func (uc *DockerDestroyUseCase) Execute(ctx context.Context, homeDir string) error

Execute destroys a Docker-based devnet

type ExportUseCase

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

ExportUseCase handles blockchain state export operations. It follows Clean Architecture principles by depending on abstractions (ports) rather than concrete implementations.

func NewExportUseCase

func NewExportUseCase(
	ctx context.Context,
	devnetRepo ports.DevnetRepository,
	nodeRepo ports.NodeRepository,
	exportRepo ports.ExportRepository,
	nodeLifecycle ports.NodeLifecycleManager,
	logger ports.Logger,
) *ExportUseCase

NewExportUseCase creates a new ExportUseCase. nodeLifecycle is injected for managing node state during export (stop-export-start workflow). This follows Dependency Inversion Principle (DIP).

func (*ExportUseCase) Execute

func (uc *ExportUseCase) Execute(ctx context.Context, input dto.ExportInput) (*dto.ExportOutput, error)

Execute performs a blockchain state export at the current height. It implements a stop-export-start workflow to avoid database lock issues: 1. Get block height while nodes are running 2. Stop all nodes (releases database lock) 3. Execute export (database is now accessible) 4. Restart nodes (if they were running before)

func (*ExportUseCase) Inspect

func (uc *ExportUseCase) Inspect(ctx context.Context, exportPath string) (*dto.ExportInspectOutput, error)

Inspect returns detailed information about a specific export.

func (*ExportUseCase) List

func (uc *ExportUseCase) List(ctx context.Context, homeDir string) (*dto.ExportListOutput, error)

List returns all exports for a devnet.

type HealthUseCase

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

HealthUseCase handles health checking of devnet nodes.

func NewHealthUseCase

func NewHealthUseCase(
	devnetRepo ports.DevnetRepository,
	nodeRepo ports.NodeRepository,
	healthChecker ports.HealthChecker,
	logger ports.Logger,
) *HealthUseCase

NewHealthUseCase creates a new HealthUseCase.

func (*HealthUseCase) Execute

func (uc *HealthUseCase) Execute(ctx context.Context, input dto.HealthInput) (*dto.HealthOutput, error)

Execute checks the health of all devnet nodes.

func (*HealthUseCase) GetStatus

func (uc *HealthUseCase) GetStatus(ctx context.Context, homeDir string) (ports.DevnetState, error)

GetStatus returns a quick status check without full health details.

func (*HealthUseCase) IsRunning

func (uc *HealthUseCase) IsRunning(ctx context.Context, homeDir string) bool

IsRunning checks if the devnet is currently running.

type ProvisionUseCase

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

ProvisionUseCase handles devnet provisioning.

func NewProvisionUseCase

func NewProvisionUseCase(
	devnetRepo ports.DevnetRepository,
	nodeRepo ports.NodeRepository,
	snapshotSvc ports.SnapshotFetcher,
	genesisSvc ports.GenesisFetcher,
	stateExportSvc ports.StateExportService,
	nodeInitializer ports.NodeInitializer,
	networkModule ports.NetworkModule,
	logger ports.Logger,
) *ProvisionUseCase

NewProvisionUseCase creates a new ProvisionUseCase.

func (*ProvisionUseCase) Execute

Execute provisions a new devnet.

type ResetUseCase

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

ResetUseCase handles resetting devnet data.

func NewResetUseCase

func NewResetUseCase(
	devnetRepo ports.DevnetRepository,
	nodeRepo ports.NodeRepository,
	stopUC *StopUseCase,
	logger ports.Logger,
) *ResetUseCase

NewResetUseCase creates a new ResetUseCase.

func (*ResetUseCase) Execute

func (uc *ResetUseCase) Execute(ctx context.Context, input dto.ResetInput) (*dto.ResetOutput, error)

Execute resets the devnet data.

type RunUseCase

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

RunUseCase handles starting devnet nodes.

func NewRunUseCase

func NewRunUseCase(
	devnetRepo ports.DevnetRepository,
	nodeRepo ports.NodeRepository,
	executor ports.ProcessExecutor,
	healthChecker ports.HealthChecker,
	networkModule ports.NetworkModule,
	logger ports.Logger,
) *RunUseCase

NewRunUseCase creates a new RunUseCase.

func (*RunUseCase) Execute

func (uc *RunUseCase) Execute(ctx context.Context, input dto.RunInput) (*dto.RunOutput, error)

Execute starts the devnet nodes.

type StopUseCase

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

StopUseCase handles stopping devnet nodes.

func NewStopUseCase

func NewStopUseCase(
	devnetRepo ports.DevnetRepository,
	nodeRepo ports.NodeRepository,
	executor ports.ProcessExecutor,
	logger ports.Logger,
) *StopUseCase

NewStopUseCase creates a new StopUseCase.

func (*StopUseCase) Execute

func (uc *StopUseCase) Execute(ctx context.Context, input dto.StopInput) (*dto.StopOutput, error)

Execute stops the devnet nodes.

Jump to

Keyboard shortcuts

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