MCPcopy Index your code
hub / github.com/rclone/rclone / Get

Function Get

fs/cache/cache.go:175–199  ·  view source on GitHub ↗

Get gets an fs.Fs named fsString either from the cache or creates it afresh

(ctx context.Context, fsString string)

Source from the content-addressed store, hash-verified

173
174// Get gets an fs.Fs named fsString either from the cache or creates it afresh
175func Get(ctx context.Context, fsString string) (f fs.Fs, err error) {
176 // If we are making a long lived backend which lives longer
177 // than this request, we want to disconnect it from the
178 // current context and in particular any WithCancel contexts,
179 // but we want to preserve the config embedded in the context.
180 newCtx := context.Background()
181 newCtx = fs.CopyConfig(newCtx, ctx)
182 newCtx = filter.CopyConfig(newCtx, ctx)
183 f, err = GetFn(newCtx, fsString, fs.NewFs)
184 if f == nil || (err != nil && err != fs.ErrorIsFile) {
185 return f, err
186 }
187 // If this is part of an rc job then pin the backend until it finishes
188 if JobOnFinish != nil && JobGetJobID != nil {
189 if jobID, ok := JobGetJobID(ctx); ok {
190 // fs.Debugf(f, "Pin for job %d", jobID)
191 Pin(f)
192 _, _ = JobOnFinish(jobID, func() {
193 // fs.Debugf(f, "Unpin for job %d", jobID)
194 Unpin(f)
195 })
196 }
197 }
198 return f, err
199}
200
201// GetArr gets []fs.Fs from []fsStrings either from the cache or creates it afresh
202func GetArr(ctx context.Context, fsStrings []string) (f []fs.Fs, err error) {

Callers 15

NewFsFunction · 0.92
NewFunction · 0.92
InternalTestVersionsMethod · 0.92
NewFsFunction · 0.92
dbDumpMethod · 0.92
dbImportMethod · 0.92
NewFsFunction · 0.92
InternalTestVersionsMethod · 0.92
NewFsFunction · 0.92
NewFsFunction · 0.92
checkTreeFunction · 0.92
newUpstreamMethod · 0.92

Calls 5

CopyConfigFunction · 0.92
CopyConfigFunction · 0.92
GetFnFunction · 0.85
PinFunction · 0.85
UnpinFunction · 0.85

Tested by 9

InternalTestVersionsMethod · 0.74
InternalTestVersionsMethod · 0.74
checkTreeFunction · 0.74
runTestCaseMethod · 0.74
makeTempRemoteMethod · 0.74
runTestStepMethod · 0.74
checkPreReqsMethod · 0.74
runBisyncMethod · 0.74
listSubdirsMethod · 0.74