4194: use go fmt to replace spaces with tabs.
[arvados.git] / services / keepstore / keepstore.go
index e5bd3bffb5450236981f3d2c336840b014383c1f..75b6c4014dc3e4afdabc3efebc22c7ec8862f517 100644 (file)
@@ -4,7 +4,6 @@ import (
        "bytes"
        "flag"
        "fmt"
-       "git.curoverse.com/arvados.git/services/keepstore/pull_list"
        "io/ioutil"
        "log"
        "net"
@@ -92,12 +91,16 @@ func (e *KeepError) Error() string {
 // Initialized by the --volumes flag (or by FindKeepVolumes).
 var KeepVM VolumeManager
 
-// The pull list manager is a singleton pull list (a list of blocks
-// that the current keepstore process should be pulling from remote
-// keepstore servers in order to increase data replication) with
-// atomic update methods that are safe to use from multiple
-// goroutines.
-var pullmgr *pull_list.Manager
+// The pull list manager and trash queue are threadsafe queues which
+// support atomic update operations. The PullHandler and TrashHandler
+// store results from Data Manager /pull and /trash requests here.
+//
+// See the Keep and Data Manager design documents for more details:
+// https://arvados.org/projects/arvados/wiki/Keep_Design_Doc
+// https://arvados.org/projects/arvados/wiki/Data_Manager_Design_Doc
+//
+var pullq *WorkQueue
+var trashq *WorkQueue
 
 // TODO(twp): continue moving as much code as possible out of main
 // so it can be effectively tested. Esp. handling and postprocessing
@@ -259,9 +262,11 @@ func main() {
        // Start a round-robin VolumeManager with the volumes we have found.
        KeepVM = MakeRRVolumeManager(goodvols)
 
-       // Tell the built-in HTTP server to direct all requests to the REST
-       // router.
-       http.Handle("/", MakeRESTRouter())
+       // Tell the built-in HTTP server to direct all requests to the REST router.
+       loggingRouter := MakeLoggingRESTRouter()
+       http.HandleFunc("/", func(resp http.ResponseWriter, req *http.Request) {
+               loggingRouter.ServeHTTP(resp, req)
+       })
 
        // Set up a TCP listener.
        listener, err := net.Listen("tcp", listen)