| 104 | |
| 105 | === 2. Asynchronous file i/o backend for Linux, FreeBSD, Mac OS X or WinRT === |
| 106 | Potential mentors: Niall Douglas |
| 107 | |
| 108 | ==== Background ==== |
| 109 | A library called Boost.AFIO implementing portable asynchronous file i/o was ported to Boost during GSoC 2013 ([https://boostgsoc13.github.io/boost.afio/ documentation], [https://github.com/BoostGSoC13/boost.afio github]). It provides a fully asynchronous backend for the NT kernel directly using the NT kernel API, plus a generic POSIX backend which generates concurrency in the filing system using a thread pool of workers. It does not yet provide native asynchronous backends for Linux (KAIO), FreeBSD (POSIX AIO + kqueues), Mac OS X (unsure if this is technically feasible) nor WinRT. |
| 110 | |
| 111 | ==== GSoC project proposal ==== |
| 112 | 1. For a Linux backend: To draw up a design document describing how the afio::async_file_io_dispatcher_base interface should be implemented using a Linux KAIO API. [https://raw.githubusercontent.com/BoostGSoC13/boost.afio/master/reference/Linux%20KAIO/linux-kaio.txt You can find more information about the Linux KAIO API here]. Note that the Linux KAIO API is only partially asynchronous, and therefore will need to still be combined with a thread pool - therefore some elements of afio::async_file_io_dispatcher_compat ought to be reused, perhaps even subclassed. |
| 113 | |
| 114 | For a FreeBSD backend: To draw up a design document describing how the afio::async_file_io_dispatcher_base interface should be implemented using a combination of the [https://www.freebsd.org/cgi/man.cgi?query=lio_listio&sektion=2&apropos=0&manpath=FreeBSD+10.1-RELEASE POSIX AIO API] and the [https://www.freebsd.org/cgi/man.cgi?query=kqueue kqueue EVFILT_AIO] event watcher via which completions of asynchronous file operations are notified back to AFIO. As the POSIX AIO API only covers reading and writing, it will almost certainly subclass afio::async_file_io_dispatcher_compat. |
| 115 | |
| 116 | For a Mac OS X backend: OS X lacks the kqueue EVFILT_AIO interface, and therefore requires POSIX AIO clients to be notified of completions via signals. This probably makes a native backend for OS X technically infeasible, but feel free to submit a proposal proving me wrong! |
| 117 | |
| 118 | For a WinRT backend: To draw up a design document describing how the afio::async_file_io_dispatcher_base interface should be implemented using the WinRT API. WinRT provides a rich suite of fully asynchronous file i/o APIs ([https://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.storage.fileio.aspx see Windows.Storage]), and when combined with [http://blogs.msdn.com/b/vcblog/archive/2014/11/12/resumable-functions-in-c.aspx the experimental C++ 17 resumable functions support in Visual Studio 2015] it should make the implementation of this backend quite straightforward. |
| 119 | |
| 120 | 2. To implement one of the above designs. |
| 121 | |
| 122 | 3. To write unit, functional and performance regression testing for all of the above, including exception safety testing and multi threaded testing, to a 100% code coverage level (excluding fatal abort handling code). |
| 123 | |
| 124 | 4. To write documentation to Boost quality levels for the new backend, including benchmarking the new backend against the compatibility backend under cold, warm and semi-warm file cache conditions on magnetic and solid state storage devices. |
| 125 | |
| 126 | ==== Potential project extension funded by Boost ==== |
| 127 | 1. Fast, scalable portable directory contents change monitoring. |
| 128 | |
| 129 | 2. Extended attributes support. |
| 130 | |
| 131 | 3. ACL support. |
| 132 | |
| 133 | 4. A Filesystem TS and iostreams wrapper for AFIO. |
| 134 | |
| 135 | ==== Programming competency test ==== |
| 136 | Using [http://www.boost.org/doc/libs/1_57_0/doc/html/boost_asio.html Boost.ASIO] (not AFIO!), write a program which registers a Linux KAIO, FreeBSD POSIX AIO + kqueues or WinRT asynchronous file i/o operation with ASIO (either a file read or a file write). ASIO should invoke a handler which prints to stdout "Hello file i/o completion" when the asynchronous file i/o operation completes. |
| 137 | |
| 138 | |