[ARVADOS] updated: e23961a316dc64068a6cc9b799d618f021f85ddb

git at public.curoverse.com git at public.curoverse.com
Tue Mar 25 16:57:08 EDT 2014


Summary of changes:
 services/keep/keep.go      |   14 ++++++++++++++
 services/keep/keep_test.go |    4 ++--
 2 files changed, 16 insertions(+), 2 deletions(-)

       via  e23961a316dc64068a6cc9b799d618f021f85ddb (commit)
      from  03ab8baef455f5eb9cde83c2b05d82b42c46e216 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit e23961a316dc64068a6cc9b799d618f021f85ddb
Author: Tim Pierce <twp at curoverse.com>
Date:   Tue Mar 25 16:57:37 2014 -0400

    Incorporating comments from code review (refs #2438, refs #2291)

diff --git a/services/keep/keep.go b/services/keep/keep.go
index 919bccc..0473ac8 100644
--- a/services/keep/keep.go
+++ b/services/keep/keep.go
@@ -28,10 +28,18 @@ func main() {
 	}
 
 	// Set up REST handlers.
+	//
+	// Start with a router that will route each URL path to an
+	// appropriate handler.
+	//
 	rest := mux.NewRouter()
 	rest.HandleFunc("/{hash:[0-9a-f]{32}}", GetBlockHandler).Methods("GET")
+
+	// Tell the built-in HTTP server to direct all requests to the REST
+	// router.
 	http.Handle("/", rest)
 
+	// Start listening for requests.
 	port := fmt.Sprintf(":%d", DEFAULT_PORT)
 	http.ListenAndServe(port, nil)
 }
@@ -77,6 +85,12 @@ func GetBlock(hash string) ([]byte, error) {
 		}
 
 		// Double check the file checksum.
+		//
+		// TODO(twp): this condition probably represents a bad disk and
+		// should raise major alarm bells for an administrator: e.g.
+		// they should be sent directly to an event manager at high
+		// priority or logged as urgent problems.
+		//
 		filehash := fmt.Sprintf("%x", md5.Sum(buf[:nread]))
 		if filehash != hash {
 			log.Printf("%s: checksum mismatch: %s (actual hash %s)\n",
diff --git a/services/keep/keep_test.go b/services/keep/keep_test.go
index fd36a5e..b583c55 100644
--- a/services/keep/keep_test.go
+++ b/services/keep/keep_test.go
@@ -98,8 +98,8 @@ func TestGetBlockCorrupt(t *testing.T) {
 
 // setup
 //     Create KeepVolumes for testing.
-func setup(nkeeps int) error {
-	KeepVolumes = make([]string, 2)
+func setup(num_volumes int) error {
+	KeepVolumes = make([]string, num_volumes)
 	for i := range KeepVolumes {
 		if dir, err := ioutil.TempDir(os.TempDir(), "keeptest"); err == nil {
 			KeepVolumes[i] = dir + "/keep"

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list