refactor: send StreamAppendResult through AppendEntriesTx channel#1665
Merged
xp-trumpet merged 1 commit intodatabendlabs:mainfrom Feb 27, 2026
Merged
Conversation
5029e00 to
80892af
Compare
The engine now builds `StreamAppendResult` directly and sends it through the channel, instead of sending `AppendEntriesResponse` and converting at the stream_append pipeline. This eliminates `LogIdRange` tracking from the `Pending` struct in stream_append, since the log_id context is attached at the source where entries are processed. `Raft::append_entries` converts back to `AppendEntriesResponse` via a new `From<StreamAppendResult>` impl for the public API. Also introduces `LogSegment` to bundle `prev_log_id` + `entries`, and replaces `RejectLeadership` with `RejectVote` in both `update_vote()` and `RejectAppendEntries`, removing the now-dead `RejectLeadership` type. Changes: - Add `LogSegment` struct with `new()` and `last()` methods - Change `AppendEntriesTx<C>` to send `StreamAppendResult<C>` - Add `From<StreamAppendResult>` for `AppendEntriesResponse` - Add `From<RejectAppendEntries>` for `StreamAppendError` - Change `update_vote()` return type from `RejectLeadership` to `RejectVote` - Remove `RejectLeadership` enum (dead code) - Simplify `Pending` in stream_append to a single `response_rx` field
80892af to
093b473
Compare
xp-trumpet
approved these changes
Feb 27, 2026
Collaborator
xp-trumpet
left a comment
There was a problem hiding this comment.
@xp-trumpet reviewed 15 files and all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on drmingdrmer).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog
refactor: send
StreamAppendResultthroughAppendEntriesTxchannelThe engine now builds
StreamAppendResultdirectly and sends it throughthe channel, instead of sending
AppendEntriesResponseand convertingat the stream_append pipeline. This eliminates
LogIdRangetrackingfrom the
Pendingstruct in stream_append, since the log_id context isattached at the source where entries are processed.
Raft::append_entriesconverts back toAppendEntriesResponsevia anew
From<StreamAppendResult>impl for the public API.Also introduces
LogSegmentto bundleprev_log_id+entries, andreplaces
RejectLeadershipwithRejectVotein bothupdate_vote()and
RejectAppendEntries, removing the now-deadRejectLeadershiptype.Changes:
LogSegmentstruct withnew()andlast()methodsAppendEntriesTx<C>to sendStreamAppendResult<C>From<StreamAppendResult>forAppendEntriesResponseFrom<RejectAppendEntries>forStreamAppendErrorupdate_vote()return type fromRejectLeadershiptoRejectVoteRejectLeadershipenum (dead code)Pendingin stream_append to a singleresponse_rxfieldThis change is