Project

General

Profile

Actions

Idea #3705

closed

[Keep] Generalize PullList module to BlockWorkList

Added by Tom Clegg over 9 years ago. Updated over 9 years ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Tim Pierce
Category:
Keep
Target version:
Start date:
08/21/2014
Due date:
Story points:
2.0

Description

The lists of "blocks to delete" and "blocks to pull from other keepstores" should be maintained in a BlockWorkList type. Just like the existing PullList, a BlockWorkList has
  • a current list
  • a dedicated goroutine responsible for setting and getting the current list
Each item in the list has
  • a block hash
  • some additional data (sending/accepting the right type here is left up to the callers)
The BlockWorkList interface provides these interfaces:
  • NewBlockWorkList()
    • Returns a new BlockWorkList. Starts a new goroutine.
  • ReplaceList
    • Writing a list to this channel replaces the current list, if any, with the supplied list. (The remainder of the old list is discarded. Any work still in progress on old list items is unaffected.)
  • NextItem
    • Reading from this channel yields the next item from the list. (The returned item is also removed from the list.)
  • Close()
    • Terminates the goroutine, closes the channels.

Pseudocode for a trash collector:

// Make a work list:
trashList := NewBlockWorkList()

// In an HTTP handler for "PUT /trash":
{
    trashList.SetList(...)
}

// Start a worker:
go func(list BlockWorkList) {
    for deleteRequest := range list.NextItem {
        // Check timestamp and delete the block.
    }
}(trashList)


Subtasks 3 (0 open3 closed)

Task #3858: Review 3705-keep-blockworklistResolvedTim Pierce08/21/2014Actions
Task #3652: Rewrite PullList as a BlockManager implementationResolvedTim Pierce08/21/2014Actions
Task #3752: Define BlockManager interfaces and typesResolvedTim Pierce08/21/2014Actions
Actions

Also available in: Atom PDF