Refactor the multi-host salt install page.
[arvados.git] / services / keepstore / work_queue.go
index 58e49665950dd929b54668ec4ce7bf5c87174d57..4c46ec8e65f6cf546324d8f0f6e25056d65de9a9 100644 (file)
@@ -1,4 +1,8 @@
-package main
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+package keepstore
 
 /* A WorkQueue is an asynchronous thread-safe queue manager.  It
    provides a channel from which items can be read off the queue, and
@@ -84,18 +88,20 @@ package main
 
 import "container/list"
 
+// WorkQueue definition
 type WorkQueue struct {
        getStatus chan WorkQueueStatus
        newlist   chan *list.List
        // Workers get work items by reading from this channel.
        NextItem <-chan interface{}
-       // Each worker must send struct{}{} to ReportDone exactly once
+       // Each worker must send struct{}{} to DoneItem exactly once
        // for each work item received from NextItem, when it stops
        // working on that item (regardless of whether the work was
        // successful).
-       ReportDone chan<- struct{}
+       DoneItem chan<- struct{}
 }
 
+// WorkQueueStatus reflects the queue status.
 type WorkQueueStatus struct {
        InProgress int
        Queued     int
@@ -108,10 +114,10 @@ func NewWorkQueue() *WorkQueue {
        reportDone := make(chan struct{})
        newList := make(chan *list.List)
        b := WorkQueue{
-               getStatus:  make(chan WorkQueueStatus),
-               newlist:    newList,
-               NextItem:   nextItem,
-               ReportDone: reportDone,
+               getStatus: make(chan WorkQueueStatus),
+               newlist:   newList,
+               NextItem:  nextItem,
+               DoneItem:  reportDone,
        }
        go func() {
                // Read new work lists from the newlist channel.