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

Function BeginManualScan

internal/op/recursive_list.go:27–43  ·  view source on GitHub ↗
(rawPath string, limit float64)

Source from the content-addressed store, hash-verified

25}
26
27func BeginManualScan(rawPath string, limit float64) error {
28 rawPath = utils.FixAndCleanPath(rawPath)
29 ctx, cancel := context.WithCancel(context.Background())
30 if !ManualScanCancel.CompareAndSwap(nil, &cancel) {
31 cancel()
32 return errors.New("manual scan is running, please try later")
33 }
34 ScannedCount.Store(0)
35 go func() {
36 defer func() { (*ManualScanCancel.Swap(nil))() }()
37 err := RecursivelyList(ctx, rawPath, rate.Limit(limit), &ScannedCount)
38 if err != nil {
39 log.Errorf("failed recursively list: %v", err)
40 }
41 }()
42 return nil
43}
44
45func StopManualScan() {
46 c := ManualScanCancel.Load()

Callers 1

StartManualScanFunction · 0.92

Calls 5

FixAndCleanPathFunction · 0.92
RecursivelyListFunction · 0.85
LimitMethod · 0.80
StoreMethod · 0.45
SwapMethod · 0.45

Tested by

no test coverage detected