Skip to content

Commit

Permalink
add function comment
Browse files Browse the repository at this point in the history
  • Loading branch information
JayT106 committed Oct 12, 2022
1 parent a0013d2 commit e8d5664
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions types/module/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,7 @@ func DefaultMigrationsOrder(modules []string) []string {
return out
}

// CreateExportFile creates new file for exporting the module genesus state
func CreateExportFile(exportPath string, moduleName string, index int) (*os.File, error) {
if err := os.MkdirAll(exportPath, 0o700); err != nil {
return nil, fmt.Errorf("failed to create directory: %w", err)
Expand All @@ -628,6 +629,7 @@ func CreateExportFile(exportPath string, moduleName string, index int) (*os.File
return f, nil
}

// OpenModuleStateFile opens the genesis state file given the path, module name, and file index
func OpenModuleStateFile(importPath string, moduleName string, index int) (*os.File, error) {
fp := filepath.Join(importPath, fmt.Sprintf("genesis_%s_%d.bin", moduleName, index))
f, err := os.OpenFile(filepath.Clean(fp), os.O_RDONLY, 0o600)
Expand Down

0 comments on commit e8d5664

Please sign in to comment.