swarm/storage/feeds: Final package rename and moved files

This commit is contained in:
Javier Peletier
2018-09-30 09:51:11 +02:00
parent 83705ef6aa
commit b6ccc06cda
39 changed files with 137 additions and 136 deletions

View File

@ -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/mru"
"github.com/ethereum/go-ethereum/swarm/storage/feeds"
"github.com/rs/cors"
)
@ -466,7 +466,7 @@ 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 mru.updateRequestJSON JSON structure
// Creation and update must send feeds.updateRequestJSON JSON structure
body, err := ioutil.ReadAll(r.Body)
if err != nil {
RespondError(w, r, err.Error(), http.StatusInternalServerError)
@ -484,7 +484,7 @@ func (s *Server) HandlePostFeed(w http.ResponseWriter, r *http.Request) {
return
}
var updateRequest mru.Request
var updateRequest feeds.Request
updateRequest.Feed = *feed
query := r.URL.Query()
@ -582,7 +582,7 @@ func (s *Server) HandleGetFeed(w http.ResponseWriter, r *http.Request) {
return
}
lookupParams := &mru.Query{Feed: *feed}
lookupParams := &feeds.Query{Feed: *feed}
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
@ -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.(*mru.Error)
rsrcErr, ok := err.(*feeds.Error)
if !ok && rsrcErr != nil {
code = rsrcErr.Code()
}

View File

@ -38,7 +38,7 @@ import (
"testing"
"time"
"github.com/ethereum/go-ethereum/swarm/storage/mru/lookup"
"github.com/ethereum/go-ethereum/swarm/storage/feeds/lookup"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
@ -48,7 +48,7 @@ import (
swarm "github.com/ethereum/go-ethereum/swarm/api/client"
"github.com/ethereum/go-ethereum/swarm/multihash"
"github.com/ethereum/go-ethereum/swarm/storage"
"github.com/ethereum/go-ethereum/swarm/storage/mru"
"github.com/ethereum/go-ethereum/swarm/storage/feeds"
"github.com/ethereum/go-ethereum/swarm/testutil"
)
@ -62,12 +62,12 @@ func serverFunc(api *api.API) testutil.TestServer {
return NewServer(api, "")
}
func newTestSigner() (*mru.GenericSigner, error) {
func newTestSigner() (*feeds.GenericSigner, error) {
privKey, err := crypto.HexToECDSA("deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef")
if err != nil {
return nil, err
}
return mru.NewGenericSigner(privKey), nil
return feeds.NewGenericSigner(privKey), nil
}
// test the transparent resolving of multihash-containing feed updates with bzz:// scheme
@ -103,8 +103,8 @@ func TestBzzFeedMultihash(t *testing.T) {
log.Info("added data", "manifest", string(b), "data", common.ToHex(mh))
topic, _ := mru.NewTopic("foo.eth", nil)
updateRequest := mru.NewFirstRequest(topic)
topic, _ := feeds.NewTopic("foo.eth", nil)
updateRequest := feeds.NewFirstRequest(topic)
updateRequest.SetData(mh)
@ -182,8 +182,8 @@ func TestBzzFeed(t *testing.T) {
//data for update 2
update2Data := []byte("foo")
topic, _ := mru.NewTopic("foo.eth", nil)
updateRequest := mru.NewFirstRequest(topic)
topic, _ := feeds.NewTopic("foo.eth", nil)
updateRequest := feeds.NewFirstRequest(topic)
if err != nil {
t.Fatal(err)
}
@ -319,7 +319,7 @@ func TestBzzFeed(t *testing.T) {
if err != nil {
t.Fatal(err)
}
updateRequest = &mru.Request{}
updateRequest = &feeds.Request{}
if err = updateRequest.UnmarshalJSON(b); err != nil {
t.Fatalf("Error decoding feed metadata: %s", err)
}
@ -365,7 +365,7 @@ func TestBzzFeed(t *testing.T) {
// test manifest-less queries
log.Info("get first update in update1Timestamp via direct query")
query := mru.NewQuery(&updateRequest.Feed, update1Timestamp, lookup.NoClue)
query := feeds.NewQuery(&updateRequest.Feed, update1Timestamp, lookup.NoClue)
urlq, err := url.Parse(fmt.Sprintf("%s/bzz-feed:/", srv.URL))
if err != nil {