swarm/storage/mru: Renamed rest of MRU references
This commit is contained in:
@ -30,8 +30,8 @@ var (
|
||||
)
|
||||
|
||||
// tests that the content address validator correctly checks the data
|
||||
// tests that resource update chunks are passed through content address validator
|
||||
// the test checking the resouce update validator internal correctness is found in resource_test.go
|
||||
// tests that Feed update chunks are passed through content address validator
|
||||
// the test checking the resouce update validator internal correctness is found in storage/feeds/handler_test.go
|
||||
func TestValidator(t *testing.T) {
|
||||
// set up localstore
|
||||
datadir, err := ioutil.TempDir("", "storage-testvalidator")
|
||||
|
@ -26,7 +26,7 @@ The Feed Update data is:
|
||||
updatedata = Feed|Epoch|data
|
||||
|
||||
The full update data that goes in the chunk payload is:
|
||||
resourcedata|sign(resourcedata)
|
||||
updatedata|sign(updatedata)
|
||||
|
||||
Structure Summary:
|
||||
|
||||
|
@ -35,7 +35,7 @@ const (
|
||||
ErrCnt
|
||||
)
|
||||
|
||||
// Error is a the typed error object used for Mutable Resources
|
||||
// Error is a the typed error object used for Swarm Feeds
|
||||
type Error struct {
|
||||
code int
|
||||
err string
|
||||
|
@ -14,8 +14,8 @@
|
||||
// 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/>.
|
||||
|
||||
// Handler is the API for Mutable Resources
|
||||
// It enables creating, updating, syncing and retrieving resources and their update data
|
||||
// Handler is the API for Feeds
|
||||
// It enables creating, updating, syncing and retrieving feed updates and their data
|
||||
package mru
|
||||
|
||||
import (
|
||||
@ -265,7 +265,7 @@ func (h *Handler) Update(ctx context.Context, r *Request) (updateAddr storage.Ad
|
||||
// send the chunk
|
||||
h.chunkStore.Put(ctx, chunk)
|
||||
log.Trace("feed update", "updateAddr", r.idAddr, "epoch time", r.Epoch.Time, "epoch level", r.Epoch.Level, "data", chunk.Data())
|
||||
// update our resources map cache entry if the new update is older than the one we have, if we have it.
|
||||
// update our feed updates map cache entry if the new update is older than the one we have, if we have it.
|
||||
if feedUpdate != nil && r.Epoch.After(feedUpdate.Epoch) {
|
||||
feedUpdate.Epoch = r.Epoch
|
||||
feedUpdate.data = make([]byte, len(r.data))
|
||||
|
@ -396,7 +396,7 @@ func TestValidatorInStore(t *testing.T) {
|
||||
signer := newAliceSigner()
|
||||
|
||||
// set up localstore
|
||||
datadir, err := ioutil.TempDir("", "storage-testresourcevalidator")
|
||||
datadir, err := ioutil.TempDir("", "storage-testfeedsvalidator")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -463,7 +463,7 @@ func TestValidatorInStore(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// create rpc and resourcehandler
|
||||
// create rpc and Feeds Handler
|
||||
func setupTest(timeProvider timestampProvider, signer Signer) (fh *TestHandler, datadir string, teardown func(), err error) {
|
||||
|
||||
var fsClean func()
|
||||
|
@ -228,7 +228,7 @@ func TestUpdateChunkSerializationErrorChecking(t *testing.T) {
|
||||
var recovered Request
|
||||
recovered.fromChunk(chunk.Address(), chunk.Data())
|
||||
if !reflect.DeepEqual(recovered, r) {
|
||||
t.Fatal("Expected recovered SignedResource update to equal the original one")
|
||||
t.Fatal("Expected recovered Request update to equal the original one")
|
||||
}
|
||||
}
|
||||
|
||||
@ -248,7 +248,7 @@ func TestReverse(t *testing.T) {
|
||||
// signer containing private key
|
||||
signer := newAliceSigner()
|
||||
|
||||
// set up rpc and create resourcehandler
|
||||
// set up rpc and create Feeds handler
|
||||
_, _, teardownTest, err := setupTest(timeProvider, signer)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
Reference in New Issue
Block a user