Documentation
¶
Overview ¶
Package devnet contains UseCases for devnet lifecycle management.
Index ¶
- func GetDefaultNodePorts(basePort, nodeIndex int) *node.NodePorts
- type DestroyUseCase
- type DockerDeployUseCase
- type DockerDestroyUseCase
- type ExportUseCase
- func (uc *ExportUseCase) Execute(ctx context.Context, input dto.ExportInput) (*dto.ExportOutput, error)
- func (uc *ExportUseCase) Inspect(ctx context.Context, exportPath string) (*dto.ExportInspectOutput, error)
- func (uc *ExportUseCase) List(ctx context.Context, homeDir string) (*dto.ExportListOutput, error)
- type HealthUseCase
- type ProvisionUseCase
- type ResetUseCase
- type RunUseCase
- type StopUseCase
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDefaultNodePorts ¶
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 ¶
func (uc *DockerDeployUseCase) Execute(ctx context.Context, input dto.DeploymentInput) (*dto.DeploymentOutput, error)
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
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.
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 ¶
func (uc *ProvisionUseCase) Execute(ctx context.Context, input dto.ProvisionInput) (*dto.ProvisionOutput, error)
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.
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.