Skip to content
Snippets Groups Projects
user avatar
Vladislav Shpilevoy authored
The patch adds `struct <name>_request` types for replication
requests: join, subscribe, register. Only not for ack/heartbeat
requests. They are covered separately in a next commit.

The motivation is to make them independent. Previously a lot of
codecs were calling xrow_encode/decode_subscribe() under the hood
with tons of optional params.

Now inside they all fallback to internal
`struct replication_request`. The code duplication is reduced,
because all encoding/decoding is handled by replication_request.
Also alteration of any of the requests only requires to update
that request itself and replication_request codec.

Additionally, this is consistent with other requests having their
own structs like synchro_request, raft_request, call_request, etc.

Alongside the commit fixes xrow_decode_register(), which used to
try to decode version_id, but the result wasn't used and the
version_id wasn't encoded in xrow_encode_register() anyway.

This work is done now, because soon replication acks will get a
new field and it wouldn't be good to update all this codecs mess
again just for that field.

The downside is that the requests store their members by values.
That requires to copy them before encoding. Not good for big
fields like vclocks. OTOH the requests affected by this commit are
sent very rarely, perf is not important at all.

Needed for #7253

NO_DOC=refactoring
NO_CHANGELOG=refactoring
NO_TEST=refactoring
e0834564
History