Commit 88554d9
refactor: extract
Three handlers (`handle_kv_transaction`, `handle_kv_list`, `handle_kv_get_many`)
duplicated the same 6-line "assume leader or return forward-to-leader Status"
block. Extract it into `leader_or_forward()` so each handler reduces to a
single `self.leader_or_forward().await?` call.
The post-write forward check in `handle_kv_transaction` is intentionally kept
inline — it handles a different error path (`ClientWriteError::ForwardToLeader`)
for leadership changes that occur between the assume check and the raft write.leader_or_forward() from gRPC handler functions1 parent 6fa45df commit 88554d9
File tree
4 files changed
+21
-26
lines changed- crates
- common/types
- src/cmd
- tests/it
- server/service
- src/meta_node
- tests/it/grpc
4 files changed
+21
-26
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
182 | | - | |
| 182 | + | |
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1639 | 1639 | | |
1640 | 1640 | | |
1641 | 1641 | | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
1642 | 1655 | | |
1643 | 1656 | | |
1644 | 1657 | | |
1645 | 1658 | | |
1646 | 1659 | | |
1647 | 1660 | | |
1648 | 1661 | | |
1649 | | - | |
1650 | | - | |
1651 | | - | |
1652 | | - | |
1653 | | - | |
1654 | | - | |
1655 | | - | |
| 1662 | + | |
1656 | 1663 | | |
1657 | 1664 | | |
1658 | 1665 | | |
| |||
1678 | 1685 | | |
1679 | 1686 | | |
1680 | 1687 | | |
1681 | | - | |
1682 | | - | |
1683 | | - | |
1684 | | - | |
1685 | | - | |
1686 | | - | |
1687 | | - | |
| 1688 | + | |
1688 | 1689 | | |
1689 | 1690 | | |
1690 | 1691 | | |
| |||
1702 | 1703 | | |
1703 | 1704 | | |
1704 | 1705 | | |
1705 | | - | |
1706 | | - | |
1707 | | - | |
1708 | | - | |
1709 | | - | |
1710 | | - | |
1711 | | - | |
| 1706 | + | |
1712 | 1707 | | |
1713 | 1708 | | |
1714 | 1709 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
91 | | - | |
92 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| |||
0 commit comments