Refactor/network improvements
Summary
- Rename trait
rpc::RequesttoRequestArgsto 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
ConnectionPoolBuilderstruct 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
&selfby hiding the mutability internally using theUnsafeCell. This is safe, because 2 raw pointers into theUnsafeCellwill never exist simultaneously, unless we useConnectionPoolfrom 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
WorkerOptionsis used. - Reuse the single
ConnectionPoolbetween 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