aboutsummaryrefslogtreecommitdiffstats
path: root/swarm/storage
diff options
context:
space:
mode:
authorJavier Peletier <jm@epiclabs.io>2018-10-02 15:32:46 +0800
committerJavier Peletier <jm@epiclabs.io>2018-10-03 15:12:06 +0800
commit58c0879c2fbc9f88f35ba503674088da23a8a5a7 (patch)
tree64214db5b7e47a4b4677a4a487bdc9c83a063202 /swarm/storage
parent68b8088cb9730bfe0ee2395dd5506dc744076fc2 (diff)
downloaddexon-58c0879c2fbc9f88f35ba503674088da23a8a5a7.tar
dexon-58c0879c2fbc9f88f35ba503674088da23a8a5a7.tar.gz
dexon-58c0879c2fbc9f88f35ba503674088da23a8a5a7.tar.bz2
dexon-58c0879c2fbc9f88f35ba503674088da23a8a5a7.tar.lz
dexon-58c0879c2fbc9f88f35ba503674088da23a8a5a7.tar.xz
dexon-58c0879c2fbc9f88f35ba503674088da23a8a5a7.tar.zst
dexon-58c0879c2fbc9f88f35ba503674088da23a8a5a7.zip
swarm/storage/feeds: removed capital Feed throughout
Diffstat (limited to 'swarm/storage')
-rw-r--r--swarm/storage/feeds/cacheentry.go4
-rw-r--r--swarm/storage/feeds/error.go4
-rw-r--r--swarm/storage/feeds/feed.go10
-rw-r--r--swarm/storage/feeds/handler.go12
-rw-r--r--swarm/storage/feeds/handler_test.go14
-rw-r--r--swarm/storage/feeds/lookup/lookup.go2
-rw-r--r--swarm/storage/feeds/request.go2
-rw-r--r--swarm/storage/feeds/request_test.go8
-rw-r--r--swarm/storage/feeds/sign.go4
-rw-r--r--swarm/storage/localstore_test.go2
10 files changed, 31 insertions, 31 deletions
diff --git a/swarm/storage/feeds/cacheentry.go b/swarm/storage/feeds/cacheentry.go
index 7a2f87b56..e40037688 100644
--- a/swarm/storage/feeds/cacheentry.go
+++ b/swarm/storage/feeds/cacheentry.go
@@ -30,7 +30,7 @@ const (
defaultRetrieveTimeout = 100 * time.Millisecond
)
-// cacheEntry caches the last known update of a specific Feed.
+// cacheEntry caches the last known update of a specific Swarm feed.
type cacheEntry struct {
Update
*bytes.Reader
@@ -42,7 +42,7 @@ func (r *cacheEntry) Size(ctx context.Context, _ chan bool) (int64, error) {
return int64(len(r.Update.data)), nil
}
-//returns the Feed's topic
+//returns the feed's topic
func (r *cacheEntry) Topic() Topic {
return r.Feed.Topic
}
diff --git a/swarm/storage/feeds/error.go b/swarm/storage/feeds/error.go
index 13266b900..7751a9f19 100644
--- a/swarm/storage/feeds/error.go
+++ b/swarm/storage/feeds/error.go
@@ -35,7 +35,7 @@ const (
ErrCnt
)
-// Error is a the typed error object used for Swarm Feeds
+// Error is a the typed error object used for Swarm feeds
type Error struct {
code int
err string
@@ -52,7 +52,7 @@ func (e *Error) Code() int {
return e.code
}
-// NewError creates a new Swarm Feeds Error object with the specified code and custom error message
+// NewError creates a new Swarm feeds Error object with the specified code and custom error message
func NewError(code int, s string) error {
if code < 0 || code >= ErrCnt {
panic("no such error code!")
diff --git a/swarm/storage/feeds/feed.go b/swarm/storage/feeds/feed.go
index 8a807d506..d5b262555 100644
--- a/swarm/storage/feeds/feed.go
+++ b/swarm/storage/feeds/feed.go
@@ -25,7 +25,7 @@ import (
"github.com/ethereum/go-ethereum/swarm/storage"
)
-// Feed represents a particular user's stream of updates on a Topic
+// Feed represents a particular user's stream of updates on a topic
type Feed struct {
Topic Topic `json:"topic"`
User common.Address `json:"user"`
@@ -48,10 +48,10 @@ func (f *Feed) mapKey() uint64 {
return *(*uint64)(unsafe.Pointer(&hash[0]))
}
-// binaryPut serializes this Feed instance into the provided slice
+// binaryPut serializes this feed instance into the provided slice
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))
+ return NewErrorf(ErrInvalidValue, "Incorrect slice size to serialize feed. Expected %d, got %d", feedLength, len(serializedData))
}
var cursor int
copy(serializedData[cursor:cursor+TopicLength], f.Topic[:TopicLength])
@@ -71,7 +71,7 @@ func (f *Feed) binaryLength() int {
// binaryGet restores the current instance from the information contained in the passed slice
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))
+ return NewErrorf(ErrInvalidValue, "Incorrect slice size to read feed. Expected %d, got %d", feedLength, len(serializedData))
}
var cursor int
@@ -84,7 +84,7 @@ func (f *Feed) binaryGet(serializedData []byte) error {
return nil
}
-// Hex serializes the Feed to a hex string
+// Hex serializes the feed to a hex string
func (f *Feed) Hex() string {
serializedData := make([]byte, feedLength)
f.binaryPut(serializedData)
diff --git a/swarm/storage/feeds/handler.go b/swarm/storage/feeds/handler.go
index 9c69fd1b4..2c5261614 100644
--- a/swarm/storage/feeds/handler.go
+++ b/swarm/storage/feeds/handler.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/>.
-// Handler is the API for Feeds
+// Handler is the API for feeds
// It enables creating, updating, syncing and retrieving feed updates and their data
package feeds
@@ -57,7 +57,7 @@ func init() {
}
}
-// NewHandler creates a new Swarm Feeds API
+// NewHandler creates a new Swarm feeds API
func NewHandler(params *HandlerParams) *Handler {
fh := &Handler{
cache: make(map[uint64]*cacheEntry),
@@ -74,7 +74,7 @@ func NewHandler(params *HandlerParams) *Handler {
return fh
}
-// SetStore sets the store backend for the Swarm Feeds API
+// SetStore sets the store backend for the Swarm feeds API
func (h *Handler) SetStore(store *storage.NetStore) {
h.chunkStore = store
}
@@ -110,7 +110,7 @@ func (h *Handler) Validate(chunkAddr storage.Address, data []byte) bool {
return true
}
-// GetContent retrieves the data payload of the last synced update of the Feed
+// GetContent retrieves the data payload of the last synced update of the feed
func (h *Handler) GetContent(feed *Feed) (storage.Address, []byte, error) {
if feed == nil {
return nil, nil, NewError(ErrInvalidValue, "feed is nil")
@@ -240,7 +240,7 @@ func (h *Handler) updateCache(request *Request) (*cacheEntry, error) {
}
// Update publishes a feed update
-// Note that a Feed update cannot span chunks, and thus has a MAX NET LENGTH 4096, INCLUDING update header data and signature.
+// Note that a feed update cannot span chunks, and thus has a MAX NET LENGTH 4096, INCLUDING update header data and signature.
// This results in a max payload of `maxUpdateDataLength` (check update.go for more details)
// An error will be returned if the total length of the chunk payload will exceed this limit.
// Update can only check if the caller is trying to overwrite the very last known version, otherwise it just puts the update
@@ -286,7 +286,7 @@ func (h *Handler) get(feed *Feed) *cacheEntry {
return feedUpdate
}
-// Sets the feed update cache value for the given Feed
+// Sets the feed update cache value for the given feed
func (h *Handler) set(feed *Feed, feedUpdate *cacheEntry) {
mapKey := feed.mapKey()
h.cacheLock.Lock()
diff --git a/swarm/storage/feeds/handler_test.go b/swarm/storage/feeds/handler_test.go
index 8331980ca..967bc6d4b 100644
--- a/swarm/storage/feeds/handler_test.go
+++ b/swarm/storage/feeds/handler_test.go
@@ -89,11 +89,11 @@ func TestFeedsHandler(t *testing.T) {
}
defer teardownTest()
- // create a new Feed
+ // create a new feed
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
- topic, _ := NewTopic("Mess with Swarm Feeds code and see what ghost catches you", nil)
+ topic, _ := NewTopic("Mess with Swarm feeds code and see what ghost catches you", nil)
feed := Feed{
Topic: topic,
User: signer.Address(),
@@ -266,7 +266,7 @@ func TestSparseUpdates(t *testing.T) {
defer teardownTest()
defer os.RemoveAll(datadir)
- // create a new Feed
+ // create a new feed
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
topic, _ := NewTopic("Very slow updates", nil)
@@ -348,7 +348,7 @@ func TestValidator(t *testing.T) {
}
defer teardownTest()
- // create new Feed
+ // create new feed
topic, _ := NewTopic(subtopicName, nil)
feed := Feed{
Topic: topic,
@@ -382,7 +382,7 @@ func TestValidator(t *testing.T) {
}
// tests that the content address validator correctly checks the data
-// tests that Feed update chunks are passed through content address validator
+// tests that feed update chunks are passed through content address validator
// there is some redundancy in this test as it also tests content addressed chunks,
// which should be evaluated as invalid chunks by this validator
func TestValidatorInStore(t *testing.T) {
@@ -409,7 +409,7 @@ func TestValidatorInStore(t *testing.T) {
t.Fatal(err)
}
- // set up Swarm Feeds handler and add is as a validator to the localstore
+ // set up Swarm feeds handler and add is as a validator to the localstore
fhParams := &HandlerParams{}
fh := NewHandler(fhParams)
store.Validators = append(store.Validators, fh)
@@ -463,7 +463,7 @@ func TestValidatorInStore(t *testing.T) {
}
}
-// create rpc and Feeds Handler
+// create rpc and feeds Handler
func setupTest(timeProvider timestampProvider, signer Signer) (fh *TestHandler, datadir string, teardown func(), err error) {
var fsClean func()
diff --git a/swarm/storage/feeds/lookup/lookup.go b/swarm/storage/feeds/lookup/lookup.go
index a5154d261..2f862d81c 100644
--- a/swarm/storage/feeds/lookup/lookup.go
+++ b/swarm/storage/feeds/lookup/lookup.go
@@ -15,7 +15,7 @@
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
/*
-Package lookup defines Feed lookup algorithms and provides tools to place updates
+Package lookup defines feed lookup algorithms and provides tools to place updates
so they can be found
*/
package lookup
diff --git a/swarm/storage/feeds/request.go b/swarm/storage/feeds/request.go
index 719d8fba8..81e1b10fe 100644
--- a/swarm/storage/feeds/request.go
+++ b/swarm/storage/feeds/request.go
@@ -27,7 +27,7 @@ import (
"github.com/ethereum/go-ethereum/swarm/storage/feeds/lookup"
)
-// Request represents a request to sign or signed Feed Update message
+// Request represents a request to sign or signed feed update message
type Request struct {
Update // actual content that will be put on the chunk, less signature
Signature *Signature
diff --git a/swarm/storage/feeds/request_test.go b/swarm/storage/feeds/request_test.go
index 2e3783834..a9a4d1505 100644
--- a/swarm/storage/feeds/request_test.go
+++ b/swarm/storage/feeds/request_test.go
@@ -47,7 +47,7 @@ func areEqualJSON(s1, s2 string) (bool, error) {
}
// TestEncodingDecodingUpdateRequests ensures that requests are serialized properly
-// while also checking cryptographically that only the owner of a Feed can update it.
+// while also checking cryptographically that only the owner of a feed can update it.
func TestEncodingDecodingUpdateRequests(t *testing.T) {
charlie := newCharlieSigner() //Charlie
@@ -136,7 +136,7 @@ func TestEncodingDecodingUpdateRequests(t *testing.T) {
t.Fatal("Expected DecodeUpdateRequest to fail when trying to interpret a corrupt message with an invalid signature")
}
- // Now imagine Bob wants to create an update of his own about the same Feed,
+ // Now imagine Bob wants to create an update of his own about the same feed,
// signing a message with his private key
if err := request.Sign(bob); err != nil {
t.Fatalf("Error signing: %s", err)
@@ -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 Request update to equal the original one")
+ t.Fatal("Expected recovered feed update request 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 Feeds handler
+ // set up rpc and create feeds handler
_, _, teardownTest, err := setupTest(timeProvider, signer)
if err != nil {
t.Fatal(err)
diff --git a/swarm/storage/feeds/sign.go b/swarm/storage/feeds/sign.go
index a69942f2b..f5760c8f2 100644
--- a/swarm/storage/feeds/sign.go
+++ b/swarm/storage/feeds/sign.go
@@ -28,7 +28,7 @@ const signatureLength = 65
// Signature is an alias for a static byte array with the size of a signature
type Signature [signatureLength]byte
-// Signer signs Feed update payloads
+// Signer signs feed update payloads
type Signer interface {
Sign(common.Hash) (Signature, error)
Address() common.Address
@@ -65,7 +65,7 @@ func (s *GenericSigner) Address() common.Address {
return s.address
}
-// getUserAddr extracts the address of the Feed update signer
+// getUserAddr extracts the address of the feed update signer
func getUserAddr(digest common.Hash, signature Signature) (common.Address, error) {
pub, err := crypto.SigToPub(digest.Bytes(), signature[:])
if err != nil {
diff --git a/swarm/storage/localstore_test.go b/swarm/storage/localstore_test.go
index b8eea4350..10f43f30f 100644
--- a/swarm/storage/localstore_test.go
+++ b/swarm/storage/localstore_test.go
@@ -30,7 +30,7 @@ var (
)
// tests that the content address validator correctly checks the data
-// tests that Feed update chunks are passed through content address validator
+// 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