-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #951 from drmingdrmer/32-handle-failed-append
Feature: add `PayloadTooLarge` error
- Loading branch information
Showing
9 changed files
with
428 additions
and
47 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
//! Defines config hint for replication RPC | ||
/// Temporary config hint for replication | ||
#[derive(Clone, Debug, Default)] | ||
pub(crate) struct ReplicationHint { | ||
n: u64, | ||
|
||
/// How many times this hint can be used. | ||
ttl: u64, | ||
} | ||
|
||
impl ReplicationHint { | ||
/// Create a new `ReplicationHint` | ||
pub(crate) fn new(n: u64, ttl: u64) -> Self { | ||
Self { n, ttl } | ||
} | ||
|
||
pub(crate) fn get(&mut self) -> Option<u64> { | ||
if self.ttl > 0 { | ||
self.ttl -= 1; | ||
Some(self.n) | ||
} else { | ||
None | ||
} | ||
} | ||
} |
Oops, something went wrong.