-
Notifications
You must be signed in to change notification settings - Fork 110
network/newstream: new stream! protocol base implementation #1500
Conversation
f43129d
to
6815d14
Compare
add handlers.go file, syncer stream maintainance logic copy subscription diff functionality from old syncer network/syncer: add stream req handler network/syncer: add StreamInfoReq handler network/syncer: create initial StreamInfo message exchange remove peer
… (in a bigger star topology) simulation/bucket: remove ok param from function and panic instead network/syncer: renamed file
// You should have received a copy of the GNU Lesser General Public License | ||
// along with the Swarm library. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
package newstream |
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.
The package is called newstream
. Probably we should not be prefixing most of the structs in this package with Stream
.
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.
i'm not sure i understand. existing stream directory will be removed. the package is not the same package. do you want the types to be prefixed with NewStream
?
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.
when your package is called stream
or newstream
, the types inside already have the context of the word / concept Stream
, so no need to generally prefix them. For example newstream.StreamProvider
-> newstream.Provider
.
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.
fair enough 👍 I'll take care of it in the following iteration
} | ||
return p | ||
} | ||
func (p *Peer) Left() { |
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.
This is used at one place. Why not directly inline close(p.quit)
there?
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.
👍
network/newstream/stream.go
Outdated
var _ node.Service = (*SlipStream)(nil) | ||
var ( | ||
pollTime = 1 * time.Second | ||
createStreamsDelay = 50 * time.Millisecond //to avoid a race condition where we send a message to a server that hasnt set up yet |
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.
Is createStreamsDelay
really necessary? Can you give a concrete example of what you mean with we send a message to a server that hasnt set up yet
?
@@ -0,0 +1,64 @@ | |||
// Copyright 2019 The Swarm Authors |
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.
Why do we need a separate common_test
file?
s.kad.On(np) | ||
defer s.kad.Off(np) | ||
|
||
sp := NewPeer(bp, s.intervalsStore, s.providers) |
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.
I think if sp
contained all the handlers, and not peer
, we wouldn't have to have such a weird structure where Peer
is instantiated with pointers to providers and intervalsStore. A Peer
should contain only what is relevant to a peer.
* master: network/newstream: new stream! protocol base implementation (#1500) swarm: fix bzz_info.port when using dynamic port allocation (#1537) cmd/swarm: make bzzaccount flag optional and add bzzkeyhex flag (#1531) cmd/swarm: remove separate function to parse env vars (#1536) network/bitvector: Multibit set/unset + string rep (#1530) swarm: 0.4.3 unstable (#1526) travis: also build on release tags (#1527) swarm: release v0.4.2 (#1496) network: bump bzz stream hive (#1522) docker: update ca-certificates file (#1525) Add swarm guide to /docs (#1513) network/simulation: Add ExecAdapter capability to swarm simulations (#1503)
* 'master' of github.com:ethersphere/swarm: (54 commits) api, chunk, cmd, shed, storage: add support for pinning content (ethersphere#1509) docs/swarm-guide: cleanup (ethersphere#1620) travis: split jobs into different stages (ethersphere#1615) simulation: retry if we hit a collision on tcp/udp ports (ethersphere#1616) api, chunk: rename Tag.New to Tag.Create (ethersphere#1614) pss: instrumentation and refactor (ethersphere#1580) api, cmd, network: add --disable-auto-connect flag (ethersphere#1576) changelog: fix typo (ethersphere#1605) version: update to v0.4.4 unstable (ethersphere#1603) swarm: release v0.4.3 (ethersphere#1602) network/retrieve: add bzz-retrieve protocol (ethersphere#1589) PoC: Network simulation framework (ethersphere#1555) network: structured output for kademlia table (ethersphere#1586) client: add bzz client, update smoke tests (ethersphere#1582) swarm-smoke: fix check max prox hosts for pull/push sync modes (ethersphere#1578) cmd/swarm: allow using a network interface by name for nat purposes (ethersphere#1557) pss: disable TestForwardBasic (ethersphere#1544) api, network: count chunk deliveries per peer (ethersphere#1534) network/newstream: new stream! protocol base implementation (ethersphere#1500) swarm: fix bzz_info.port when using dynamic port allocation (ethersphere#1537) ...
This PR has originally set out to rewrite our existing pull syncer through a process of generalising and reiterating on the
stream!
protocol.There has been a lot of work and examination of possible changes prior to the work done here. A lot of which has culminated into a preliminary spec with #1454.
This PR merges necessary changes to the wire protocol that were identified and deemed necessary while reimplementing the
stream!
protocol, as well as basicPeer
data structure that will be needed to be used when incrementally introducing the protocol implementation, as well as the stream provider implementations (right now onlysync
stream).The actual implementations have been removed from this PR and will be introduced in subsequent PRs to ease the diff and for the sake of clarity.
The files have been placed into
network/newstream
and the package namednewstream
, all until we can get rid of existingstream
implementation and move in the new implementation into place.related to:
#1451
ethersphere/user-stories#51