Trying to model hypercore-protocol in Rust, and wow yeah okay this is pushing the boundaries a bit of what established Rust stream patterns can provide. Currently using the codec pattern + modelling it after crossbeam channels, but it's not *quite* righthttps://github.com/mafintosh/hypercore-protocol …
Where "single connection" == AsyncRead + AsyncWrite. Using Hyperswarm this could be backed by a plethora of connection methods, but the interface should remain consistent.
-
-
It doesn't even quite compare to some other multiplexed protocols such as h2, because there isn't a clear distinction between client & server — each instance is both. I'm now wondering if we need a 3-layer hierarchy for this
Show this thread -
Top-level: create a protocol instance that streams bytes in and out. Mid-level: each proto instance can create a channel. Each channel can be split into (n) senders + 1 receiver. Low-level: each receiver emits a stream of events.
Show this thread -
I think actually what we need is a closure in the Protocol constructor to construct new channels from! let proto = Protocol::new(|p| http://p.channel (key)); let (r, w) = proto.split(); // now pipe these parts to the network
Show this thread -
New conversation -
-
-
unsure if this helps you but note that it is designed in a way where the "stream in a stream" does *not* need any backpressure mechanics - the top level protocol handles all of that
-
Sort of! My main trouble was figuring out how to make the borrow checker behave, but I think I have a design that can work now!
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.