perf(alias): disabled log on fs call (close #4054)

This commit is contained in:
Andy Hsu
2023-04-07 00:02:07 +08:00
parent a475783b00
commit 0f8a84f67e
12 changed files with 48 additions and 41 deletions

View File

@ -13,8 +13,13 @@ import (
// So, the purpose of this package is to convert mount path to actual path
// then pass the actual path to the op package
func List(ctx context.Context, path string, refresh ...bool) ([]model.Obj, error) {
res, err := list(ctx, path, refresh...)
type ListArgs struct {
Refresh bool
NoLog bool
}
func List(ctx context.Context, path string, args *ListArgs) ([]model.Obj, error) {
res, err := list(ctx, path, args)
if err != nil {
log.Errorf("failed list %s: %+v", path, err)
return nil, err
@ -22,9 +27,13 @@ func List(ctx context.Context, path string, refresh ...bool) ([]model.Obj, error
return res, nil
}
func Get(ctx context.Context, path string) (model.Obj, error) {
type GetArgs struct {
NoLog bool
}
func Get(ctx context.Context, path string, args *GetArgs) (model.Obj, error) {
res, err := get(ctx, path)
if err != nil {
if err != nil && !args.NoLog {
log.Errorf("failed get %s: %+v", path, err)
return nil, err
}
@ -96,9 +105,13 @@ func PutAsTask(dstDirPath string, file *model.FileStream) error {
return err
}
func GetStorage(path string) (driver.Driver, error) {
type GetStoragesArgs struct {
NoLog bool
}
func GetStorage(path string, args *GetStoragesArgs) (driver.Driver, error) {
storageDriver, _, err := op.GetStorageAndActualPath(path)
if err != nil {
if err != nil && !args.NoLog {
return nil, err
}
return storageDriver, nil