MCPcopy Create free account
hub / github.com/OpenListTeam/OpenList / GetStorageVirtualFilesWithDetailsByPath

Function GetStorageVirtualFilesWithDetailsByPath

internal/op/storage.go:347–376  ·  view source on GitHub ↗
(ctx context.Context, prefix string, hideDetails, refresh bool, filterByName string)

Source from the content-addressed store, hash-verified

345}
346
347func GetStorageVirtualFilesWithDetailsByPath(ctx context.Context, prefix string, hideDetails, refresh bool, filterByName string) []model.Obj {
348 if hideDetails {
349 return getStorageVirtualFilesByPath(prefix, nil, filterByName)
350 }
351 return getStorageVirtualFilesByPath(prefix, func(d driver.Driver, obj model.Obj) model.Obj {
352 if _, ok := obj.(*model.ObjStorageDetails); ok {
353 return obj
354 }
355 ret := &model.ObjStorageDetails{
356 Obj: obj,
357 StorageDetails: nil,
358 }
359 resultChan := make(chan *model.StorageDetails, 1)
360 go func(dri driver.Driver) {
361 details, err := GetStorageDetails(ctx, dri, refresh)
362 if err != nil {
363 if !errors.Is(err, errs.NotImplement) && !errors.Is(err, errs.StorageNotInit) {
364 log.Errorf("failed get %s storage details: %+v", dri.GetStorage().MountPath, err)
365 }
366 }
367 resultChan <- details
368 }(d)
369 select {
370 case r := <-resultChan:
371 ret.StorageDetails = r
372 case <-time.After(time.Second):
373 }
374 return ret
375 }, filterByName)
376}
377
378func getStorageVirtualFilesByPath(prefix string, rootCallback func(driver.Driver, model.Obj) model.Obj, filterByName string) []model.Obj {
379 files := make([]model.Obj, 0)

Callers 2

getFunction · 0.92
listFunction · 0.92

Calls 3

GetStorageDetailsFunction · 0.70
GetStorageMethod · 0.65

Tested by

no test coverage detected