Skip to content
Snippets Groups Projects
Commit e0834564 authored by Vladislav Shpilevoy's avatar Vladislav Shpilevoy
Browse files

replication: introduce structs for all requests

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
parent 5215f3f3
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment