(ctx context.Context, in rc.Params)
| 636 | } |
| 637 | |
| 638 | func (f *Fs) httpExpireRemote(ctx context.Context, in rc.Params) (out rc.Params, err error) { |
| 639 | out = make(rc.Params) |
| 640 | remoteInt, ok := in["remote"] |
| 641 | if !ok { |
| 642 | return out, fmt.Errorf("remote is needed") |
| 643 | } |
| 644 | remote := remoteInt.(string) |
| 645 | withData := false |
| 646 | _, ok = in["withData"] |
| 647 | if ok { |
| 648 | withData = true |
| 649 | } |
| 650 | |
| 651 | remote = f.unwrapRemote(remote) |
| 652 | if !f.cache.HasEntry(path.Join(f.Root(), remote)) { |
| 653 | return out, fmt.Errorf("%s doesn't exist in cache", remote) |
| 654 | } |
| 655 | |
| 656 | co := NewObject(f, remote) |
| 657 | err = f.cache.GetObject(co) |
| 658 | if err != nil { // it could be a dir |
| 659 | cd := NewDirectory(f, remote) |
| 660 | err := f.cache.ExpireDir(cd) |
| 661 | if err != nil { |
| 662 | return out, fmt.Errorf("error expiring directory: %w", err) |
| 663 | } |
| 664 | // notify vfs too |
| 665 | f.notifyChangeUpstream(cd.Remote(), fs.EntryDirectory) |
| 666 | out["status"] = "ok" |
| 667 | out["message"] = fmt.Sprintf("cached directory cleared: %v", remote) |
| 668 | return out, nil |
| 669 | } |
| 670 | // expire the entry |
| 671 | err = f.cache.ExpireObject(co, withData) |
| 672 | if err != nil { |
| 673 | return out, fmt.Errorf("error expiring file: %w", err) |
| 674 | } |
| 675 | // notify vfs too |
| 676 | f.notifyChangeUpstream(co.Remote(), fs.EntryObject) |
| 677 | |
| 678 | out["status"] = "ok" |
| 679 | out["message"] = fmt.Sprintf("cached file cleared: %v", remote) |
| 680 | return out, nil |
| 681 | } |
| 682 | |
| 683 | func (f *Fs) rcFetch(ctx context.Context, in rc.Params) (rc.Params, error) { |
| 684 | type chunkRange struct { |
nothing calls this directly
no test coverage detected