#![deny(clippy::disallowed_methods)]
use std::fmt;
mod quickwit_common;
use crate::quickwit_common::proto::{ServiceError, ServiceErrorCode};
use tokio::time::Duration;
mod actor;
mod actor_context;
mod actor_handle;
mod actor_state;
#[doc(hidden)]
pub mod channel_with_priority;
mod command;
mod envelope;
mod mailbox;
mod observation;
mod registry;
pub(crate) mod scheduler;
mod spawn_builder;
mod supervisor;
pub use scheduler::{start_scheduler, SchedulerClient};
#[cfg(test)]
pub(crate) mod tests;
mod universe;
use crate::quickwit_common::KillSwitch;
pub use actor::{Actor, ActorExitStatus, DeferableReplyHandler, Handler};
pub use actor_handle::{ActorHandle, Health, Healthz, Supervisable};
pub use command::Command;
pub use observation::{Observation, ObservationType};
pub use spawn_builder::SpawnContext;
use thiserror::Error;
pub use universe::Universe;
pub use self::actor_context::ActorContext;
pub use self::actor_state::ActorState;
pub use self::channel_with_priority::{QueueCapacity, RecvError, SendError, TrySendError};
pub use self::mailbox::{Inbox, Mailbox};
pub use self::registry::ActorObservation;
pub use self::supervisor::{Supervisor, SupervisorState};
pub const HEARTBEAT: Duration = if cfg!(any(test, feature = "testsuite")) {
Duration::from_millis(500)
} else {
Duration::from_secs(3)
};
const OBSERVE_TIMEOUT: Duration = Duration::from_secs(3);
#[derive(Error, Debug)]
pub enum AskError<E: fmt::Debug> {
#[error("Message could not be delivered")]
MessageNotDelivered,
#[error("Error while the message was being processed.")]
ProcessMessageError,
#[error("The handler returned an error: `{0:?}`.")]
ErrorReply(#[from] E),
}
impl<E: fmt::Debug + ServiceError> ServiceError for AskError<E> {
fn status_code(&self) -> ServiceErrorCode {
match self {
AskError::MessageNotDelivered => ServiceErrorCode::Internal,
AskError::ProcessMessageError => ServiceErrorCode::Internal,
AskError::ErrorReply(err) => err.status_code(),
}
}
}