forked from TrueCloudLab/frostfs-node
[#932] adm: Reduce methods visibility in util
package
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
parent
f6ff3de0ae
commit
a92188e5f9
3 changed files with 8 additions and 8 deletions
|
@ -88,7 +88,7 @@ func NewInitializeContext(cmd *cobra.Command, v *viper.Viper) (*InitializeContex
|
||||||
needContracts := cmd.Name() == "update-contracts" || cmd.Name() == "init"
|
needContracts := cmd.Name() == "update-contracts" || cmd.Name() == "init"
|
||||||
|
|
||||||
var w *wallet.Wallet
|
var w *wallet.Wallet
|
||||||
w, err = GetWallet(cmd, v, needContracts, walletDir)
|
w, err = getWallet(cmd, v, needContracts, walletDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -249,7 +249,7 @@ func readContracts(c *InitializeContext, names []string) error {
|
||||||
}
|
}
|
||||||
defer r.Close()
|
defer r.Close()
|
||||||
|
|
||||||
m, err := ReadContractsFromArchive(r, names)
|
m, err := readContractsFromArchive(r, names)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetAlphabetWallets(v *viper.Viper, walletDir string) ([]*wallet.Wallet, error) {
|
func GetAlphabetWallets(v *viper.Viper, walletDir string) ([]*wallet.Wallet, error) {
|
||||||
wallets, err := OpenAlphabetWallets(v, walletDir)
|
wallets, err := openAlphabetWallets(v, walletDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ func GetAlphabetWallets(v *viper.Viper, walletDir string) ([]*wallet.Wallet, err
|
||||||
return wallets, nil
|
return wallets, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func OpenAlphabetWallets(v *viper.Viper, walletDir string) ([]*wallet.Wallet, error) {
|
func openAlphabetWallets(v *viper.Viper, walletDir string) ([]*wallet.Wallet, error) {
|
||||||
walletFiles, err := os.ReadDir(walletDir)
|
walletFiles, err := os.ReadDir(walletDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("can't read alphabet wallets dir: %w", err)
|
return nil, fmt.Errorf("can't read alphabet wallets dir: %w", err)
|
||||||
|
@ -107,7 +107,7 @@ func ReadContract(ctrPath, ctrName string) (*ContractState, error) {
|
||||||
return cs, cs.Parse()
|
return cs, cs.Parse()
|
||||||
}
|
}
|
||||||
|
|
||||||
func ReadContractsFromArchive(file io.Reader, names []string) (map[string]*ContractState, error) {
|
func readContractsFromArchive(file io.Reader, names []string) (map[string]*ContractState, error) {
|
||||||
m := make(map[string]*ContractState, len(names))
|
m := make(map[string]*ContractState, len(names))
|
||||||
for i := range names {
|
for i := range names {
|
||||||
m[names[i]] = new(ContractState)
|
m[names[i]] = new(ContractState)
|
||||||
|
|
|
@ -41,7 +41,7 @@ func InitializeContractWallet(v *viper.Viper, walletDir string) (*wallet.Wallet,
|
||||||
return w, nil
|
return w, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func OpenContractWallet(v *viper.Viper, cmd *cobra.Command, walletDir string) (*wallet.Wallet, error) {
|
func openContractWallet(v *viper.Viper, cmd *cobra.Command, walletDir string) (*wallet.Wallet, error) {
|
||||||
p := filepath.Join(walletDir, ContractWalletFilename)
|
p := filepath.Join(walletDir, ContractWalletFilename)
|
||||||
w, err := wallet.NewWalletFromFile(p)
|
w, err := wallet.NewWalletFromFile(p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -67,9 +67,9 @@ func OpenContractWallet(v *viper.Viper, cmd *cobra.Command, walletDir string) (*
|
||||||
return w, nil
|
return w, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetWallet(cmd *cobra.Command, v *viper.Viper, needContracts bool, walletDir string) (*wallet.Wallet, error) {
|
func getWallet(cmd *cobra.Command, v *viper.Viper, needContracts bool, walletDir string) (*wallet.Wallet, error) {
|
||||||
if !needContracts {
|
if !needContracts {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
return OpenContractWallet(v, cmd, walletDir)
|
return openContractWallet(v, cmd, walletDir)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue