List retrieves every task held by a task store. It gives the manager one store-level operation for task collection, replacing direct iteration over an in-memory map. The shared Store interface keeps manager and worker code independent of whether tasks live in memory or persistent storage. section 11.2 section 11.5
The interface signature is List() (interface{}, error), while task-store implementations return a []*task.Task value through that interface result. A caller checks the error, then converts the returned value to the expected task-pointer slice. In GetTasks, the manager returns that slice to expose its current tasks. section 11.2 section 11.5
In-memory collection
An in-memory task store builds the result by declaring an empty []*task.Task slice, ranging over its map, and appending each task pointer. Because this implementation has no failing operation in the loop, it returns the collected slice with a nil error. section 11.3
The same operation has a different implementation cost in persistent storage. A persistent task store opens a read-only BoltDB transaction, iterates through the task bucket, unmarshals each stored JSON value into a task, appends its pointer, and returns any transaction or decoding error. The interface therefore preserves the collection behavior while allowing storage-specific mechanics and failures. section 11.9 section 11.2
Listing 11.6 The List method
func (i *InMemoryTaskStore) List() (interface{}, error) {
var tasks []*task.Task
for _, t := range i.Db {
tasks = append(tasks, t)
}
return tasks, nil
}
The minimal in-memory implementation makes the core behavior explicit: range over stored task pointers, append them to a slice, and return the slice. section 11.3


