MCPcopy
hub / github.com/rclone/rclone / refreshFromSource

Method refreshFromSource

backend/cache/object.go:169–197  ·  view source on GitHub ↗

refreshFromSource requests the original FS for the object in case it comes from a cached entry

(ctx context.Context, force bool)

Source from the content-addressed store, hash-verified

167
168// refreshFromSource requests the original FS for the object in case it comes from a cached entry
169func (o *Object) refreshFromSource(ctx context.Context, force bool) error {
170 o.refreshMutex.Lock()
171 defer o.refreshMutex.Unlock()
172 var err error
173 var liveObject fs.Object
174
175 if o.Object != nil && !force {
176 return nil
177 }
178 if o.isTempFile() {
179 liveObject, err = o.ParentFs.NewObject(ctx, o.Remote())
180 if err != nil {
181 err = fmt.Errorf("in parent fs %v: %w", o.ParentFs, err)
182 }
183 } else {
184 liveObject, err = o.CacheFs.Fs.NewObject(ctx, o.Remote())
185 if err != nil {
186 err = fmt.Errorf("in cache fs %v: %w", o.CacheFs.Fs, err)
187 }
188 }
189 if err != nil {
190 fs.Errorf(o, "error refreshing object in : %v", err)
191 return err
192 }
193 o.updateData(ctx, liveObject)
194 o.persist()
195
196 return nil
197}
198
199// SetModTime sets the ModTime of this object
200func (o *Object) SetModTime(ctx context.Context, t time.Time) error {

Callers 10

refreshMethod · 0.95
SetModTimeMethod · 0.95
OpenMethod · 0.95
UpdateMethod · 0.95
RemoveMethod · 0.95
HashMethod · 0.95
downloadMethod · 0.80
rcFetchMethod · 0.80
CopyMethod · 0.80
MoveMethod · 0.80

Calls 9

isTempFileMethod · 0.95
RemoteMethod · 0.95
updateDataMethod · 0.95
persistMethod · 0.95
ErrorfFunction · 0.92
LockMethod · 0.65
UnlockMethod · 0.65
NewObjectMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected