Commit Graph
23 Commits
Author SHA1 Message Date
David Renshaw 4a07828095 Fix typo and awkward sentences. 2016-10-23 11:14:52 +08:00
Alex Crichton b84ef90a98 Move Framed from tokio-proto to core
This commit extracts the concrete implementation of `FrameIo` in tokio-proto to
tokio-core under the name `EasyFramed`. This extraction is accompanied with a
new `EasyBuf` buffer type to work with when parsing types.

The purpose of this movement is to provide a clear and easy entry point at the
`FramedIo` layer for those who need it. Eventually these buffer types will get
replaced or moved to the `bytes` crate, but in the interest of an 0.1 release
and remaining backwards compatible with the tokio-core 0.1 release this is
adding a separate module.
2016-10-21 11:46:32 -07:00
Alex Crichton 1f0d2198ad Use a timer heap instead of a timer wheel
In general it's easier to implement and should have more predictable performance
semantics for applications in general. More serious timer usage can go through
`tokio-timer` which has properly configurable timer wheels and such.

Closes #2
Closes #7
2016-09-08 00:06:34 -07:00
Alex Crichton 66cff8e84b Swap Handle/Pinned
* Handle -> Remote
* Pinned -> Handle

All APIs now take a `&Handle` by default and in general can return an immediate
`io::Result` instead of an `IoFuture`. This reflects how most usage will likely
be done through handles rather than remotes, and also all previous functionality
can be recovered with a `oneshot` plus `Remote::spawn`.

Closes #15
2016-09-07 22:12:41 -07:00
Alex Crichton e60002b653 Tweak TaskIo wording and such
* Remove TaskIo
* task_split -> split
* TaskIoRead -> ReadHalf
* TaskIoWrite -> WriteHalf

Closes #18
2016-09-07 22:12:14 -07:00
Alex Crichton 6c045d31ac Reorganize the entire crate:
Renamed APIs

* Loop => reactor::Core
* LoopHandle => reactor::Handle
* LoopPin => reactor::Pinned
* TcpStream => net::TcpStream
* TcpListener => net::TcpListener
* UdpSocket => net::UdpSocket
* Sender => channel::Sender
* Receiver => channel::Receiver
* Timeout => reactor::Timeout
* ReadinessStream => reactor::PollEvented
* All `LoopHandle` methods to construct objects are now free functions on the
  associated types, e.g. `LoopHandle::tcp_listen` is now `TcpListener::bind`
* All APIs taking a `Handle` now take a `Handle` as the last argument
* All future-returning APIs now return concrete types instead of trait objects

Added APIs

* io::Io trait -- Read + Write + ability to poll

Removed without replacement:

* AddSource
* AddTimeout
* IoToken
* TimeoutToken

Closes #3
Closes #6
2016-09-07 22:12:14 -07:00
Alex Crichton 3794cf7f1d Update with Poll/Async changes 2016-09-02 12:17:38 -07:00
Alex Crichton 330ab823b0 Update to futures master
* Remove `LoopData` as it's no longer necessary
* Add `LoopHandle::spawn` to spawn new futures onto an event loop
* Add `LoopData::spawn` to also spawn new futures onto an event loop
* Rejigger the implementation of the event loop a bit (make a slab of futures),
  but otherwise everything else is pretty constant.
2016-08-31 19:00:42 -07:00
Alex Crichton c820d67d66 Update to mio master 2016-08-27 12:33:31 -07:00
Alex Crichton f107c8d860 Rename to tokio-core, add in futures-io
Renames the futures-mio crate to tokio-core, pulls in the futures-io crate under
an `io` module, and gets everything compiling.
2016-08-26 14:39:47 -07:00
Alex Crichton df9730fcbe Add a channel to the futures-mio crate 2016-08-20 23:41:19 -07:00
Alex Crichton 2bd616df51 Reorganize the event_loop module
Split it up into a number of targeted modules for each purpose, for example loop
data, I/O sources, timeouts, and channels. No actual change is intended to be
part of this commit.
2016-08-20 23:24:56 -07:00
Alex Crichton b9dae23e3f Don't store an Arc in ReadinessStream
This commit contains a few refactorings, but the major goal is to remove the
`Arc` that's stored inside of each `ReadinessStream` and `Scheduled` slot in the
event loop. The original purpose of this `Arc` was to share the I/O object among
the concrete handle itself and the event loop. The event loop would then change
how the socket is registered over time and then deregister it when it gets a
"shutdown request".

Nowadays, however, once an I/O object is registered with the event loop it's
never updated. Additionally, we don't actually need to call `deregister` but can
rather just instead close the I/O object itself and let the kernel/event loop
take care of the cleanup. All we need to do on deregistering is free up the slab
entry.

The major result of this commit is that I/O objects no longer need to be `Sync`
(as they're not stored in an `Arc`). Instead they just need to be `Send +
'static` as one might otherwise expect.

Along the way this also refactors a few pieces here and there to make more sense
in this new scheme. The `ReadinessStream` type now has a type parameter
indicating an owned reference to the I/O object it wraps. This can be accessed
via the `get_ref` and `get_mut` methods. Additionally I/O tokens on the event
loop are now a full-fledged `IoToken` type which we can change in the future if
we need to.
2016-08-20 23:07:00 -07:00
Alex Crichton 9911f421eb Add LoopPin to easily create LoopData 2016-08-12 13:42:24 -07:00
Alex Crichton 517d5c7434 Add libcurl bindings 2016-08-09 23:51:14 -07:00
Alex Crichton 304914b707 Start brushing up io/mio docs 2016-08-05 09:53:50 -07:00
Alex Crichton 8eb1f681af Don't export the timer_wheel module
Move tests into that module
2016-08-05 09:44:00 -07:00
Alex Crichton e7f4313cf4 Implementing LoopData
This type acts for a handle to storage of non-`Send` data. The handle itself is
sendable across threads and is therefore suitable for storage in a `Future`.
This data uses communication internally and a new method on `Task` to ensure
that when the data needs to be accessed the future will find its way to the
right thread.

More on this type coming soon!
2016-08-04 20:34:54 -07:00
Alex Crichton 5c9daad88b Add a timer wheel 2016-08-03 22:57:07 -07:00
Alex Crichton 260255e674 Add UDP sockets 2016-08-02 22:49:58 -07:00
Alex Crichton 5970203b21 Finish docs on futures-mio
Also remove mio BufReader/BufWriter for now, they should come back shortly
though
2016-08-01 17:41:58 -07:00
Alex Crichton 7ffe72dc73 Add docs to futures-io crate 2016-08-01 17:30:56 -07:00
Alex Crichton bc64194be1 Let's rename everything! 2016-07-30 22:50:58 -07:00