aboutsummaryrefslogtreecommitdiffstats
path: root/swarm/storage
diff options
context:
space:
mode:
authorJavier Peletier <jm@epiclabs.io>2018-09-30 15:51:11 +0800
committerJavier Peletier <jm@epiclabs.io>2018-10-03 15:12:06 +0800
commitb6ccc06cdaac80d09da17c25b2f450cd1f1b7914 (patch)
tree2413da1a2025e901eecf253399fe4bfebbdd1925 /swarm/storage
parent83705ef6aa3645a6305a400fa175e44904a929f7 (diff)
downloadgo-tangerine-b6ccc06cdaac80d09da17c25b2f450cd1f1b7914.tar
go-tangerine-b6ccc06cdaac80d09da17c25b2f450cd1f1b7914.tar.gz
go-tangerine-b6ccc06cdaac80d09da17c25b2f450cd1f1b7914.tar.bz2
go-tangerine-b6ccc06cdaac80d09da17c25b2f450cd1f1b7914.tar.lz
go-tangerine-b6ccc06cdaac80d09da17c25b2f450cd1f1b7914.tar.xz
go-tangerine-b6ccc06cdaac80d09da17c25b2f450cd1f1b7914.tar.zst
go-tangerine-b6ccc06cdaac80d09da17c25b2f450cd1f1b7914.zip
swarm/storage/feeds: Final package rename and moved files
Diffstat (limited to 'swarm/storage')
-rw-r--r--swarm/storage/feeds/binaryserializer.go (renamed from swarm/storage/mru/binaryserializer.go)2
-rw-r--r--swarm/storage/feeds/binaryserializer_test.go (renamed from swarm/storage/mru/binaryserializer_test.go)2
-rw-r--r--swarm/storage/feeds/cacheentry.go (renamed from swarm/storage/mru/cacheentry.go)2
-rw-r--r--swarm/storage/feeds/doc.go (renamed from swarm/storage/mru/doc.go)2
-rw-r--r--swarm/storage/feeds/error.go (renamed from swarm/storage/mru/error.go)4
-rw-r--r--swarm/storage/feeds/feed.go (renamed from swarm/storage/mru/view.go)38
-rw-r--r--swarm/storage/feeds/feed_test.go (renamed from swarm/storage/mru/view_test.go)2
-rw-r--r--swarm/storage/feeds/handler.go (renamed from swarm/storage/mru/handler.go)4
-rw-r--r--swarm/storage/feeds/handler_test.go (renamed from swarm/storage/mru/handler_test.go)4
-rw-r--r--swarm/storage/feeds/id.go (renamed from swarm/storage/mru/id.go)4
-rw-r--r--swarm/storage/feeds/id_test.go (renamed from swarm/storage/mru/id_test.go)4
-rw-r--r--swarm/storage/feeds/lookup/epoch.go (renamed from swarm/storage/mru/lookup/epoch.go)0
-rw-r--r--swarm/storage/feeds/lookup/epoch_test.go (renamed from swarm/storage/mru/lookup/epoch_test.go)2
-rw-r--r--swarm/storage/feeds/lookup/lookup.go (renamed from swarm/storage/mru/lookup/lookup.go)0
-rw-r--r--swarm/storage/feeds/lookup/lookup_test.go (renamed from swarm/storage/mru/lookup/lookup_test.go)2
-rw-r--r--swarm/storage/feeds/query.go (renamed from swarm/storage/mru/query.go)4
-rw-r--r--swarm/storage/feeds/query_test.go (renamed from swarm/storage/mru/query_test.go)2
-rw-r--r--swarm/storage/feeds/request.go (renamed from swarm/storage/mru/request.go)4
-rw-r--r--swarm/storage/feeds/request_test.go (renamed from swarm/storage/mru/request_test.go)4
-rw-r--r--swarm/storage/feeds/sign.go (renamed from swarm/storage/mru/sign.go)2
-rw-r--r--swarm/storage/feeds/testutil.go (renamed from swarm/storage/mru/testutil.go)2
-rw-r--r--swarm/storage/feeds/timestampprovider.go (renamed from swarm/storage/mru/timestampprovider.go)4
-rw-r--r--swarm/storage/feeds/topic.go (renamed from swarm/storage/mru/topic.go)2
-rw-r--r--swarm/storage/feeds/topic_test.go (renamed from swarm/storage/mru/topic_test.go)2
-rw-r--r--swarm/storage/feeds/update.go (renamed from swarm/storage/mru/update.go)2
-rw-r--r--swarm/storage/feeds/update_test.go (renamed from swarm/storage/mru/update_test.go)2
26 files changed, 51 insertions, 51 deletions
diff --git a/swarm/storage/mru/binaryserializer.go b/swarm/storage/feeds/binaryserializer.go
index 3123a82ee..ce146571b 100644
--- a/swarm/storage/mru/binaryserializer.go
+++ b/swarm/storage/feeds/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 mru
+package feeds
import "github.com/ethereum/go-ethereum/common/hexutil"
diff --git a/swarm/storage/mru/binaryserializer_test.go b/swarm/storage/feeds/binaryserializer_test.go
index f524157d6..0c81e7f18 100644
--- a/swarm/storage/mru/binaryserializer_test.go
+++ b/swarm/storage/feeds/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 mru
+package feeds
import (
"encoding/json"
diff --git a/swarm/storage/mru/cacheentry.go b/swarm/storage/feeds/cacheentry.go
index f6ed72818..7a2f87b56 100644
--- a/swarm/storage/mru/cacheentry.go
+++ b/swarm/storage/feeds/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 mru
+package feeds
import (
"bytes"
diff --git a/swarm/storage/mru/doc.go b/swarm/storage/feeds/doc.go
index 7ffd4a3c6..d1edf5d6d 100644
--- a/swarm/storage/mru/doc.go
+++ b/swarm/storage/feeds/doc.go
@@ -40,4 +40,4 @@ Request: Feed Update with signature
Epoch: time slot where the update is stored
*/
-package mru
+package feeds
diff --git a/swarm/storage/mru/error.go b/swarm/storage/feeds/error.go
index 452cc80f0..13266b900 100644
--- a/swarm/storage/mru/error.go
+++ b/swarm/storage/feeds/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 mru
+package feeds
import (
"fmt"
@@ -47,7 +47,7 @@ func (e *Error) Error() string {
}
// Code returns the error code
-// Error codes are enumerated in the error.go file within the mru package
+// Error codes are enumerated in the error.go file within the feeds package
func (e *Error) Code() int {
return e.code
}
diff --git a/swarm/storage/mru/view.go b/swarm/storage/feeds/feed.go
index 8d21ef7a4..8a807d506 100644
--- a/swarm/storage/mru/view.go
+++ b/swarm/storage/feeds/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 mru
+package feeds
import (
"hash"
@@ -37,9 +37,9 @@ type Feed struct {
const feedLength = TopicLength + common.AddressLength
// mapKey calculates a unique id for this feed. Used by the cache map in `Handler`
-func (u *Feed) mapKey() uint64 {
+func (f *Feed) mapKey() uint64 {
serializedData := make([]byte, feedLength)
- u.binaryPut(serializedData)
+ f.binaryPut(serializedData)
hasher := hashPool.Get().(hash.Hash)
defer hashPool.Put(hasher)
hasher.Reset()
@@ -49,54 +49,54 @@ func (u *Feed) mapKey() uint64 {
}
// binaryPut serializes this Feed instance into the provided slice
-func (u *Feed) binaryPut(serializedData []byte) error {
+func (f *Feed) binaryPut(serializedData []byte) error {
if len(serializedData) != feedLength {
return NewErrorf(ErrInvalidValue, "Incorrect slice size to serialize Feed. Expected %d, got %d", feedLength, len(serializedData))
}
var cursor int
- copy(serializedData[cursor:cursor+TopicLength], u.Topic[:TopicLength])
+ copy(serializedData[cursor:cursor+TopicLength], f.Topic[:TopicLength])
cursor += TopicLength
- copy(serializedData[cursor:cursor+common.AddressLength], u.User[:])
+ copy(serializedData[cursor:cursor+common.AddressLength], f.User[:])
cursor += common.AddressLength
return nil
}
// binaryLength returns the expected size of this structure when serialized
-func (u *Feed) binaryLength() int {
+func (f *Feed) binaryLength() int {
return feedLength
}
// binaryGet restores the current instance from the information contained in the passed slice
-func (u *Feed) binaryGet(serializedData []byte) error {
+func (f *Feed) binaryGet(serializedData []byte) error {
if len(serializedData) != feedLength {
return NewErrorf(ErrInvalidValue, "Incorrect slice size to read Feed. Expected %d, got %d", feedLength, len(serializedData))
}
var cursor int
- copy(u.Topic[:], serializedData[cursor:cursor+TopicLength])
+ copy(f.Topic[:], serializedData[cursor:cursor+TopicLength])
cursor += TopicLength
- copy(u.User[:], serializedData[cursor:cursor+common.AddressLength])
+ copy(f.User[:], serializedData[cursor:cursor+common.AddressLength])
cursor += common.AddressLength
return nil
}
// Hex serializes the Feed to a hex string
-func (u *Feed) Hex() string {
+func (f *Feed) Hex() string {
serializedData := make([]byte, feedLength)
- u.binaryPut(serializedData)
+ f.binaryPut(serializedData)
return hexutil.Encode(serializedData)
}
// FromValues deserializes this instance from a string key-value store
// useful to parse query strings
-func (u *Feed) FromValues(values Values) (err error) {
+func (f *Feed) FromValues(values Values) (err error) {
topic := values.Get("topic")
if topic != "" {
- if err := u.Topic.FromHex(values.Get("topic")); err != nil {
+ if err := f.Topic.FromHex(values.Get("topic")); err != nil {
return err
}
} else { // see if the user set name and relatedcontent
@@ -108,18 +108,18 @@ func (u *Feed) FromValues(values Values) (err error) {
}
relatedContent = relatedContent[:storage.AddressLength]
}
- u.Topic, err = NewTopic(name, relatedContent)
+ f.Topic, err = NewTopic(name, relatedContent)
if err != nil {
return err
}
}
- u.User = common.HexToAddress(values.Get("user"))
+ f.User = common.HexToAddress(values.Get("user"))
return nil
}
// AppendValues serializes this structure into the provided string key-value store
// useful to build query strings
-func (u *Feed) AppendValues(values Values) {
- values.Set("topic", u.Topic.Hex())
- values.Set("user", u.User.Hex())
+func (f *Feed) AppendValues(values Values) {
+ values.Set("topic", f.Topic.Hex())
+ values.Set("user", f.User.Hex())
}
diff --git a/swarm/storage/mru/view_test.go b/swarm/storage/feeds/feed_test.go
index e2f4d6b30..7806e0ad7 100644
--- a/swarm/storage/mru/view_test.go
+++ b/swarm/storage/feeds/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 mru
+package feeds
import (
"testing"
diff --git a/swarm/storage/mru/handler.go b/swarm/storage/feeds/handler.go
index cc0da7df9..9c69fd1b4 100644
--- a/swarm/storage/mru/handler.go
+++ b/swarm/storage/feeds/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 mru
+package feeds
import (
"bytes"
@@ -25,7 +25,7 @@ import (
"sync"
"time"
- "github.com/ethereum/go-ethereum/swarm/storage/mru/lookup"
+ "github.com/ethereum/go-ethereum/swarm/storage/feeds/lookup"
"github.com/ethereum/go-ethereum/swarm/log"
"github.com/ethereum/go-ethereum/swarm/storage"
diff --git a/swarm/storage/mru/handler_test.go b/swarm/storage/feeds/handler_test.go
index b66ff0c80..8331980ca 100644
--- a/swarm/storage/mru/handler_test.go
+++ b/swarm/storage/feeds/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 mru
+package feeds
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/mru/lookup"
+ "github.com/ethereum/go-ethereum/swarm/storage/feeds/lookup"
)
var (
diff --git a/swarm/storage/mru/id.go b/swarm/storage/feeds/id.go
index dcc88ac2a..dd813ae89 100644
--- a/swarm/storage/mru/id.go
+++ b/swarm/storage/feeds/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 mru
+package feeds
import (
"fmt"
@@ -22,7 +22,7 @@ import (
"strconv"
"github.com/ethereum/go-ethereum/common"
- "github.com/ethereum/go-ethereum/swarm/storage/mru/lookup"
+ "github.com/ethereum/go-ethereum/swarm/storage/feeds/lookup"
"github.com/ethereum/go-ethereum/swarm/storage"
)
diff --git a/swarm/storage/mru/id_test.go b/swarm/storage/feeds/id_test.go
index 767b3c159..2ef12e891 100644
--- a/swarm/storage/mru/id_test.go
+++ b/swarm/storage/feeds/id_test.go
@@ -1,9 +1,9 @@
-package mru
+package feeds
import (
"testing"
- "github.com/ethereum/go-ethereum/swarm/storage/mru/lookup"
+ "github.com/ethereum/go-ethereum/swarm/storage/feeds/lookup"
)
func getTestID() *ID {
diff --git a/swarm/storage/mru/lookup/epoch.go b/swarm/storage/feeds/lookup/epoch.go
index bafe95477..bafe95477 100644
--- a/swarm/storage/mru/lookup/epoch.go
+++ b/swarm/storage/feeds/lookup/epoch.go
diff --git a/swarm/storage/mru/lookup/epoch_test.go b/swarm/storage/feeds/lookup/epoch_test.go
index 62cf5523d..70bfd836a 100644
--- a/swarm/storage/mru/lookup/epoch_test.go
+++ b/swarm/storage/feeds/lookup/epoch_test.go
@@ -3,7 +3,7 @@ package lookup_test
import (
"testing"
- "github.com/ethereum/go-ethereum/swarm/storage/mru/lookup"
+ "github.com/ethereum/go-ethereum/swarm/storage/feeds/lookup"
)
func TestMarshallers(t *testing.T) {
diff --git a/swarm/storage/mru/lookup/lookup.go b/swarm/storage/feeds/lookup/lookup.go
index a5154d261..a5154d261 100644
--- a/swarm/storage/mru/lookup/lookup.go
+++ b/swarm/storage/feeds/lookup/lookup.go
diff --git a/swarm/storage/mru/lookup/lookup_test.go b/swarm/storage/feeds/lookup/lookup_test.go
index 34bcb61f0..7d5014608 100644
--- a/swarm/storage/mru/lookup/lookup_test.go
+++ b/swarm/storage/feeds/lookup/lookup_test.go
@@ -22,7 +22,7 @@ import (
"testing"
"github.com/ethereum/go-ethereum/swarm/log"
- "github.com/ethereum/go-ethereum/swarm/storage/mru/lookup"
+ "github.com/ethereum/go-ethereum/swarm/storage/feeds/lookup"
)
type Data struct {
diff --git a/swarm/storage/mru/query.go b/swarm/storage/feeds/query.go
index a0b358bfd..7bd2800a8 100644
--- a/swarm/storage/mru/query.go
+++ b/swarm/storage/feeds/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 mru
+package feeds
import (
"fmt"
"strconv"
"github.com/ethereum/go-ethereum/common"
- "github.com/ethereum/go-ethereum/swarm/storage/mru/lookup"
+ "github.com/ethereum/go-ethereum/swarm/storage/feeds/lookup"
)
// Query is used to specify constraints when performing an update lookup
diff --git a/swarm/storage/mru/query_test.go b/swarm/storage/feeds/query_test.go
index 4cfc597b2..1420c69ae 100644
--- a/swarm/storage/mru/query_test.go
+++ b/swarm/storage/feeds/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 mru
+package feeds
import (
"testing"
diff --git a/swarm/storage/mru/request.go b/swarm/storage/feeds/request.go
index ca88adda1..719d8fba8 100644
--- a/swarm/storage/mru/request.go
+++ b/swarm/storage/feeds/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 mru
+package feeds
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/mru/lookup"
+ "github.com/ethereum/go-ethereum/swarm/storage/feeds/lookup"
)
// Request represents a request to sign or signed Feed Update message
diff --git a/swarm/storage/mru/request_test.go b/swarm/storage/feeds/request_test.go
index 515de651c..2e3783834 100644
--- a/swarm/storage/mru/request_test.go
+++ b/swarm/storage/feeds/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 mru
+package feeds
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/mru/lookup"
+ "github.com/ethereum/go-ethereum/swarm/storage/feeds/lookup"
)
func areEqualJSON(s1, s2 string) (bool, error) {
diff --git a/swarm/storage/mru/sign.go b/swarm/storage/feeds/sign.go
index 03b0fa2b6..a69942f2b 100644
--- a/swarm/storage/mru/sign.go
+++ b/swarm/storage/feeds/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 mru
+package feeds
import (
"crypto/ecdsa"
diff --git a/swarm/storage/mru/testutil.go b/swarm/storage/feeds/testutil.go
index 80e0d4cf0..879f73348 100644
--- a/swarm/storage/mru/testutil.go
+++ b/swarm/storage/feeds/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 mru
+package feeds
import (
"context"
diff --git a/swarm/storage/mru/timestampprovider.go b/swarm/storage/feeds/timestampprovider.go
index 6ac153213..f6aa0775c 100644
--- a/swarm/storage/mru/timestampprovider.go
+++ b/swarm/storage/feeds/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 mru
+package feeds
import (
"encoding/binary"
@@ -22,7 +22,7 @@ import (
"time"
)
-// TimestampProvider sets the time source of the mru package
+// TimestampProvider sets the time source of the feeds package
var TimestampProvider timestampProvider = NewDefaultTimestampProvider()
// Timestamp encodes a point in time as a Unix epoch
diff --git a/swarm/storage/mru/topic.go b/swarm/storage/feeds/topic.go
index b6adb4cd7..2dc8c18cd 100644
--- a/swarm/storage/mru/topic.go
+++ b/swarm/storage/feeds/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 mru
+package feeds
import (
"bytes"
diff --git a/swarm/storage/mru/topic_test.go b/swarm/storage/feeds/topic_test.go
index dad7c7ddc..8994002d7 100644
--- a/swarm/storage/mru/topic_test.go
+++ b/swarm/storage/feeds/topic_test.go
@@ -1,4 +1,4 @@
-package mru
+package feeds
import (
"testing"
diff --git a/swarm/storage/mru/update.go b/swarm/storage/feeds/update.go
index f6e70b4d8..02bd37522 100644
--- a/swarm/storage/mru/update.go
+++ b/swarm/storage/feeds/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 mru
+package feeds
import (
"fmt"
diff --git a/swarm/storage/mru/update_test.go b/swarm/storage/feeds/update_test.go
index 62c401f3f..7763da0c8 100644
--- a/swarm/storage/mru/update_test.go
+++ b/swarm/storage/feeds/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 mru
+package feeds
import (
"testing"