Skip to content

deprecate the unused Peer struct#591

Open
satyakwok wants to merge 1 commit into
tikv:masterfrom
satyakwok:deprecate/unused-peer-struct
Open

deprecate the unused Peer struct#591
satyakwok wants to merge 1 commit into
tikv:masterfrom
satyakwok:deprecate/unused-peer-struct

Conversation

@satyakwok

@satyakwok satyakwok commented Jun 19, 2026

Copy link
Copy Markdown

Addresses #99.

`Peer` is public and re-exported, but it is never constructed or used anywhere in the crate. It is a leftover from the old bootstrap API that accepted an initial peer set and turned it into `ConfChange` entries using each peer's context. That path was removed; a cluster is now bootstrapped by the application proposing `ConfChange` entries directly (`RawNode::propose_conf_change`), so `Peer` only lingers as a confusing, unused type. Its doc still implied the old context-injection behavior, which is the confusion #99 is about.

This marks `Peer` `#[deprecated]` (rather than removing it, to avoid a breaking change) and updates its docs to describe the current state. The two re-exports get `#[allow(deprecated)]`, matching the existing `is_empty_snap` pattern, so the crate still builds under `--deny=warnings`.

As mentioned in #99, happy to go a different way if you would rather keep `Peer` and just document that it is unused. `cargo check` is clean with `RUSTFLAGS=--deny=warnings`.

Signed-off-by: satyakwok 119509589+satyakwok@users.noreply.github.com

Summary by CodeRabbit

  • Chores
    • Peer type is now deprecated. Use RawNode::propose_conf_change for cluster bootstrapping instead.

Peer is part of the public API but is no longer constructed or used anywhere
in the crate. It is a leftover from the removed bootstrap API that accepted an
initial peer set and turned it into ConfChange entries using the peer context.
A cluster is now bootstrapped by proposing ConfChange entries directly, so Peer
only lingers as a confusing, unused type. Deprecate it rather than remove it to
avoid a breaking change.

Signed-off-by: satyakwok <119509589+satyakwok@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f7252276-776b-4441-961c-271ca81af43b

📥 Commits

Reviewing files that changed from the base of the PR and between ad13f3d and a0332d6.

📒 Files selected for processing (2)
  • src/lib.rs
  • src/raw_node.rs

📝 Walkthrough

Walkthrough

Peer in src/raw_node.rs is marked #[deprecated] with a note directing users to RawNode::propose_conf_change, and its documentation is updated to remove the old bootstrap description. In src/lib.rs, both the top-level and prelude re-exports of Peer are split into separate pub use statements annotated with #[allow(deprecated)].

Changes

Peer Deprecation

Layer / File(s) Summary
Peer deprecation and re-export suppression
src/raw_node.rs, src/lib.rs
Peer receives #[deprecated] with a RawNode::propose_conf_change guidance note and updated docs removing the old bootstrap description. Both the top-level and prelude re-exports in lib.rs split Peer into its own pub use under #[allow(deprecated)].

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

A bunny once hopped through the old peer-filled gate,
But the path has been closed — it's a bit out of date!
#[deprecated] it wears, a small badge on its chest,
"Use propose_conf_change, it works out the best!"
🐇 Hop along, little Peer, you've had quite a run!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main change: deprecating the unused Peer struct, which is the core focus of the PR as evidenced by changes in both src/lib.rs and src/raw_node.rs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant