]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
crimson/net: skeleton code for ProtocolV2 logic
authorYingxin Cheng <yingxincheng@gmail.com>
Thu, 28 Feb 2019 08:40:24 +0000 (16:40 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 5 Apr 2019 03:21:18 +0000 (11:21 +0800)
commite366e736ff7318e86b018545271f2bee01b64de6
tree06fd1cefaf4a778a8b48f7c86992cd5a084024a1
parent674a740877203e52cd621029058046dcdb48dd8a
crimson/net: skeleton code for ProtocolV2 logic

crimson ProtocolV2 class is following a state-machine design style:
* states are defined in ProtocolV2::state_t;
* call `execute_<state_name>()` methods to trigger different states;
* V2 logics are implemented in each execute_<state_name>() methods, and
  with explicit transitions to other states at the end of the execute_*;
* each state is associated with a write state defined in Protocol.h:
  - none: not allowed to send;
  - delay: messages can be queued, but will be delayed to send;
  - open: dispatch queued message/keepalive/ack;
  - drop: not send any messages, drop them all.

crimson ProtocolV2 is alike async ProtocolV2, with some considerations:
* explicit and encapsulated client/server handshake workflow.
* futurized-exception-based fault handling, which can interrupt protocol
  workflow at any time in each state.
* introduced SERVER_WAIT state, meaning to wait for peer-client's socket
  to reset or be replaced, and expect no further reads.
* introduced an explicit REPLACING state, async-msgr would be at the
  NONE state during replacing.

Signed-off-by: Yingxin Cheng <yingxincheng@gmail.com>
src/crimson/CMakeLists.txt
src/crimson/net/ProtocolV2.cc [new file with mode: 0644]
src/crimson/net/ProtocolV2.h [new file with mode: 0644]
src/crimson/net/SocketConnection.cc
src/crimson/net/SocketConnection.h