MCPcopy
hub / github.com/rclone/rclone / Purge

Method Purge

backend/cache/storage_persistent.go:687–711  ·  view source on GitHub ↗

Purge will flush the entire cache

()

Source from the content-addressed store, hash-verified

685
686// Purge will flush the entire cache
687func (b *Persistent) Purge() {
688 b.cleanupMux.Lock()
689 defer b.cleanupMux.Unlock()
690
691 _ = b.db.Update(func(tx *bolt.Tx) error {
692 _ = tx.DeleteBucket([]byte(RootBucket))
693 _ = tx.DeleteBucket([]byte(RootTsBucket))
694 _ = tx.DeleteBucket([]byte(DataTsBucket))
695
696 _, _ = tx.CreateBucketIfNotExists([]byte(RootBucket))
697 _, _ = tx.CreateBucketIfNotExists([]byte(RootTsBucket))
698 _, _ = tx.CreateBucketIfNotExists([]byte(DataTsBucket))
699
700 return nil
701 })
702
703 err := os.RemoveAll(b.dataPath)
704 if err != nil {
705 fs.Errorf(b, "issue removing data folder: %v", err)
706 }
707 err = os.MkdirAll(b.dataPath, os.ModePerm)
708 if err != nil {
709 fs.Errorf(b, "issue removing data folder: %v", err)
710 }
711}
712
713// GetChunkTs retrieves the current timestamp of this chunk
714func (b *Persistent) GetChunkTs(path string, offset int64) (time.Time, error) {

Callers 1

connectMethod · 0.95

Calls 7

ErrorfFunction · 0.92
DeleteBucketMethod · 0.80
LockMethod · 0.65
UnlockMethod · 0.65
UpdateMethod · 0.65
RemoveAllMethod · 0.65
MkdirAllMethod · 0.45

Tested by

no test coverage detected