-
Notifications
You must be signed in to change notification settings - Fork 110
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where exactly will these be used?
I dont mind it here at all, but have you considered the chunk package where Proximity is?
First thought was the prox test for pss. Since chunk and pss do not explicitly share ancestry. In my view this has more to do with network and routing than the chunk per se. Thus I considered |
@nolash I had a look at this and would like to share my 2 cents as I was thinking about implementing this at the time. I think it would be nice to have distance as a type, returned alongside with the
On top of
and so forth... In regards to representing distance with Also, looking at the code shows that you're not using any of the native comparators of the actual underlying type but you just iterate over the byte slice and do manual comparison, so maybe just stick to the byte slice representation? WDYT? |
Well with an XOR of two byte vectors of same length you can't really have overflows?
Would that be a concrete type, sir? ;)
Are you sure we'd want to perform the calculation every time? |
if by "calculation" you mean "XORing" the two addresses, then yes, and that should not be a burden because we are doing so anyway in the proximity function. The only difference would be that the Proximity function won't stop XORing when the first different bit is occured, but will continue till the end of the address length in order to get the full XOR distance to return.
Not sure if I get it... |
Had a call with @acud today and we agreed a good approach is to keep distance in the pot package, and in followup PR re-use (and if necessary adapt) proximity code in pot instead of proximity function in chunk. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove on commented line
network/discovery.go
Outdated
@@ -89,7 +89,8 @@ func NotifyPeer(p *BzzAddr, k *Kademlia) { | |||
// unless already notified during the connection session | |||
func (d *Peer) NotifyPeer(a *BzzAddr, po uint8) { | |||
// immediately return | |||
if (po < d.getDepth() && pot.ProxCmp(d.kad.BaseAddr(), d, a) != 1) || d.seen(a) { | |||
//if (po < d.getDepth() && pot.ProxCmp(d.kad.BaseAddr(), d, a) != 1) || d.seen(a) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove line?
* 'master' of github.com:ethersphere/swarm: chunk, storage: chunk.Store multiple chunk Put (ethersphere#1681) storage: fix pyramid chunker and hasherstore possible deadlocks (ethersphere#1679) pss: Use distance to determine single guaranteed recipient (ethersphere#1672) storage: fix possible hasherstore deadlock on waitC channel (ethersphere#1674) network: Add adaptive capabilities message (ethersphere#1619) p2p/protocols, p2p/testing; conditional propagation of context (ethersphere#1648) api/http: remove unnecessary conversion (ethersphere#1673) storage: fix LazyChunkReader.join potential deadlock (ethersphere#1670) HTTP API support for pinning contents (ethersphere#1658) pot: Add Distance methods with tests (ethersphere#1621) README.md: Update Vendored Dependencies section (ethersphere#1667) network, p2p, vendor: move vendored p2p/testing under swarm (ethersphere#1647) build, vendor: use go modules for vendoring (ethersphere#1532)
Adds methods for calculating distance metric value, as well as comparison.
Comparison of XOR distance requires the addresses to be compared to be the same length.
The change to
proxCmp
is merely a slight bumming.