diff options
author | Javier Peletier <jm@epiclabs.io> | 2018-10-03 15:15:17 +0800 |
---|---|---|
committer | Javier Peletier <jm@epiclabs.io> | 2018-10-03 15:15:28 +0800 |
commit | de01178c18766b9f744acc94fe2b96804f998e40 (patch) | |
tree | b572a263ff660bd5ded343a5253f86f1f1145e46 /swarm/api/http/server.go | |
parent | 696bc9b01ce0ed3347fa1bd64460ccc08091e90a (diff) | |
download | go-tangerine-de01178c18766b9f744acc94fe2b96804f998e40.tar go-tangerine-de01178c18766b9f744acc94fe2b96804f998e40.tar.gz go-tangerine-de01178c18766b9f744acc94fe2b96804f998e40.tar.bz2 go-tangerine-de01178c18766b9f744acc94fe2b96804f998e40.tar.lz go-tangerine-de01178c18766b9f744acc94fe2b96804f998e40.tar.xz go-tangerine-de01178c18766b9f744acc94fe2b96804f998e40.tar.zst go-tangerine-de01178c18766b9f744acc94fe2b96804f998e40.zip |
swarm/storage/feed: Renamed package
Diffstat (limited to 'swarm/api/http/server.go')
-rw-r--r-- | swarm/api/http/server.go | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/swarm/api/http/server.go b/swarm/api/http/server.go index 0cfeb1f22..370aca5a7 100644 --- a/swarm/api/http/server.go +++ b/swarm/api/http/server.go @@ -40,7 +40,7 @@ import ( "github.com/ethereum/go-ethereum/swarm/api" "github.com/ethereum/go-ethereum/swarm/log" "github.com/ethereum/go-ethereum/swarm/storage" - "github.com/ethereum/go-ethereum/swarm/storage/feeds" + "github.com/ethereum/go-ethereum/swarm/storage/feed" "github.com/rs/cors" ) @@ -458,7 +458,7 @@ func (s *Server) HandleDelete(w http.ResponseWriter, r *http.Request) { } // Handles feed manifest creation and feed updates -// The POST request admits a JSON structure as defined in the feeds package: `feeds.updateRequestJSON` +// The POST request admits a JSON structure as defined in the feeds package: `feed.updateRequestJSON` // The requests can be to a) create a feed manifest, b) update a feed or c) both a+b: create a feed manifest and publish a first update func (s *Server) HandlePostFeed(w http.ResponseWriter, r *http.Request) { ruid := GetRUID(r.Context()) @@ -466,14 +466,14 @@ func (s *Server) HandlePostFeed(w http.ResponseWriter, r *http.Request) { log.Debug("handle.post.feed", "ruid", ruid) var err error - // Creation and update must send feeds.updateRequestJSON JSON structure + // Creation and update must send feed.updateRequestJSON JSON structure body, err := ioutil.ReadAll(r.Body) if err != nil { RespondError(w, r, err.Error(), http.StatusInternalServerError) return } - feed, err := s.api.ResolveFeed(r.Context(), uri, r.URL.Query()) + fd, err := s.api.ResolveFeed(r.Context(), uri, r.URL.Query()) if err != nil { // couldn't parse query string or retrieve manifest getFail.Inc(1) httpStatus := http.StatusBadRequest @@ -484,8 +484,8 @@ func (s *Server) HandlePostFeed(w http.ResponseWriter, r *http.Request) { return } - var updateRequest feeds.Request - updateRequest.Feed = *feed + var updateRequest feed.Request + updateRequest.Feed = *fd query := r.URL.Query() if err := updateRequest.FromValues(query, body); err != nil { // decodes request from query parameters @@ -552,7 +552,7 @@ func (s *Server) HandleGetFeed(w http.ResponseWriter, r *http.Request) { log.Debug("handle.get.feed", "ruid", ruid) var err error - feed, err := s.api.ResolveFeed(r.Context(), uri, r.URL.Query()) + fd, err := s.api.ResolveFeed(r.Context(), uri, r.URL.Query()) if err != nil { // couldn't parse query string or retrieve manifest getFail.Inc(1) httpStatus := http.StatusBadRequest @@ -565,10 +565,10 @@ func (s *Server) HandleGetFeed(w http.ResponseWriter, r *http.Request) { // determine if the query specifies period and version or it is a metadata query if r.URL.Query().Get("meta") == "1" { - unsignedUpdateRequest, err := s.api.FeedsNewRequest(r.Context(), feed) + unsignedUpdateRequest, err := s.api.FeedsNewRequest(r.Context(), fd) if err != nil { getFail.Inc(1) - RespondError(w, r, fmt.Sprintf("cannot retrieve feed metadata for feed=%s: %s", feed.Hex(), err), http.StatusNotFound) + RespondError(w, r, fmt.Sprintf("cannot retrieve feed metadata for feed=%s: %s", fd.Hex(), err), http.StatusNotFound) return } rawResponse, err := unsignedUpdateRequest.MarshalJSON() @@ -582,7 +582,7 @@ func (s *Server) HandleGetFeed(w http.ResponseWriter, r *http.Request) { return } - lookupParams := &feeds.Query{Feed: *feed} + lookupParams := &feed.Query{Feed: *fd} if err = lookupParams.FromValues(r.URL.Query()); err != nil { // parse period, version RespondError(w, r, fmt.Sprintf("invalid feed update request:%s", err), http.StatusBadRequest) return @@ -598,7 +598,7 @@ func (s *Server) HandleGetFeed(w http.ResponseWriter, r *http.Request) { } // All ok, serve the retrieved update - log.Debug("Found update", "feed", feed.Hex(), "ruid", ruid) + log.Debug("Found update", "feed", fd.Hex(), "ruid", ruid) w.Header().Set("Content-Type", api.MimeOctetStream) http.ServeContent(w, r, "", time.Now(), bytes.NewReader(data)) } @@ -606,7 +606,7 @@ func (s *Server) HandleGetFeed(w http.ResponseWriter, r *http.Request) { func (s *Server) translateFeedError(w http.ResponseWriter, r *http.Request, supErr string, err error) (int, error) { code := 0 defaultErr := fmt.Errorf("%s: %v", supErr, err) - rsrcErr, ok := err.(*feeds.Error) + rsrcErr, ok := err.(*feed.Error) if !ok && rsrcErr != nil { code = rsrcErr.Code() } |