swarm/storage/feeds: Final package rename and moved files
This commit is contained in:
@ -35,7 +35,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/ethereum/go-ethereum/swarm/api"
|
||||
"github.com/ethereum/go-ethereum/swarm/storage/mru"
|
||||
"github.com/ethereum/go-ethereum/swarm/storage/feeds"
|
||||
)
|
||||
|
||||
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 *mru.Request) (string, error) {
|
||||
func (c *Client) CreateFeedWithManifest(request *feeds.Request) (string, error) {
|
||||
responseStream, err := c.updateFeed(request, true)
|
||||
if err != nil {
|
||||
return "", err
|
||||
@ -628,12 +628,12 @@ func (c *Client) CreateFeedWithManifest(request *mru.Request) (string, error) {
|
||||
}
|
||||
|
||||
// UpdateFeed allows you to set a new version of your content
|
||||
func (c *Client) UpdateFeed(request *mru.Request) error {
|
||||
func (c *Client) UpdateFeed(request *feeds.Request) error {
|
||||
_, err := c.updateFeed(request, false)
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *Client) updateFeed(request *mru.Request, createManifest bool) (io.ReadCloser, error) {
|
||||
func (c *Client) updateFeed(request *feeds.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 *mru.Request, createManifest bool) (io.ReadC
|
||||
// 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 *mru.Query, manifestAddressOrDomain string) (io.ReadCloser, error) {
|
||||
func (c *Client) QueryFeed(query *feeds.Query, manifestAddressOrDomain string) (io.ReadCloser, error) {
|
||||
return c.queryFeed(query, manifestAddressOrDomain, false)
|
||||
}
|
||||
|
||||
@ -670,7 +670,7 @@ func (c *Client) QueryFeed(query *mru.Query, manifestAddressOrDomain string) (io
|
||||
// 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 *mru.Query, manifestAddressOrDomain string, meta bool) (io.ReadCloser, error) {
|
||||
func (c *Client) queryFeed(query *feeds.Query, manifestAddressOrDomain string, meta bool) (io.ReadCloser, error) {
|
||||
URL, err := url.Parse(c.Gateway)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -706,10 +706,10 @@ func (c *Client) queryFeed(query *mru.Query, manifestAddressOrDomain string, met
|
||||
return res.Body, nil
|
||||
}
|
||||
|
||||
// GetFeedMetadata returns a structure that describes the referenced Feed status
|
||||
// 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) GetFeedMetadata(query *mru.Query, manifestAddressOrDomain string) (*mru.Request, error) {
|
||||
func (c *Client) GetFeedRequest(query *feeds.Query, manifestAddressOrDomain string) (*feeds.Request, error) {
|
||||
|
||||
responseStream, err := c.queryFeed(query, manifestAddressOrDomain, true)
|
||||
if err != nil {
|
||||
@ -722,7 +722,7 @@ func (c *Client) GetFeedMetadata(query *mru.Query, manifestAddressOrDomain strin
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var metadata mru.Request
|
||||
var metadata feeds.Request
|
||||
if err := metadata.UnmarshalJSON(body); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -25,14 +25,14 @@ import (
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
"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/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/mru"
|
||||
"github.com/ethereum/go-ethereum/swarm/storage/feeds"
|
||||
"github.com/ethereum/go-ethereum/swarm/testutil"
|
||||
)
|
||||
|
||||
@ -361,12 +361,12 @@ func TestClientMultipartUpload(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
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 feed updates with bzz:// scheme
|
||||
@ -394,9 +394,9 @@ func TestClientCreateFeedMultihash(t *testing.T) {
|
||||
mh := multihash.ToMultihash(s)
|
||||
|
||||
// our feed topic
|
||||
topic, _ := mru.NewTopic("foo.eth", nil)
|
||||
topic, _ := feeds.NewTopic("foo.eth", nil)
|
||||
|
||||
createRequest := mru.NewFirstRequest(topic)
|
||||
createRequest := feeds.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, _ := mru.NewTopic("El Quijote", nil)
|
||||
createRequest := mru.NewFirstRequest(topic)
|
||||
topic, _ := feeds.NewTopic("El Quijote", nil)
|
||||
createRequest := feeds.NewFirstRequest(topic)
|
||||
|
||||
createRequest.SetData(databytes)
|
||||
if err := createRequest.Sign(signer); err != nil {
|
||||
@ -479,7 +479,7 @@ func TestClientCreateUpdateFeed(t *testing.T) {
|
||||
// define different data
|
||||
databytes = []byte("... no ha mucho tiempo que vivía un hidalgo de los de lanza en astillero ...")
|
||||
|
||||
updateRequest, err := client.GetFeedMetadata(nil, correctManifestAddrHex)
|
||||
updateRequest, err := client.GetFeedRequest(nil, correctManifestAddrHex)
|
||||
if err != nil {
|
||||
t.Fatalf("Error retrieving update request template: %s", err)
|
||||
}
|
||||
@ -508,12 +508,12 @@ func TestClientCreateUpdateFeed(t *testing.T) {
|
||||
|
||||
// now try retrieving feed updates without a manifest
|
||||
|
||||
feed := &mru.Feed{
|
||||
feed := &feeds.Feed{
|
||||
Topic: topic,
|
||||
User: signer.Address(),
|
||||
}
|
||||
|
||||
lookupParams := mru.NewQueryLatest(feed, lookup.NoClue)
|
||||
lookupParams := feeds.NewQueryLatest(feed, lookup.NoClue)
|
||||
reader, err = client.QueryFeed(lookupParams, "")
|
||||
if err != nil {
|
||||
t.Fatalf("Error retrieving feed updates: %s", err)
|
||||
|
Reference in New Issue
Block a user