Documentation
¶
Overview ¶
Package export provides infrastructure implementations for state export operations.
Index ¶
- func ParseDirectoryName(dirName string) (network string, hashPrefix string, height int64, timestamp time.Time, ...)
- type ExportError
- type ExportExecutor
- func (e *ExportExecutor) ExportAtHeight(ctx context.Context, binaryPath string, homeDir string, height int64, ...) (string, error)
- func (e *ExportExecutor) GetBinaryVersion(ctx context.Context, binaryPath string) (string, error)
- func (e *ExportExecutor) WithTimeout(timeout time.Duration) *ExportExecutor
- type HashCalculator
- type HeightResolver
- type Repository
- func (r *Repository) Delete(ctx context.Context, exportPath string) error
- func (r *Repository) GenerateExportPath(devnetHomeDir string, export *domainExport.Export) string
- func (r *Repository) GetExportsDirectory(devnetHomeDir string) string
- func (r *Repository) ListForDevnet(ctx context.Context, devnetHomeDir string) (interface{}, error)
- func (r *Repository) Load(ctx context.Context, exportPath string) (interface{}, error)
- func (r *Repository) Save(ctx context.Context, exp interface{}) error
- func (r *Repository) Validate(ctx context.Context, exportPath string) (interface{}, error)
- type ValidationResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ExportError ¶
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 ¶
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 ¶
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.
type ValidationResult ¶
type ValidationResult struct {
Export *domainExport.Export
IsComplete bool
MissingFiles []string
}
ValidationResult contains the result of export validation.