@@ -70,6 +70,9 @@ The IPROTO constants that identify requests that we will mention in this section
70
70
IPROTO_ROLLBACK=0x10
71
71
IPROTO_RAFT_CONFIRM=0x28
72
72
IPROTO_RAFT_ROLLBACK=0x29
73
+ IPROTO_RAFT=0x1e
74
+ IPROTO_RAFT_PROMOTE=0x1f
75
+ IPROTO_RAFT_DEMOTE=0x20
73
76
IPROTO_PING=0x40
74
77
IPROTO_JOIN=0x41
75
78
IPROTO_SUBSCRIBE=0x42
@@ -132,6 +135,10 @@ The IPROTO constants that appear within requests or responses that we will descr
132
135
IPROTO_FIELD_IS_NULLABLE=0x03
133
136
IPROTO_FIELD_IS_AUTOINCREMENT=0x04
134
137
IPROTO_FIELD_SPAN=0x05
138
+ IPROTO_RAFT_TERM=0x00
139
+ IPROTO_RAFT_VOTE=0x01
140
+ IPROTO_RAFT_STATE=0x02
141
+ IPROTO_RAFT_VCLOCK=0x03
135
142
136
143
To denote message descriptions we will say ``msgpack(...) `` and within it we will use modified
137
144
`YAML <https://en.wikipedia.org/wiki/YAML >`_ so: |br |
@@ -1406,6 +1413,46 @@ IPROTO_FLAG_COMMIT (0x01) will be set if this is the last message for a transact
1406
1413
IPROTO_FLAG_WAIT_SYNC (0x02) will be set if this is the last message for a transaction which cannot be completed immediately,
1407
1414
IPROTO_FLAG_WAIT_ACK (0x04) will be set if this is the last message for a synchronous transaction.
1408
1415
1416
+ .. _box_protocol-raft :
1417
+
1418
+ IPROTO_RAFT = 0x1e
1419
+ ~~~~~~~~~~~~~~~~~~
1420
+
1421
+ [TBD] intro
1422
+
1423
+ IPROTO_RAFT рассылается броадкастами всем подключённым к ноде репликам.
1424
+ Если подразумевается какой-то ответ на запрос (например, когда это запрос другим нодам на голосование),
1425
+ то нужно, чтобы нода сама была подключена репликой к серверу, от которого ждёт ответ, потому что он придёт по каналу репликации.
1426
+
1427
+ Другими словами, связь между всеми должна быть в обе стороны (фуллмеш)
1428
+
1429
+
1430
+ [TBD] update request structure
1431
+
1432
+ .. cssclass :: highlight
1433
+ .. parsed-literal ::
1434
+
1435
+ # <size>
1436
+ msgpack(:samp: `{ {MP_UINT unsigned integer = size(<header>) + size(<body>) } } `)
1437
+ # <header>
1438
+ msgpack({
1439
+ IPROTO_REQUEST_TYPE: IPROTO_RAFT,
1440
+ IPROTO_SYNC: :samp: `{ {MP_UINT unsigned integer } } `,
1441
+ IPROTO_INSTANCE_UUID: :samp: `{ {uuid } } `,
1442
+ IPROTO_CLUSTER_UUID: :samp: `{ {uuid } } `,
1443
+ })
1444
+ # <body>
1445
+ msgpack({
1446
+ IPROTO_RAFT_TERM=0x00
1447
+ IPROTO_RAFT_VOTE=0x01
1448
+ IPROTO_RAFT_STATE=0x02
1449
+ IPROTO_RAFT_VCLOCK=0x03
1450
+ })
1451
+
1452
+ [TBD] update about response
1453
+
1454
+ Это асинхронный протокол, и response там - другое сообщение IPROTO_RAFT, а бывает вообще без response
1455
+
1409
1456
.. _box_protocol-illustration :
1410
1457
1411
1458
Examples
0 commit comments