chore: rename account to storage
This commit is contained in:
@ -8,40 +8,40 @@ import (
|
||||
)
|
||||
|
||||
func makeDir(ctx context.Context, path string) error {
|
||||
account, actualPath, err := operations.GetAccountAndActualPath(path)
|
||||
storage, actualPath, err := operations.GetStorageAndActualPath(path)
|
||||
if err != nil {
|
||||
return errors.WithMessage(err, "failed get account")
|
||||
return errors.WithMessage(err, "failed get storage")
|
||||
}
|
||||
return operations.MakeDir(ctx, account, actualPath)
|
||||
return operations.MakeDir(ctx, storage, actualPath)
|
||||
}
|
||||
|
||||
func move(ctx context.Context, srcPath, dstDirPath string) error {
|
||||
srcAccount, srcActualPath, err := operations.GetAccountAndActualPath(srcPath)
|
||||
srcStorage, srcActualPath, err := operations.GetStorageAndActualPath(srcPath)
|
||||
if err != nil {
|
||||
return errors.WithMessage(err, "failed get src account")
|
||||
return errors.WithMessage(err, "failed get src storage")
|
||||
}
|
||||
dstAccount, dstDirActualPath, err := operations.GetAccountAndActualPath(dstDirPath)
|
||||
dstStorage, dstDirActualPath, err := operations.GetStorageAndActualPath(dstDirPath)
|
||||
if err != nil {
|
||||
return errors.WithMessage(err, "failed get dst account")
|
||||
return errors.WithMessage(err, "failed get dst storage")
|
||||
}
|
||||
if srcAccount.GetAccount() != dstAccount.GetAccount() {
|
||||
return errors.WithStack(errs.MoveBetweenTwoAccounts)
|
||||
if srcStorage.GetStorage() != dstStorage.GetStorage() {
|
||||
return errors.WithStack(errs.MoveBetweenTwoStorages)
|
||||
}
|
||||
return operations.Move(ctx, srcAccount, srcActualPath, dstDirActualPath)
|
||||
return operations.Move(ctx, srcStorage, srcActualPath, dstDirActualPath)
|
||||
}
|
||||
|
||||
func rename(ctx context.Context, srcPath, dstName string) error {
|
||||
account, srcActualPath, err := operations.GetAccountAndActualPath(srcPath)
|
||||
storage, srcActualPath, err := operations.GetStorageAndActualPath(srcPath)
|
||||
if err != nil {
|
||||
return errors.WithMessage(err, "failed get account")
|
||||
return errors.WithMessage(err, "failed get storage")
|
||||
}
|
||||
return operations.Rename(ctx, account, srcActualPath, dstName)
|
||||
return operations.Rename(ctx, storage, srcActualPath, dstName)
|
||||
}
|
||||
|
||||
func remove(ctx context.Context, path string) error {
|
||||
account, actualPath, err := operations.GetAccountAndActualPath(path)
|
||||
storage, actualPath, err := operations.GetStorageAndActualPath(path)
|
||||
if err != nil {
|
||||
return errors.WithMessage(err, "failed get account")
|
||||
return errors.WithMessage(err, "failed get storage")
|
||||
}
|
||||
return operations.Remove(ctx, account, actualPath)
|
||||
return operations.Remove(ctx, storage, actualPath)
|
||||
}
|
||||
|
Reference in New Issue
Block a user