MCPcopy
hub / github.com/rclone/rclone / initBackgroundUploader

Function initBackgroundUploader

backend/cache/handle.go:24–40  ·  view source on GitHub ↗

initBackgroundUploader returns a single instance

(fs *Fs)

Source from the content-addressed store, hash-verified

22
23// initBackgroundUploader returns a single instance
24func initBackgroundUploader(fs *Fs) (*backgroundWriter, error) {
25 // write lock to create one
26 uploaderMapMx.Lock()
27 defer uploaderMapMx.Unlock()
28 if b, ok := uploaderMap[fs.String()]; ok {
29 // if it was already started we close it so that it can be started again
30 if b.running {
31 b.close()
32 } else {
33 return b, nil
34 }
35 }
36
37 bb := newBackgroundWriter(fs)
38 uploaderMap[fs.String()] = bb
39 return uploaderMap[fs.String()], nil
40}
41
42// Handle is managing the read/write/seek operations on an open handle
43type Handle struct {

Callers 1

NewFsFunction · 0.85

Calls 5

newBackgroundWriterFunction · 0.85
LockMethod · 0.65
UnlockMethod · 0.65
StringMethod · 0.65
closeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…