use std::hash::Hash;
use std::hash::Hasher;
use crate::protocol::remoting_command::RemotingCommand;
pub struct ResponseFuture {
pub(crate) opaque: i32,
pub(crate) timeout_millis: u64,
pub(crate) send_request_ok: bool,
pub(crate) tx: tokio::sync::oneshot::Sender<rocketmq_error::RocketMQResult<RemotingCommand>>,
}
impl PartialEq for ResponseFuture {
fn eq(&self, other: &Self) -> bool {
self.opaque == other.opaque
&& self.timeout_millis == other.timeout_millis
&& self.send_request_ok == other.send_request_ok
}
}
impl Eq for ResponseFuture {}
impl Hash for ResponseFuture {
fn hash<H: Hasher>(&self, state: &mut H) {
self.opaque.hash(state);
self.timeout_millis.hash(state);
self.send_request_ok.hash(state);
}
}
impl ResponseFuture {
pub fn new(
opaque: i32,
timeout_millis: u64,
send_request_ok: bool,
tx: tokio::sync::oneshot::Sender<rocketmq_error::RocketMQResult<RemotingCommand>>,
) -> Self {
Self {
opaque,
timeout_millis,
send_request_ok,
tx,
}
}
}