Refactor the io plugin

Change-Id: Id13a4251bdd942e98b08819b19bebfb5311a28cc
Reviewed-on: http://review.couchbase.org/25517
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>