mirror of
https://github.com/AlistGo/alist.git
synced 2025-06-05 01:24:46 +08:00
perf(alias): disabled log on fs call (close #4054)
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user