aboutsummaryrefslogtreecommitdiffstats
path: root/swarm/api
diff options
context:
space:
mode:
authorJavier Peletier <jm@epiclabs.io>2018-09-29 07:00:28 +0800
committerJavier Peletier <jm@epiclabs.io>2018-10-03 15:12:06 +0800
commitf1e86ad9cf0470051b7106ee83794d27276b528d (patch)
tree4a11bd2816200bac0a0e24a3b3c5c79db84e2bf4 /swarm/api
parentbd1f7ebda27d57002b6a04a95812420a40117b3a (diff)
downloaddexon-f1e86ad9cf0470051b7106ee83794d27276b528d.tar.gz
dexon-f1e86ad9cf0470051b7106ee83794d27276b528d.tar.zst
dexon-f1e86ad9cf0470051b7106ee83794d27276b528d.zip
swarm/storage/mru: Renamed all identifiers to Feeds
Diffstat (limited to 'swarm/api')
-rw-r--r--swarm/api/api.go14
-rw-r--r--swarm/api/client/client_test.go2
-rw-r--r--swarm/api/http/server.go8
-rw-r--r--swarm/api/http/server_test.go4
-rw-r--r--swarm/api/manifest.go4
5 files changed, 16 insertions, 16 deletions
diff --git a/swarm/api/api.go b/swarm/api/api.go
index 7b8f04c13..e6b676dba 100644
--- a/swarm/api/api.go
+++ b/swarm/api/api.go
@@ -956,14 +956,14 @@ func (a *API) BuildDirectoryTree(ctx context.Context, mhash string, nameresolver
return addr, manifestEntryMap, nil
}
-// ResourceLookup finds mutable resource updates at specific periods and versions
+// ResourceLookup finds Swarm Feeds at specific periods and versions
func (a *API) ResourceLookup(ctx context.Context, query *mru.Query) ([]byte, error) {
_, err := a.resource.Lookup(ctx, query)
if err != nil {
return nil, err
}
var data []byte
- _, data, err = a.resource.GetContent(&query.View)
+ _, data, err = a.resource.GetContent(&query.Feed)
if err != nil {
return nil, err
}
@@ -971,7 +971,7 @@ func (a *API) ResourceLookup(ctx context.Context, query *mru.Query) ([]byte, err
}
// ResourceNewRequest creates a Request object to update a specific mutable resource
-func (a *API) ResourceNewRequest(ctx context.Context, view *mru.View) (*mru.Request, error) {
+func (a *API) ResourceNewRequest(ctx context.Context, view *mru.Feed) (*mru.Request, error) {
return a.resource.NewRequest(ctx, view)
}
@@ -993,7 +993,7 @@ var ErrCannotLoadResourceManifest = errors.New("Cannot load resource manifest")
var ErrNotAResourceManifest = errors.New("Not a resource manifest")
// ResolveResourceManifest retrieves the Mutable Resource manifest for the given address, and returns the Resource's view ID.
-func (a *API) ResolveResourceManifest(ctx context.Context, addr storage.Address) (*mru.View, error) {
+func (a *API) ResolveResourceManifest(ctx context.Context, addr storage.Address) (*mru.Feed, error) {
trie, err := loadManifest(ctx, a.fileStore, addr, nil, NOOPDecrypt)
if err != nil {
return nil, ErrCannotLoadResourceManifest
@@ -1016,8 +1016,8 @@ var ErrCannotResolveResourceView = errors.New("Cannot resolve resource view")
// ResolveResourceView attempts to extract View information out of the manifest, if provided
// If not, it attempts to extract the View out of a set of key-value pairs
-func (a *API) ResolveResourceView(ctx context.Context, uri *URI, values mru.Values) (*mru.View, error) {
- var view *mru.View
+func (a *API) ResolveResourceView(ctx context.Context, uri *URI, values mru.Values) (*mru.Feed, error) {
+ var view *mru.Feed
var err error
if uri.Addr != "" {
// resolve the content key.
@@ -1036,7 +1036,7 @@ func (a *API) ResolveResourceView(ctx context.Context, uri *URI, values mru.Valu
}
log.Debug("handle.get.resource: resolved", "manifestkey", manifestAddr, "view", view.Hex())
} else {
- var v mru.View
+ var v mru.Feed
if err := v.FromValues(values); err != nil {
return nil, ErrCannotResolveResourceView
diff --git a/swarm/api/client/client_test.go b/swarm/api/client/client_test.go
index 02980de1d..c6ad0237b 100644
--- a/swarm/api/client/client_test.go
+++ b/swarm/api/client/client_test.go
@@ -508,7 +508,7 @@ func TestClientCreateUpdateResource(t *testing.T) {
// now try retrieving resource without a manifest
- view := &mru.View{
+ view := &mru.Feed{
Topic: topic,
User: signer.Address(),
}
diff --git a/swarm/api/http/server.go b/swarm/api/http/server.go
index 5ec69373d..4c19dd6df 100644
--- a/swarm/api/http/server.go
+++ b/swarm/api/http/server.go
@@ -517,7 +517,7 @@ func (s *Server) HandlePostResource(w http.ResponseWriter, r *http.Request) {
}
var updateRequest mru.Request
- updateRequest.View = *view
+ updateRequest.Feed = *view
query := r.URL.Query()
if err := updateRequest.FromValues(query, body); err != nil { // decodes request from query parameters
@@ -544,7 +544,7 @@ func (s *Server) HandlePostResource(w http.ResponseWriter, r *http.Request) {
// we create a manifest so we can retrieve the resource with bzz:// later
// this manifest has a special "resource type" manifest, and saves the
// resource view ID used to retrieve the resource later
- m, err := s.api.NewResourceManifest(r.Context(), &updateRequest.View)
+ m, err := s.api.NewResourceManifest(r.Context(), &updateRequest.Feed)
if err != nil {
RespondError(w, r, fmt.Sprintf("failed to create resource manifest: %v", err), http.StatusInternalServerError)
return
@@ -563,7 +563,7 @@ func (s *Server) HandlePostResource(w http.ResponseWriter, r *http.Request) {
}
}
-// Retrieve mutable resource updates:
+// Retrieve Swarm Feeds:
// bzz-resource://<id> - get latest update
// bzz-resource://<id>/?period=n - get latest update on period n
// bzz-resource://<id>/?period=n&version=m - get update version m of period n
@@ -606,7 +606,7 @@ func (s *Server) HandleGetResource(w http.ResponseWriter, r *http.Request) {
return
}
- lookupParams := &mru.Query{View: *view}
+ lookupParams := &mru.Query{Feed: *view}
if err = lookupParams.FromValues(r.URL.Query()); err != nil { // parse period, version
RespondError(w, r, fmt.Sprintf("invalid mutable resource request:%s", err), http.StatusBadRequest)
return
diff --git a/swarm/api/http/server_test.go b/swarm/api/http/server_test.go
index 817519a30..0855d30a2 100644
--- a/swarm/api/http/server_test.go
+++ b/swarm/api/http/server_test.go
@@ -206,7 +206,7 @@ func TestBzzResourceMultihash(t *testing.T) {
}
}
-// Test resource updates using the raw update methods
+// Test Swarm Feeds using the raw update methods
func TestBzzResource(t *testing.T) {
srv := testutil.NewTestSwarmServer(t, serverFunc, nil)
signer, _ := newTestSigner()
@@ -406,7 +406,7 @@ func TestBzzResource(t *testing.T) {
// test manifest-less queries
log.Info("get first update in update1Timestamp via direct query")
- query := mru.NewQuery(&updateRequest.View, update1Timestamp, lookup.NoClue)
+ query := mru.NewQuery(&updateRequest.Feed, update1Timestamp, lookup.NoClue)
urlq, err := url.Parse(fmt.Sprintf("%s/bzz-resource:/", srv.URL))
if err != nil {
diff --git a/swarm/api/manifest.go b/swarm/api/manifest.go
index 06be7323e..9672ca540 100644
--- a/swarm/api/manifest.go
+++ b/swarm/api/manifest.go
@@ -56,7 +56,7 @@ type ManifestEntry struct {
ModTime time.Time `json:"mod_time,omitempty"`
Status int `json:"status,omitempty"`
Access *AccessEntry `json:"access,omitempty"`
- ResourceView *mru.View `json:"resourceView,omitempty"`
+ ResourceView *mru.Feed `json:"resourceView,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 Mutable Resource Updates from the bzz: scheme
// see swarm/api/api.go:API.Get() for more information
-func (a *API) NewResourceManifest(ctx context.Context, view *mru.View) (storage.Address, error) {
+func (a *API) NewResourceManifest(ctx context.Context, view *mru.Feed) (storage.Address, error) {
var manifest Manifest
entry := ManifestEntry{
ResourceView: view,