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 | |
parent | 696bc9b01ce0ed3347fa1bd64460ccc08091e90a (diff) | |
download | dexon-de01178c18766b9f744acc94fe2b96804f998e40.tar dexon-de01178c18766b9f744acc94fe2b96804f998e40.tar.gz dexon-de01178c18766b9f744acc94fe2b96804f998e40.tar.bz2 dexon-de01178c18766b9f744acc94fe2b96804f998e40.tar.lz dexon-de01178c18766b9f744acc94fe2b96804f998e40.tar.xz dexon-de01178c18766b9f744acc94fe2b96804f998e40.tar.zst dexon-de01178c18766b9f744acc94fe2b96804f998e40.zip |
swarm/storage/feed: Renamed package
Diffstat (limited to 'swarm')
-rw-r--r-- | swarm/OWNERS | 2 | ||||
-rw-r--r-- | swarm/api/api.go | 48 | ||||
-rw-r--r-- | swarm/api/client/client.go | 16 | ||||
-rw-r--r-- | swarm/api/client/client_test.go | 20 | ||||
-rw-r--r-- | swarm/api/http/server.go | 24 | ||||
-rw-r--r-- | swarm/api/http/server_test.go | 20 | ||||
-rw-r--r-- | swarm/api/manifest.go | 6 | ||||
-rw-r--r-- | swarm/pss/notify/notify.go | 2 | ||||
-rw-r--r-- | swarm/storage/feed/binaryserializer.go (renamed from swarm/storage/feeds/binaryserializer.go) | 2 | ||||
-rw-r--r-- | swarm/storage/feed/binaryserializer_test.go (renamed from swarm/storage/feeds/binaryserializer_test.go) | 2 | ||||
-rw-r--r-- | swarm/storage/feed/cacheentry.go (renamed from swarm/storage/feeds/cacheentry.go) | 2 | ||||
-rw-r--r-- | swarm/storage/feed/doc.go (renamed from swarm/storage/feeds/doc.go) | 2 | ||||
-rw-r--r-- | swarm/storage/feed/error.go (renamed from swarm/storage/feeds/error.go) | 2 | ||||
-rw-r--r-- | swarm/storage/feed/feed.go (renamed from swarm/storage/feeds/feed.go) | 2 | ||||
-rw-r--r-- | swarm/storage/feed/feed_test.go (renamed from swarm/storage/feeds/feed_test.go) | 2 | ||||
-rw-r--r-- | swarm/storage/feed/handler.go (renamed from swarm/storage/feeds/handler.go) | 4 | ||||
-rw-r--r-- | swarm/storage/feed/handler_test.go (renamed from swarm/storage/feeds/handler_test.go) | 4 | ||||
-rw-r--r-- | swarm/storage/feed/id.go (renamed from swarm/storage/feeds/id.go) | 4 | ||||
-rw-r--r-- | swarm/storage/feed/id_test.go (renamed from swarm/storage/feeds/id_test.go) | 4 | ||||
-rw-r--r-- | swarm/storage/feed/lookup/epoch.go (renamed from swarm/storage/feeds/lookup/epoch.go) | 0 | ||||
-rw-r--r-- | swarm/storage/feed/lookup/epoch_test.go (renamed from swarm/storage/feeds/lookup/epoch_test.go) | 2 | ||||
-rw-r--r-- | swarm/storage/feed/lookup/lookup.go (renamed from swarm/storage/feeds/lookup/lookup.go) | 0 | ||||
-rw-r--r-- | swarm/storage/feed/lookup/lookup_test.go (renamed from swarm/storage/feeds/lookup/lookup_test.go) | 2 | ||||
-rw-r--r-- | swarm/storage/feed/query.go (renamed from swarm/storage/feeds/query.go) | 4 | ||||
-rw-r--r-- | swarm/storage/feed/query_test.go (renamed from swarm/storage/feeds/query_test.go) | 2 | ||||
-rw-r--r-- | swarm/storage/feed/request.go (renamed from swarm/storage/feeds/request.go) | 4 | ||||
-rw-r--r-- | swarm/storage/feed/request_test.go (renamed from swarm/storage/feeds/request_test.go) | 4 | ||||
-rw-r--r-- | swarm/storage/feed/sign.go (renamed from swarm/storage/feeds/sign.go) | 2 | ||||
-rw-r--r-- | swarm/storage/feed/testutil.go (renamed from swarm/storage/feeds/testutil.go) | 2 | ||||
-rw-r--r-- | swarm/storage/feed/timestampprovider.go (renamed from swarm/storage/feeds/timestampprovider.go) | 2 | ||||
-rw-r--r-- | swarm/storage/feed/topic.go (renamed from swarm/storage/feeds/topic.go) | 2 | ||||
-rw-r--r-- | swarm/storage/feed/topic_test.go (renamed from swarm/storage/feeds/topic_test.go) | 2 | ||||
-rw-r--r-- | swarm/storage/feed/update.go (renamed from swarm/storage/feeds/update.go) | 2 | ||||
-rw-r--r-- | swarm/storage/feed/update_test.go (renamed from swarm/storage/feeds/update_test.go) | 2 | ||||
-rw-r--r-- | swarm/swarm.go | 8 | ||||
-rw-r--r-- | swarm/testutil/http.go | 12 |
36 files changed, 110 insertions, 110 deletions
diff --git a/swarm/OWNERS b/swarm/OWNERS index cea47766f..d4204e08c 100644 --- a/swarm/OWNERS +++ b/swarm/OWNERS @@ -22,5 +22,5 @@ swarm ├── storage ─────────────── ethersphere │ ├── encryption ──────── @gbalint, @zelig, @nagydani │ ├── mock ────────────── @janos -│ └── feeds ───────────── @nolash, @jpeletier +│ └── feed ────────────── @nolash, @jpeletier └── testutil ────────────── @lmars
\ No newline at end of file diff --git a/swarm/api/api.go b/swarm/api/api.go index a23e09e68..7bb631967 100644 --- a/swarm/api/api.go +++ b/swarm/api/api.go @@ -45,8 +45,8 @@ import ( "github.com/ethereum/go-ethereum/swarm/multihash" "github.com/ethereum/go-ethereum/swarm/spancontext" "github.com/ethereum/go-ethereum/swarm/storage" - "github.com/ethereum/go-ethereum/swarm/storage/feeds" - "github.com/ethereum/go-ethereum/swarm/storage/feeds/lookup" + "github.com/ethereum/go-ethereum/swarm/storage/feed" + "github.com/ethereum/go-ethereum/swarm/storage/feed/lookup" opentracing "github.com/opentracing/opentracing-go" ) @@ -236,18 +236,18 @@ on top of the FileStore it is the public interface of the FileStore which is included in the ethereum stack */ type API struct { - feeds *feeds.Handler + feed *feed.Handler fileStore *storage.FileStore dns Resolver Decryptor func(context.Context, string) DecryptFunc } // NewAPI the api constructor initialises a new API instance. -func NewAPI(fileStore *storage.FileStore, dns Resolver, feedsHandler *feeds.Handler, pk *ecdsa.PrivateKey) (self *API) { +func NewAPI(fileStore *storage.FileStore, dns Resolver, feedHandler *feed.Handler, pk *ecdsa.PrivateKey) (self *API) { self = &API{ fileStore: fileStore, dns: dns, - feeds: feedsHandler, + feed: feedHandler, Decryptor: func(ctx context.Context, credentials string) DecryptFunc { return self.doDecrypt(ctx, credentials, pk) }, @@ -409,7 +409,7 @@ func (a *API) Get(ctx context.Context, decrypt DecryptFunc, manifestAddr storage if entry.Feed == nil { return reader, mimeType, status, nil, fmt.Errorf("Cannot decode Feed in manifest") } - _, err := a.feeds.Lookup(ctx, feeds.NewQueryLatest(entry.Feed, lookup.NoClue)) + _, err := a.feed.Lookup(ctx, feed.NewQueryLatest(entry.Feed, lookup.NoClue)) if err != nil { apiGetNotFound.Inc(1) status = http.StatusNotFound @@ -417,7 +417,7 @@ func (a *API) Get(ctx context.Context, decrypt DecryptFunc, manifestAddr storage return reader, mimeType, status, nil, err } // get the data of the update - _, rsrcData, err := a.feeds.GetContent(entry.Feed) + _, rsrcData, err := a.feed.GetContent(entry.Feed) if err != nil { apiGetNotFound.Inc(1) status = http.StatusNotFound @@ -958,13 +958,13 @@ func (a *API) BuildDirectoryTree(ctx context.Context, mhash string, nameresolver } // FeedsLookup finds Swarm feeds updates at specific points in time, or the latest update -func (a *API) FeedsLookup(ctx context.Context, query *feeds.Query) ([]byte, error) { - _, err := a.feeds.Lookup(ctx, query) +func (a *API) FeedsLookup(ctx context.Context, query *feed.Query) ([]byte, error) { + _, err := a.feed.Lookup(ctx, query) if err != nil { return nil, err } var data []byte - _, data, err = a.feeds.GetContent(&query.Feed) + _, data, err = a.feed.GetContent(&query.Feed) if err != nil { return nil, err } @@ -972,18 +972,18 @@ func (a *API) FeedsLookup(ctx context.Context, query *feeds.Query) ([]byte, erro } // FeedsNewRequest creates a Request object to update a specific feed -func (a *API) FeedsNewRequest(ctx context.Context, feed *feeds.Feed) (*feeds.Request, error) { - return a.feeds.NewRequest(ctx, feed) +func (a *API) FeedsNewRequest(ctx context.Context, feed *feed.Feed) (*feed.Request, error) { + return a.feed.NewRequest(ctx, feed) } // FeedsUpdate publishes a new update on the given feed -func (a *API) FeedsUpdate(ctx context.Context, request *feeds.Request) (storage.Address, error) { - return a.feeds.Update(ctx, request) +func (a *API) FeedsUpdate(ctx context.Context, request *feed.Request) (storage.Address, error) { + return a.feed.Update(ctx, request) } // FeedsHashSize returned the size of the digest produced by Swarm feeds' hashing function func (a *API) FeedsHashSize() int { - return a.feeds.HashSize + return a.feed.HashSize } // ErrCannotLoadFeedManifest is returned when looking up a feeds manifest fails @@ -993,7 +993,7 @@ var ErrCannotLoadFeedManifest = errors.New("Cannot load feed manifest") var ErrNotAFeedManifest = errors.New("Not a feed manifest") // ResolveFeedManifest retrieves the Swarm feed manifest for the given address, and returns the referenced Feed. -func (a *API) ResolveFeedManifest(ctx context.Context, addr storage.Address) (*feeds.Feed, error) { +func (a *API) ResolveFeedManifest(ctx context.Context, addr storage.Address) (*feed.Feed, error) { trie, err := loadManifest(ctx, a.fileStore, addr, nil, NOOPDecrypt) if err != nil { return nil, ErrCannotLoadFeedManifest @@ -1016,8 +1016,8 @@ var ErrCannotResolveFeed = errors.New("Cannot resolve Feed") // ResolveFeed attempts to extract feed information out of the manifest, if provided // If not, it attempts to extract the feed out of a set of key-value pairs -func (a *API) ResolveFeed(ctx context.Context, uri *URI, values feeds.Values) (*feeds.Feed, error) { - var feed *feeds.Feed +func (a *API) ResolveFeed(ctx context.Context, uri *URI, values feed.Values) (*feed.Feed, error) { + var fd *feed.Feed var err error if uri.Addr != "" { // resolve the content key. @@ -1030,20 +1030,20 @@ func (a *API) ResolveFeed(ctx context.Context, uri *URI, values feeds.Values) (* } // get the Swarm feed from the manifest - feed, err = a.ResolveFeedManifest(ctx, manifestAddr) + fd, err = a.ResolveFeedManifest(ctx, manifestAddr) if err != nil { return nil, err } - log.Debug("handle.get.feed: resolved", "manifestkey", manifestAddr, "feed", feed.Hex()) + log.Debug("handle.get.feed: resolved", "manifestkey", manifestAddr, "feed", fd.Hex()) } else { - var v feeds.Feed - if err := v.FromValues(values); err != nil { + var f feed.Feed + if err := f.FromValues(values); err != nil { return nil, ErrCannotResolveFeed } - feed = &v + fd = &f } - return feed, nil + return fd, nil } // MimeOctetStream default value of http Content-Type header diff --git a/swarm/api/client/client.go b/swarm/api/client/client.go index ac218e6a7..d9837ca73 100644 --- a/swarm/api/client/client.go +++ b/swarm/api/client/client.go @@ -35,7 +35,7 @@ import ( "strings" "github.com/ethereum/go-ethereum/swarm/api" - "github.com/ethereum/go-ethereum/swarm/storage/feeds" + "github.com/ethereum/go-ethereum/swarm/storage/feed" ) var ( @@ -608,7 +608,7 @@ var ErrNoFeedUpdatesFound = errors.New("No updates found for this feed") // data // Returns the resulting feed manifest address that you can use to include in an ENS Resolver (setContent) // or reference future updates (Client.UpdateFeed) -func (c *Client) CreateFeedWithManifest(request *feeds.Request) (string, error) { +func (c *Client) CreateFeedWithManifest(request *feed.Request) (string, error) { responseStream, err := c.updateFeed(request, true) if err != nil { return "", err @@ -628,12 +628,12 @@ func (c *Client) CreateFeedWithManifest(request *feeds.Request) (string, error) } // UpdateFeed allows you to set a new version of your content -func (c *Client) UpdateFeed(request *feeds.Request) error { +func (c *Client) UpdateFeed(request *feed.Request) error { _, err := c.updateFeed(request, false) return err } -func (c *Client) updateFeed(request *feeds.Request, createManifest bool) (io.ReadCloser, error) { +func (c *Client) updateFeed(request *feed.Request, createManifest bool) (io.ReadCloser, error) { URL, err := url.Parse(c.Gateway) if err != nil { return nil, err @@ -662,7 +662,7 @@ func (c *Client) updateFeed(request *feeds.Request, createManifest bool) (io.Rea // QueryFeed returns a byte stream with the raw content of the feed update // manifestAddressOrDomain is the address you obtained in CreateFeedWithManifest or an ENS domain whose Resolver // points to that address -func (c *Client) QueryFeed(query *feeds.Query, manifestAddressOrDomain string) (io.ReadCloser, error) { +func (c *Client) QueryFeed(query *feed.Query, manifestAddressOrDomain string) (io.ReadCloser, error) { return c.queryFeed(query, manifestAddressOrDomain, false) } @@ -670,7 +670,7 @@ func (c *Client) QueryFeed(query *feeds.Query, manifestAddressOrDomain string) ( // manifestAddressOrDomain is the address you obtained in CreateFeedWithManifest or an ENS domain whose Resolver // points to that address // meta set to true will instruct the node return feed metainformation instead -func (c *Client) queryFeed(query *feeds.Query, manifestAddressOrDomain string, meta bool) (io.ReadCloser, error) { +func (c *Client) queryFeed(query *feed.Query, manifestAddressOrDomain string, meta bool) (io.ReadCloser, error) { URL, err := url.Parse(c.Gateway) if err != nil { return nil, err @@ -709,7 +709,7 @@ func (c *Client) queryFeed(query *feeds.Query, manifestAddressOrDomain string, m // GetFeedRequest returns a structure that describes the referenced feed status // manifestAddressOrDomain is the address you obtained in CreateFeedWithManifest or an ENS domain whose Resolver // points to that address -func (c *Client) GetFeedRequest(query *feeds.Query, manifestAddressOrDomain string) (*feeds.Request, error) { +func (c *Client) GetFeedRequest(query *feed.Query, manifestAddressOrDomain string) (*feed.Request, error) { responseStream, err := c.queryFeed(query, manifestAddressOrDomain, true) if err != nil { @@ -722,7 +722,7 @@ func (c *Client) GetFeedRequest(query *feeds.Query, manifestAddressOrDomain stri return nil, err } - var metadata feeds.Request + var metadata feed.Request if err := metadata.UnmarshalJSON(body); err != nil { return nil, err } diff --git a/swarm/api/client/client_test.go b/swarm/api/client/client_test.go index 2aecdb299..03c6cbb28 100644 --- a/swarm/api/client/client_test.go +++ b/swarm/api/client/client_test.go @@ -25,14 +25,14 @@ import ( "sort" "testing" - "github.com/ethereum/go-ethereum/swarm/storage/feeds/lookup" + "github.com/ethereum/go-ethereum/swarm/storage/feed/lookup" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/swarm/api" swarmhttp "github.com/ethereum/go-ethereum/swarm/api/http" "github.com/ethereum/go-ethereum/swarm/multihash" - "github.com/ethereum/go-ethereum/swarm/storage/feeds" + "github.com/ethereum/go-ethereum/swarm/storage/feed" "github.com/ethereum/go-ethereum/swarm/testutil" ) @@ -361,12 +361,12 @@ func TestClientMultipartUpload(t *testing.T) { } } -func newTestSigner() (*feeds.GenericSigner, error) { +func newTestSigner() (*feed.GenericSigner, error) { privKey, err := crypto.HexToECDSA("deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef") if err != nil { return nil, err } - return feeds.NewGenericSigner(privKey), nil + return feed.NewGenericSigner(privKey), nil } // test the transparent resolving of multihash feed updates with bzz:// scheme @@ -394,9 +394,9 @@ func TestClientCreateFeedMultihash(t *testing.T) { mh := multihash.ToMultihash(s) // our feed topic - topic, _ := feeds.NewTopic("foo.eth", nil) + topic, _ := feed.NewTopic("foo.eth", nil) - createRequest := feeds.NewFirstRequest(topic) + createRequest := feed.NewFirstRequest(topic) createRequest.SetData(mh) if err := createRequest.Sign(signer); err != nil { @@ -448,8 +448,8 @@ func TestClientCreateUpdateFeed(t *testing.T) { databytes := []byte("En un lugar de La Mancha, de cuyo nombre no quiero acordarme...") // our feed topic name - topic, _ := feeds.NewTopic("El Quijote", nil) - createRequest := feeds.NewFirstRequest(topic) + topic, _ := feed.NewTopic("El Quijote", nil) + createRequest := feed.NewFirstRequest(topic) createRequest.SetData(databytes) if err := createRequest.Sign(signer); err != nil { @@ -508,12 +508,12 @@ func TestClientCreateUpdateFeed(t *testing.T) { // now try retrieving feed updates without a manifest - fd := &feeds.Feed{ + fd := &feed.Feed{ Topic: topic, User: signer.Address(), } - lookupParams := feeds.NewQueryLatest(fd, lookup.NoClue) + lookupParams := feed.NewQueryLatest(fd, lookup.NoClue) reader, err = client.QueryFeed(lookupParams, "") if err != nil { t.Fatalf("Error retrieving feed updates: %s", err) 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() } diff --git a/swarm/api/http/server_test.go b/swarm/api/http/server_test.go index 4ab99b209..1cf7ff577 100644 --- a/swarm/api/http/server_test.go +++ b/swarm/api/http/server_test.go @@ -38,7 +38,7 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/swarm/storage/feeds/lookup" + "github.com/ethereum/go-ethereum/swarm/storage/feed/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/feeds" + "github.com/ethereum/go-ethereum/swarm/storage/feed" "github.com/ethereum/go-ethereum/swarm/testutil" ) @@ -62,12 +62,12 @@ func serverFunc(api *api.API) testutil.TestServer { return NewServer(api, "") } -func newTestSigner() (*feeds.GenericSigner, error) { +func newTestSigner() (*feed.GenericSigner, error) { privKey, err := crypto.HexToECDSA("deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef") if err != nil { return nil, err } - return feeds.NewGenericSigner(privKey), nil + return feed.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, _ := feeds.NewTopic("foo.eth", nil) - updateRequest := feeds.NewFirstRequest(topic) + topic, _ := feed.NewTopic("foo.eth", nil) + updateRequest := feed.NewFirstRequest(topic) updateRequest.SetData(mh) @@ -182,8 +182,8 @@ func TestBzzFeed(t *testing.T) { //data for update 2 update2Data := []byte("foo") - topic, _ := feeds.NewTopic("foo.eth", nil) - updateRequest := feeds.NewFirstRequest(topic) + topic, _ := feed.NewTopic("foo.eth", nil) + updateRequest := feed.NewFirstRequest(topic) if err != nil { t.Fatal(err) } @@ -319,7 +319,7 @@ func TestBzzFeed(t *testing.T) { if err != nil { t.Fatal(err) } - updateRequest = &feeds.Request{} + updateRequest = &feed.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 := feeds.NewQuery(&updateRequest.Feed, update1Timestamp, lookup.NoClue) + query := feed.NewQuery(&updateRequest.Feed, update1Timestamp, lookup.NoClue) urlq, err := url.Parse(fmt.Sprintf("%s/bzz-feed:/", srv.URL)) if err != nil { diff --git a/swarm/api/manifest.go b/swarm/api/manifest.go index e45ae85c4..7c4cc88e4 100644 --- a/swarm/api/manifest.go +++ b/swarm/api/manifest.go @@ -27,7 +27,7 @@ import ( "strings" "time" - "github.com/ethereum/go-ethereum/swarm/storage/feeds" + "github.com/ethereum/go-ethereum/swarm/storage/feed" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/swarm/log" @@ -56,7 +56,7 @@ type ManifestEntry struct { ModTime time.Time `json:"mod_time,omitempty"` Status int `json:"status,omitempty"` Access *AccessEntry `json:"access,omitempty"` - Feed *feeds.Feed `json:"feed,omitempty"` + Feed *feed.Feed `json:"feed,omitempty"` } // ManifestList represents the result of listing files in a manifest @@ -82,7 +82,7 @@ func (a *API) NewManifest(ctx context.Context, toEncrypt bool) (storage.Address, // Manifest hack for supporting Swarm feeds from the bzz: scheme // see swarm/api/api.go:API.Get() for more information -func (a *API) NewFeedManifest(ctx context.Context, feed *feeds.Feed) (storage.Address, error) { +func (a *API) NewFeedManifest(ctx context.Context, feed *feed.Feed) (storage.Address, error) { var manifest Manifest entry := ManifestEntry{ Feed: feed, diff --git a/swarm/pss/notify/notify.go b/swarm/pss/notify/notify.go index 01ecb4ff9..3731fb9db 100644 --- a/swarm/pss/notify/notify.go +++ b/swarm/pss/notify/notify.go @@ -317,7 +317,7 @@ func (c *Controller) handleStartMsg(msg *Msg, keyid string) (err error) { return err } - // TODO this is set to zero-length byte pending decision on protocol for initial message, whether it should include message or not, and how to trigger the initial message so that current state of Swarm Feed is sent upon subscription + // TODO this is set to zero-length byte pending decision on protocol for initial message, whether it should include message or not, and how to trigger the initial message so that current state of Swarm feed is sent upon subscription notify := []byte{} replyMsg := NewMsg(MsgCodeNotifyWithKey, msg.namestring, make([]byte, len(notify)+symKeyLength)) copy(replyMsg.Payload, notify) diff --git a/swarm/storage/feeds/binaryserializer.go b/swarm/storage/feed/binaryserializer.go index ce146571b..4e4f67a09 100644 --- a/swarm/storage/feeds/binaryserializer.go +++ b/swarm/storage/feed/binaryserializer.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. -package feeds +package feed import "github.com/ethereum/go-ethereum/common/hexutil" diff --git a/swarm/storage/feeds/binaryserializer_test.go b/swarm/storage/feed/binaryserializer_test.go index 0c81e7f18..37828d1c9 100644 --- a/swarm/storage/feeds/binaryserializer_test.go +++ b/swarm/storage/feed/binaryserializer_test.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. -package feeds +package feed import ( "encoding/json" diff --git a/swarm/storage/feeds/cacheentry.go b/swarm/storage/feed/cacheentry.go index e40037688..be42008e9 100644 --- a/swarm/storage/feeds/cacheentry.go +++ b/swarm/storage/feed/cacheentry.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. -package feeds +package feed import ( "bytes" diff --git a/swarm/storage/feeds/doc.go b/swarm/storage/feed/doc.go index d1edf5d6d..1f07948f2 100644 --- a/swarm/storage/feeds/doc.go +++ b/swarm/storage/feed/doc.go @@ -40,4 +40,4 @@ Request: Feed Update with signature Epoch: time slot where the update is stored */ -package feeds +package feed diff --git a/swarm/storage/feeds/error.go b/swarm/storage/feed/error.go index 7751a9f19..206ba3316 100644 --- a/swarm/storage/feeds/error.go +++ b/swarm/storage/feed/error.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. -package feeds +package feed import ( "fmt" diff --git a/swarm/storage/feeds/feed.go b/swarm/storage/feed/feed.go index d5b262555..b6ea665a6 100644 --- a/swarm/storage/feeds/feed.go +++ b/swarm/storage/feed/feed.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. -package feeds +package feed import ( "hash" diff --git a/swarm/storage/feeds/feed_test.go b/swarm/storage/feed/feed_test.go index 7806e0ad7..6a575594f 100644 --- a/swarm/storage/feeds/feed_test.go +++ b/swarm/storage/feed/feed_test.go @@ -13,7 +13,7 @@ // // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. -package feeds +package feed import ( "testing" diff --git a/swarm/storage/feeds/handler.go b/swarm/storage/feed/handler.go index 2c5261614..9e2640282 100644 --- a/swarm/storage/feeds/handler.go +++ b/swarm/storage/feed/handler.go @@ -16,7 +16,7 @@ // Handler is the API for feeds // It enables creating, updating, syncing and retrieving feed updates and their data -package feeds +package feed import ( "bytes" @@ -25,7 +25,7 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/swarm/storage/feeds/lookup" + "github.com/ethereum/go-ethereum/swarm/storage/feed/lookup" "github.com/ethereum/go-ethereum/swarm/log" "github.com/ethereum/go-ethereum/swarm/storage" diff --git a/swarm/storage/feeds/handler_test.go b/swarm/storage/feed/handler_test.go index b35a7c1c1..cf95bc1f5 100644 --- a/swarm/storage/feeds/handler_test.go +++ b/swarm/storage/feed/handler_test.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. -package feeds +package feed import ( "bytes" @@ -31,7 +31,7 @@ import ( "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/swarm/chunk" "github.com/ethereum/go-ethereum/swarm/storage" - "github.com/ethereum/go-ethereum/swarm/storage/feeds/lookup" + "github.com/ethereum/go-ethereum/swarm/storage/feed/lookup" ) var ( diff --git a/swarm/storage/feeds/id.go b/swarm/storage/feed/id.go index dd813ae89..7e17743c1 100644 --- a/swarm/storage/feeds/id.go +++ b/swarm/storage/feed/id.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. -package feeds +package feed import ( "fmt" @@ -22,7 +22,7 @@ import ( "strconv" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/swarm/storage/feeds/lookup" + "github.com/ethereum/go-ethereum/swarm/storage/feed/lookup" "github.com/ethereum/go-ethereum/swarm/storage" ) diff --git a/swarm/storage/feeds/id_test.go b/swarm/storage/feed/id_test.go index 2ef12e891..e561ff9b4 100644 --- a/swarm/storage/feeds/id_test.go +++ b/swarm/storage/feed/id_test.go @@ -1,9 +1,9 @@ -package feeds +package feed import ( "testing" - "github.com/ethereum/go-ethereum/swarm/storage/feeds/lookup" + "github.com/ethereum/go-ethereum/swarm/storage/feed/lookup" ) func getTestID() *ID { diff --git a/swarm/storage/feeds/lookup/epoch.go b/swarm/storage/feed/lookup/epoch.go index bafe95477..bafe95477 100644 --- a/swarm/storage/feeds/lookup/epoch.go +++ b/swarm/storage/feed/lookup/epoch.go diff --git a/swarm/storage/feeds/lookup/epoch_test.go b/swarm/storage/feed/lookup/epoch_test.go index 70bfd836a..0629f3d1d 100644 --- a/swarm/storage/feeds/lookup/epoch_test.go +++ b/swarm/storage/feed/lookup/epoch_test.go @@ -3,7 +3,7 @@ package lookup_test import ( "testing" - "github.com/ethereum/go-ethereum/swarm/storage/feeds/lookup" + "github.com/ethereum/go-ethereum/swarm/storage/feed/lookup" ) func TestMarshallers(t *testing.T) { diff --git a/swarm/storage/feeds/lookup/lookup.go b/swarm/storage/feed/lookup/lookup.go index 2f862d81c..2f862d81c 100644 --- a/swarm/storage/feeds/lookup/lookup.go +++ b/swarm/storage/feed/lookup/lookup.go diff --git a/swarm/storage/feeds/lookup/lookup_test.go b/swarm/storage/feed/lookup/lookup_test.go index 7d5014608..d71e81e95 100644 --- a/swarm/storage/feeds/lookup/lookup_test.go +++ b/swarm/storage/feed/lookup/lookup_test.go @@ -22,7 +22,7 @@ import ( "testing" "github.com/ethereum/go-ethereum/swarm/log" - "github.com/ethereum/go-ethereum/swarm/storage/feeds/lookup" + "github.com/ethereum/go-ethereum/swarm/storage/feed/lookup" ) type Data struct { diff --git a/swarm/storage/feeds/query.go b/swarm/storage/feed/query.go index 7bd2800a8..8be78a952 100644 --- a/swarm/storage/feeds/query.go +++ b/swarm/storage/feed/query.go @@ -14,14 +14,14 @@ // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. -package feeds +package feed import ( "fmt" "strconv" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/swarm/storage/feeds/lookup" + "github.com/ethereum/go-ethereum/swarm/storage/feed/lookup" ) // Query is used to specify constraints when performing an update lookup diff --git a/swarm/storage/feeds/query_test.go b/swarm/storage/feed/query_test.go index 1420c69ae..9fa5e2980 100644 --- a/swarm/storage/feeds/query_test.go +++ b/swarm/storage/feed/query_test.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. -package feeds +package feed import ( "testing" diff --git a/swarm/storage/feeds/request.go b/swarm/storage/feed/request.go index 81e1b10fe..6968d8b9a 100644 --- a/swarm/storage/feeds/request.go +++ b/swarm/storage/feed/request.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. -package feeds +package feed import ( "bytes" @@ -24,7 +24,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/swarm/storage" - "github.com/ethereum/go-ethereum/swarm/storage/feeds/lookup" + "github.com/ethereum/go-ethereum/swarm/storage/feed/lookup" ) // Request represents a request to sign or signed feed update message diff --git a/swarm/storage/feeds/request_test.go b/swarm/storage/feed/request_test.go index 8a15815a4..f5de32b74 100644 --- a/swarm/storage/feeds/request_test.go +++ b/swarm/storage/feed/request_test.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. -package feeds +package feed import ( "bytes" @@ -26,7 +26,7 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/swarm/storage" - "github.com/ethereum/go-ethereum/swarm/storage/feeds/lookup" + "github.com/ethereum/go-ethereum/swarm/storage/feed/lookup" ) func areEqualJSON(s1, s2 string) (bool, error) { diff --git a/swarm/storage/feeds/sign.go b/swarm/storage/feed/sign.go index f5760c8f2..5f0ea0b33 100644 --- a/swarm/storage/feeds/sign.go +++ b/swarm/storage/feed/sign.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. -package feeds +package feed import ( "crypto/ecdsa" diff --git a/swarm/storage/feeds/testutil.go b/swarm/storage/feed/testutil.go index 879f73348..b513fa1f2 100644 --- a/swarm/storage/feeds/testutil.go +++ b/swarm/storage/feed/testutil.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. -package feeds +package feed import ( "context" diff --git a/swarm/storage/feeds/timestampprovider.go b/swarm/storage/feed/timestampprovider.go index f6aa0775c..072dc3a48 100644 --- a/swarm/storage/feeds/timestampprovider.go +++ b/swarm/storage/feed/timestampprovider.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. -package feeds +package feed import ( "encoding/binary" diff --git a/swarm/storage/feeds/topic.go b/swarm/storage/feed/topic.go index 2dc8c18cd..43a7b4ba4 100644 --- a/swarm/storage/feeds/topic.go +++ b/swarm/storage/feed/topic.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. -package feeds +package feed import ( "bytes" diff --git a/swarm/storage/feeds/topic_test.go b/swarm/storage/feed/topic_test.go index 8994002d7..0403204f7 100644 --- a/swarm/storage/feeds/topic_test.go +++ b/swarm/storage/feed/topic_test.go @@ -1,4 +1,4 @@ -package feeds +package feed import ( "testing" diff --git a/swarm/storage/feeds/update.go b/swarm/storage/feed/update.go index 02bd37522..627a537d1 100644 --- a/swarm/storage/feeds/update.go +++ b/swarm/storage/feed/update.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. -package feeds +package feed import ( "fmt" diff --git a/swarm/storage/feeds/update_test.go b/swarm/storage/feed/update_test.go index 7763da0c8..4007223c6 100644 --- a/swarm/storage/feeds/update_test.go +++ b/swarm/storage/feed/update_test.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. -package feeds +package feed import ( "testing" diff --git a/swarm/swarm.go b/swarm/swarm.go index 74c53dece..6aa15edd9 100644 --- a/swarm/swarm.go +++ b/swarm/swarm.go @@ -49,8 +49,8 @@ import ( "github.com/ethereum/go-ethereum/swarm/pss" "github.com/ethereum/go-ethereum/swarm/state" "github.com/ethereum/go-ethereum/swarm/storage" + "github.com/ethereum/go-ethereum/swarm/storage/feed" "github.com/ethereum/go-ethereum/swarm/storage/mock" - "github.com/ethereum/go-ethereum/swarm/storage/feeds" "github.com/ethereum/go-ethereum/swarm/tracing" ) @@ -186,10 +186,10 @@ func NewSwarm(config *api.Config, mockStore *mock.NodeStore) (self *Swarm, err e // Swarm Hash Merklised Chunking for Arbitrary-length Document/File storage self.fileStore = storage.NewFileStore(self.netStore, self.config.FileStoreParams) - var feedsHandler *feeds.Handler - fhParams := &feeds.HandlerParams{} + var feedsHandler *feed.Handler + fhParams := &feed.HandlerParams{} - feedsHandler = feeds.NewHandler(fhParams) + feedsHandler = feed.NewHandler(fhParams) feedsHandler.SetStore(self.netStore) lstore.Validators = []storage.ChunkValidator{ diff --git a/swarm/testutil/http.go b/swarm/testutil/http.go index 2e5735ece..cdf9239d0 100644 --- a/swarm/testutil/http.go +++ b/swarm/testutil/http.go @@ -25,7 +25,7 @@ import ( "github.com/ethereum/go-ethereum/swarm/api" "github.com/ethereum/go-ethereum/swarm/storage" - "github.com/ethereum/go-ethereum/swarm/storage/feeds" + "github.com/ethereum/go-ethereum/swarm/storage/feed" ) type TestServer interface { @@ -54,8 +54,8 @@ func NewTestSwarmServer(t *testing.T, serverFunc func(*api.API) TestServer, reso t.Fatal(err) } - rhparams := &feeds.HandlerParams{} - rh, err := feeds.NewTestHandler(feedsDir, rhparams) + rhparams := &feed.HandlerParams{} + rh, err := feed.NewTestHandler(feedsDir, rhparams) if err != nil { t.Fatal(err) } @@ -75,7 +75,7 @@ func NewTestSwarmServer(t *testing.T, serverFunc func(*api.API) TestServer, reso }, CurrentTime: 42, } - feeds.TimestampProvider = tss + feed.TimestampProvider = tss return tss } @@ -92,6 +92,6 @@ func (t *TestSwarmServer) Close() { t.cleanup() } -func (t *TestSwarmServer) Now() feeds.Timestamp { - return feeds.Timestamp{Time: t.CurrentTime} +func (t *TestSwarmServer) Now() feed.Timestamp { + return feed.Timestamp{Time: t.CurrentTime} } |