Refactor/network improvements
Summary
- Rename trait
rpc::Request
toRequestArgs
to be more specific and to reduce the number of structs named Request - Add
network::Request
(private) struct instead of an unnamed tuple for the request queue in theConnectionPoolWorker
- Remove
ConnectionPoolBuilder
struct to reduce code complexity. Builders should also be added in cases their use is a benefit, i.e. large numbers of parameters, sequences of parameters, etc. This is not the case withConnectionPool
- Make connection pool's methods take
&self
by hiding the mutability internally using theUnsafeCell
. This is safe, because 2 raw pointers into theUnsafeCell
will never exist simultaneously, unless we useConnectionPool
from separate threads, which we aren't going to. - Refactor
ConnectionPool
's code to reduce copy-paste - Add ability to specify a timeout per request. If the timeout is not specified, the one from the
WorkerOptions
is used. - Reuse the single
ConnectionPool
between raft node loop and governor loop
Ensure that
-
New code is covered by tests -
API is documented -
Changelog is up to date -
(if Lua API changed) Lua API version is bumped inluamod.rs
-
(if API docs changed) A follow-up doc issue is created in picodata/docs and linked here
Edited by Yaroslav Dynnikov