Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • core/picodata
1 result
Show changes
Commits on Source (2)
......@@ -29,7 +29,7 @@ pub enum Error {
Tarantool(#[from] ::tarantool::error::Error),
#[error("peer with id {0} not found")]
NoPeerWithRaftId(RaftId),
#[error(r#"peer with id "{0}" not found"#)]
#[error("peer with id {0:?} not found")]
NoPeerWithInstanceId(InstanceId),
#[error("other error: {0}")]
Other(Box<dyn std::error::Error>),
......
......@@ -56,6 +56,7 @@ pub struct PoolWorker {
id: RaftId,
inbox: Queue,
fiber: fiber::LuaUnitJoinHandle<'static>,
cond: Rc<fiber::Cond>,
stop_flag: Rc<Cell<bool>>,
handler_name: &'static str,
}
......@@ -67,6 +68,7 @@ impl PoolWorker {
let stop_flag = Rc::new(Cell::default());
let handler_name = opts.handler_name;
let fiber = fiber::defer_proc({
let cond = cond.clone();
let inbox = inbox.clone();
let stop_flag = stop_flag.clone();
move || Self::worker_loop(id, storage, cond, inbox, stop_flag, &opts)
......@@ -75,6 +77,7 @@ impl PoolWorker {
Self {
id,
fiber,
cond,
inbox,
stop_flag,
handler_name,
......@@ -82,7 +85,7 @@ impl PoolWorker {
}
/// `cond` is a single shared conditional variable that can be signaled by
/// `inbox` or `promises`.
/// `inbox`, `promises`, or [`Self::stop`].
fn worker_loop(
raft_id: RaftId,
storage: PeerStorage,
......@@ -291,6 +294,7 @@ impl PoolWorker {
fn stop(self) {
self.stop_flag.set(true);
self.cond.signal();
self.fiber.join();
}
}
......
......@@ -388,12 +388,14 @@ macro_rules! define_peer_fields {
$(
/// Helper struct that represents
#[doc = stringify!($name)]
/// field of `Peer`.
/// field of [`Peer`].
///
/// It's rust type is
#[doc = concat!("`", stringify!($ty), "`")]
/// and it's tarantool type is
#[doc = concat!("`", stringify!($tt_ty), "`")]
///
/// [`Peer`]: crate::traft::Peer
pub struct $field;
impl PeerFieldDef for $field {
......