diff options
author | Javier Peletier <jm@epiclabs.io> | 2018-09-29 07:00:28 +0800 |
---|---|---|
committer | Javier Peletier <jm@epiclabs.io> | 2018-10-03 15:12:06 +0800 |
commit | f1e86ad9cf0470051b7106ee83794d27276b528d (patch) | |
tree | 4a11bd2816200bac0a0e24a3b3c5c79db84e2bf4 /swarm/storage/mru/id.go | |
parent | bd1f7ebda27d57002b6a04a95812420a40117b3a (diff) | |
download | dexon-f1e86ad9cf0470051b7106ee83794d27276b528d.tar dexon-f1e86ad9cf0470051b7106ee83794d27276b528d.tar.gz dexon-f1e86ad9cf0470051b7106ee83794d27276b528d.tar.bz2 dexon-f1e86ad9cf0470051b7106ee83794d27276b528d.tar.lz dexon-f1e86ad9cf0470051b7106ee83794d27276b528d.tar.xz dexon-f1e86ad9cf0470051b7106ee83794d27276b528d.tar.zst dexon-f1e86ad9cf0470051b7106ee83794d27276b528d.zip |
swarm/storage/mru: Renamed all identifiers to Feeds
Diffstat (limited to 'swarm/storage/mru/id.go')
-rw-r--r-- | swarm/storage/mru/id.go | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/swarm/storage/mru/id.go b/swarm/storage/mru/id.go index f008169ed..09ef9e450 100644 --- a/swarm/storage/mru/id.go +++ b/swarm/storage/mru/id.go @@ -29,21 +29,21 @@ import ( // ID uniquely identifies an update on the network. type ID struct { - View `json:"view"` + Feed `json:"view"` lookup.Epoch `json:"epoch"` } // ID layout: -// View viewLength bytes +// Feed feedLength bytes // Epoch EpochLength -const idLength = viewLength + lookup.EpochLength +const idLength = feedLength + lookup.EpochLength // Addr calculates the resource update chunk address corresponding to this ID func (u *ID) Addr() (updateAddr storage.Address) { serializedData := make([]byte, idLength) var cursor int - u.View.binaryPut(serializedData[cursor : cursor+viewLength]) - cursor += viewLength + u.Feed.binaryPut(serializedData[cursor : cursor+feedLength]) + cursor += feedLength eid := u.Epoch.ID() copy(serializedData[cursor:cursor+lookup.EpochLength], eid[:]) @@ -61,10 +61,10 @@ func (u *ID) binaryPut(serializedData []byte) error { return NewErrorf(ErrInvalidValue, "Incorrect slice size to serialize ID. Expected %d, got %d", idLength, len(serializedData)) } var cursor int - if err := u.View.binaryPut(serializedData[cursor : cursor+viewLength]); err != nil { + if err := u.Feed.binaryPut(serializedData[cursor : cursor+feedLength]); err != nil { return err } - cursor += viewLength + cursor += feedLength epochBytes, err := u.Epoch.MarshalBinary() if err != nil { @@ -88,10 +88,10 @@ func (u *ID) binaryGet(serializedData []byte) error { } var cursor int - if err := u.View.binaryGet(serializedData[cursor : cursor+viewLength]); err != nil { + if err := u.Feed.binaryGet(serializedData[cursor : cursor+feedLength]); err != nil { return err } - cursor += viewLength + cursor += feedLength if err := u.Epoch.UnmarshalBinary(serializedData[cursor : cursor+lookup.EpochLength]); err != nil { return err @@ -108,8 +108,8 @@ func (u *ID) FromValues(values Values) error { u.Epoch.Level = uint8(level) u.Epoch.Time, _ = strconv.ParseUint(values.Get("time"), 10, 64) - if u.View.User == (common.Address{}) { - return u.View.FromValues(values) + if u.Feed.User == (common.Address{}) { + return u.Feed.FromValues(values) } return nil } @@ -119,5 +119,5 @@ func (u *ID) FromValues(values Values) error { func (u *ID) AppendValues(values Values) { values.Set("level", fmt.Sprintf("%d", u.Epoch.Level)) values.Set("time", fmt.Sprintf("%d", u.Epoch.Time)) - u.View.AppendValues(values) + u.Feed.AppendValues(values) } |