[RFC] Extract libuv reading boilerplate into rstream.c module

While implementing reading code for the msgpack API(the tcp/pipe server) I noticed it uses the same libuv reading boilerplate used in job.c and input.c. This PR will extract that into a module that will be reused by every other module that needs to read from a stream. It is mostly adapted from input.c