export

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: 16 Imported by: 0

Documentation

Overview

Package export provides infrastructure implementations for state export operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseDirectoryName

func ParseDirectoryName(dirName string) (network string, hashPrefix string, height int64, timestamp time.Time, err error)

ParseDirectoryName attempts to parse an export directory name. Returns height, timestamp, and hash prefix if valid.

Types

type ExportError

type ExportError struct {
	Operation string
	Height    int64
	Message   string
}

ExportError represents an error during export execution.

func (*ExportError) Error

func (e *ExportError) Error() string

type ExportExecutor

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

ExportExecutor executes blockchain export commands and captures genesis output.

func NewExportExecutor

func NewExportExecutor() *ExportExecutor

NewExportExecutor creates a new ExportExecutor with default timeout.

func (*ExportExecutor) ExportAtHeight

func (e *ExportExecutor) ExportAtHeight(
	ctx context.Context,
	binaryPath string,
	homeDir string,
	height int64,
	outputPath string,
) (string, error)

ExportAtHeight executes the export command and saves genesis to file. Returns the path to the saved genesis file.

func (*ExportExecutor) GetBinaryVersion

func (e *ExportExecutor) GetBinaryVersion(ctx context.Context, binaryPath string) (string, error)

GetBinaryVersion queries the binary version.

func (*ExportExecutor) WithTimeout

func (e *ExportExecutor) WithTimeout(timeout time.Duration) *ExportExecutor

WithTimeout sets a custom timeout for export commands.

type HashCalculator

type HashCalculator struct{}

HashCalculator calculates SHA256 hashes of binary files.

func NewHashCalculator

func NewHashCalculator() *HashCalculator

NewHashCalculator creates a new HashCalculator instance.

func (*HashCalculator) CalculateHash

func (h *HashCalculator) CalculateHash(binaryPath string) (string, error)

CalculateHash computes the SHA256 hash of a binary file. Returns the full 64-character hex string.

func (*HashCalculator) CalculateHashPrefix

func (h *HashCalculator) CalculateHashPrefix(binaryPath string) (string, error)

CalculateHashPrefix computes the first 8 characters of the SHA256 hash.

type HeightResolver

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

HeightResolver resolves the current blockchain height from RPC endpoints.

func NewHeightResolver

func NewHeightResolver() *HeightResolver

NewHeightResolver creates a new HeightResolver with default timeout.

func (*HeightResolver) GetCurrentHeight

func (r *HeightResolver) GetCurrentHeight(ctx context.Context, rpcURL string) (int64, error)

GetCurrentHeight queries the RPC endpoint to get the current block height. rpcURL should be in the format "http://localhost:26657"

func (*HeightResolver) WaitForHeight

func (r *HeightResolver) WaitForHeight(ctx context.Context, rpcURL string, targetHeight int64, pollInterval time.Duration) error

WaitForHeight waits until the blockchain reaches or exceeds the target height. It polls the RPC endpoint at the specified interval.

func (*HeightResolver) WithTimeout

func (r *HeightResolver) WithTimeout(timeout time.Duration) *HeightResolver

WithTimeout sets a custom timeout for RPC queries.

type Repository

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

Repository implements ports.ExportRepository for file-based persistence.

func NewRepository

func NewRepository(baseDir string) *Repository

NewRepository creates a new export repository.

func (*Repository) Delete

func (r *Repository) Delete(ctx context.Context, exportPath string) error

Delete removes an export directory and all its contents.

func (*Repository) GenerateExportPath

func (r *Repository) GenerateExportPath(devnetHomeDir string, export *domainExport.Export) string

GenerateExportPath generates the full export directory path.

func (*Repository) GetExportsDirectory

func (r *Repository) GetExportsDirectory(devnetHomeDir string) string

GetExportsDirectory returns the exports directory path for a devnet.

func (*Repository) ListForDevnet

func (r *Repository) ListForDevnet(ctx context.Context, devnetHomeDir string) (interface{}, error)

ListForDevnet lists all exports for a given devnet home directory.

func (*Repository) Load

func (r *Repository) Load(ctx context.Context, exportPath string) (interface{}, error)

Load retrieves export metadata from a directory.

func (*Repository) Save

func (r *Repository) Save(ctx context.Context, exp interface{}) error

Save persists export metadata to disk.

func (*Repository) Validate

func (r *Repository) Validate(ctx context.Context, exportPath string) (interface{}, error)

Validate checks if an export is complete and valid.

type ValidationResult

type ValidationResult struct {
	Export       *domainExport.Export
	IsComplete   bool
	MissingFiles []string
}

ValidationResult contains the result of export validation.

Jump to

Keyboard shortcuts

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