9 Keepstore initiates trash worker channel goroutine.
10 The channel will process trash list.
11 For each (next) trash request:
12 Delete the block indicated by the trash request Locator
16 func RunTrashWorker(trashq *WorkQueue) {
17 nextItem := trashq.NextItem
18 for item := range nextItem {
19 trashRequest := item.(TrashRequest)
20 err := TrashItem(trashRequest)
22 log.Printf("Trash request error for %s: %s", trashRequest, err)
28 Delete the block indicated by the Locator in TrashRequest.
30 func TrashItem(trashRequest TrashRequest) (err error) {
31 // Verify if the block is to be deleted based on its Mtime
32 for _, volume := range KeepVM.Volumes() {
33 mtime, err := volume.Mtime(trashRequest.Locator)
35 if trashRequest.BlockMtime == mtime.Unix() {
36 currentTime := time.Now().Unix()
37 if time.Duration(currentTime-trashRequest.BlockMtime)*time.Second >= permission_ttl {
38 err = volume.Delete(trashRequest.Locator)