| OLD | NEW |
| 1 package main | 1 package main |
| 2 | 2 |
| 3 import ( | 3 import ( |
| 4 "encoding/json" | 4 "encoding/json" |
| 5 "flag" | 5 "flag" |
| 6 "fmt" | 6 "fmt" |
| 7 ehtml "html" | 7 ehtml "html" |
| 8 "html/template" | 8 "html/template" |
| 9 "math/rand" | 9 "math/rand" |
| 10 "net/http" | 10 "net/http" |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 } | 462 } |
| 463 writeClusterSummaries(summary, w, r) | 463 writeClusterSummaries(summary, w, r) |
| 464 } | 464 } |
| 465 | 465 |
| 466 // getTile retrieves a tile from the disk | 466 // getTile retrieves a tile from the disk |
| 467 func getTile(tileScale, tileNumber int) (*types.Tile, error) { | 467 func getTile(tileScale, tileNumber int) (*types.Tile, error) { |
| 468 start := time.Now() | 468 start := time.Now() |
| 469 tile, err := nanoTileStore.Get(int(tileScale), int(tileNumber)) | 469 tile, err := nanoTileStore.Get(int(tileScale), int(tileNumber)) |
| 470 glog.Infoln("Time for tile load: ", time.Since(start).Nanoseconds()) | 470 glog.Infoln("Time for tile load: ", time.Since(start).Nanoseconds()) |
| 471 if err != nil || tile == nil { | 471 if err != nil || tile == nil { |
| 472 » » return nil, fmt.Errorf("Unable to get tile from tilestore: ", er
r) | 472 » » return nil, fmt.Errorf("Unable to get tile from tilestore: %s",
err) |
| 473 } | 473 } |
| 474 return tile, nil | 474 return tile, nil |
| 475 } | 475 } |
| 476 | 476 |
| 477 // tileHandler accepts URIs like /tiles/0/1 | 477 // tileHandler accepts URIs like /tiles/0/1 |
| 478 // where the URI format is /tiles/<tile-scale>/<tile-number> | 478 // where the URI format is /tiles/<tile-scale>/<tile-number> |
| 479 // | 479 // |
| 480 // It returns JSON of the form: | 480 // It returns JSON of the form: |
| 481 // | 481 // |
| 482 // { | 482 // { |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1100 http.HandleFunc("/compare/", autogzip.HandleFunc(compareHandler)) | 1100 http.HandleFunc("/compare/", autogzip.HandleFunc(compareHandler)) |
| 1101 http.HandleFunc("/calc/", autogzip.HandleFunc(calcHandler)) | 1101 http.HandleFunc("/calc/", autogzip.HandleFunc(calcHandler)) |
| 1102 http.HandleFunc("/help/", autogzip.HandleFunc(helpHandler)) | 1102 http.HandleFunc("/help/", autogzip.HandleFunc(helpHandler)) |
| 1103 http.HandleFunc("/oauth2callback/", login.OAuth2CallbackHandler) | 1103 http.HandleFunc("/oauth2callback/", login.OAuth2CallbackHandler) |
| 1104 http.HandleFunc("/logout/", login.LogoutHandler) | 1104 http.HandleFunc("/logout/", login.LogoutHandler) |
| 1105 http.HandleFunc("/loginstatus/", login.StatusHandler) | 1105 http.HandleFunc("/loginstatus/", login.StatusHandler) |
| 1106 | 1106 |
| 1107 glog.Infoln("Ready to serve.") | 1107 glog.Infoln("Ready to serve.") |
| 1108 glog.Fatal(http.ListenAndServe(*port, nil)) | 1108 glog.Fatal(http.ListenAndServe(*port, nil)) |
| 1109 } | 1109 } |
| OLD | NEW |