ABI encapsulations; generate leaf code in pub fn's rather than inling them.
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -38,7 +38,8 @@ impl Data {
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn wait_pending(&self) -> Result<u64> {
|
||||
#[inline]
|
||||
pub(super) async fn wait_pending(&self) -> Result<u64> {
|
||||
let count = self.counter.dispatched();
|
||||
self.wait_count(&count).await.inspect(|retired| {
|
||||
debug_assert!(
|
||||
@@ -48,7 +49,8 @@ impl Data {
|
||||
})
|
||||
}
|
||||
|
||||
pub async fn wait_count(&self, count: &u64) -> Result<u64> {
|
||||
#[inline]
|
||||
pub(super) async fn wait_count(&self, count: &u64) -> Result<u64> {
|
||||
self.retires
|
||||
.subscribe()
|
||||
.wait_for(|retired| retired.ge(count))
|
||||
@@ -58,17 +60,17 @@ impl Data {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn next_count(&self) -> Permit {
|
||||
pub(super) fn next_count(&self) -> Permit {
|
||||
self.counter
|
||||
.next()
|
||||
.expect("failed to obtain next sequence number")
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn current_count(&self) -> u64 { self.counter.current() }
|
||||
pub(super) fn current_count(&self) -> u64 { self.counter.current() }
|
||||
|
||||
#[inline]
|
||||
pub fn pending_count(&self) -> Range<u64> { self.counter.range() }
|
||||
pub(super) fn pending_count(&self) -> Range<u64> { self.counter.range() }
|
||||
|
||||
fn handle_retire(sender: &Sender<u64>, count: u64) -> Result {
|
||||
let _prev = sender.send_replace(count);
|
||||
|
||||
@@ -105,7 +105,6 @@ impl crate::Service for Service {
|
||||
}
|
||||
|
||||
impl Service {
|
||||
#[inline]
|
||||
#[tracing::instrument(
|
||||
level = "trace",
|
||||
skip_all,
|
||||
@@ -114,7 +113,6 @@ impl Service {
|
||||
)]
|
||||
pub async fn wait_pending(&self) -> Result<u64> { self.db.wait_pending().await }
|
||||
|
||||
#[inline]
|
||||
#[tracing::instrument(
|
||||
level = "trace",
|
||||
skip_all,
|
||||
@@ -123,20 +121,17 @@ impl Service {
|
||||
)]
|
||||
pub async fn wait_count(&self, count: &u64) -> Result<u64> { self.db.wait_count(count).await }
|
||||
|
||||
#[inline]
|
||||
#[must_use]
|
||||
#[tracing::instrument(
|
||||
level = "debug",
|
||||
skip_all,
|
||||
fields(pending = ?self.pending_count()),
|
||||
)]
|
||||
#[must_use]
|
||||
pub fn next_count(&self) -> data::Permit { self.db.next_count() }
|
||||
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn current_count(&self) -> u64 { self.db.current_count() }
|
||||
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn pending_count(&self) -> Range<u64> { self.db.pending_count() }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user