diff options
Diffstat (limited to 'src/hub/src/spreadspace.org/sfive/s5srvWeb.go')
-rw-r--r-- | src/hub/src/spreadspace.org/sfive/s5srvWeb.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/hub/src/spreadspace.org/sfive/s5srvWeb.go b/src/hub/src/spreadspace.org/sfive/s5srvWeb.go index 31964ad..fd9876b 100644 --- a/src/hub/src/spreadspace.org/sfive/s5srvWeb.go +++ b/src/hub/src/spreadspace.org/sfive/s5srvWeb.go @@ -165,6 +165,17 @@ func (self StatsSinkServer) postUpdate(c web.C, w http.ResponseWriter, r *http.R // TODO send response channel, wait for OK } +func (self StatsSinkServer) getLastUpdateIdForUuid(c web.C, w http.ResponseWriter, r *http.Request) { + const resourceName = "lastupdateid" + id := c.URLParams["id"] + value, err := self.store.GetLastUpdateForUuid(id) + if err != nil { + http.Error(w, fmt.Sprintf("failed to retrieve %s: %v", resourceName, err), http.StatusInternalServerError) + return + } + fmt.Fprintf(w, "%s", value) +} + func (self StatsSinkServer) getStats(c web.C, w http.ResponseWriter, r *http.Request) { const resourceName = "stats" filter := getFilter(r) @@ -197,6 +208,7 @@ func (self StatsSinkServer) ServeWeb(vizAppLocation string) { goji.Get("/updates", self.getUpdateList) goji.Get("/updates/:id", self.getUpdate) goji.Post("/updates", self.postUpdate) + goji.Get("/lastupdate/:id", self.getLastUpdateIdForUuid) goji.Get("/stats", self.getStats) goji.Handle("/viz/*", http.StripPrefix("/viz/", http.FileServer(http.Dir(vizAppLocation)))) |