As we move closer to things like async/await and more flexible usage of the tokio runtime. We should provide our own wrappers so that we can easily change out the runtime type in the future. This would mean removing all occurrences of tokio::runtime::Runtime and providing our own spawn function. This should be fairly trivial but would go a long way to improving the experience working with the actual runtime within the codebase. This would also allow us to try other runtimes to see how they impact performance. One example of this is to try out the tokio-io-pool which does less work-stealing and thus might give us better results.
runtime.rs that contains a Runtime struct and a free spawn fn. These should generally wrap around the tokio runtime.tokio::runtime::Runtime throughout the codebase. We may also at this point want to move in test_utils::runtime to be a fn that lives within create::runtime.I'm learning Rust and have been interested in Vector, so I'd be interested in giving this one a shot!
From the description, it seems like after following the first two steps the compiler will guide me and the tests will ensure I did it correctly, is that mostly right?
@Michael-J-Ward yup! mostly what I want is some struct that looks like
pub struct Runtime {
rt: tokio::runtime::Runtime,
}
That then exposes all the fn that we actually use off of the runtime.
I'll take a stab at it this weekend then!
Most helpful comment
I'll take a stab at it this weekend then!