pub struct Wora<AppEv, AppMetric> {
pub app_name: String,
pub dirs: Dirs,
pub initial_working_dir: PathBuf,
pub host: Host,
pub sender: Sender<Event<AppEv>>,
pub receiver: Receiver<Event<AppEv>>,
pub leadership: Leadership,
pub o11y: O11yProcessorOptions<AppMetric>,
/* private fields */
}Expand description
All workloads will be able to access the WORA API
Fields§
§app_name: Stringapplication name
dirs: Dirscommon directories for all executors
initial_working_dir: PathBufcurrent directory where the process was invoked (an executor will likely override this)
host: Hosthost info/stats
sender: Sender<Event<AppEv>>Event producer
receiver: Receiver<Event<AppEv>>Event receiver
leadership: Leadershipleadership state
o11y: O11yProcessorOptions<AppMetric>Implementations§
Source§impl<AppEv: Send + Sync + 'static, AppMetric: Send + Sync + 'static> Wora<AppEv, AppMetric>
WORA API
impl<AppEv: Send + Sync + 'static, AppMetric: Send + Sync + 'static> Wora<AppEv, AppMetric>
WORA API
pub fn new( dirs: &Dirs, app_name: String, ev_buf_size: usize, o11y: O11yProcessorOptions<AppMetric>, ) -> Result<Wora<AppEv, AppMetric>, WoraSetupError>
Sourcepub fn stats_from_start(&self) -> &HostStats
pub fn stats_from_start(&self) -> &HostStats
Examples found in repository?
examples/async_daemon.rs (line 85)
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
async fn setup(
&mut self,
wora: &Wora<(), ()>,
exec: impl AsyncExecutor<(), ()>,
_fs: impl WFS,
_o11y: Sender<O11yEvent<()>>,
) -> Result<Self::Setup, Box<dyn std::error::Error>> {
debug!("{:?}", wora.stats_from_start());
let args = DaemonArgs::parse();
self.args = args;
debug!("{:?}", exec.disable_core_dumps());
Ok(())
}pub fn dirs(&self) -> &Dirs
pub async fn emit_event(&self, ev: Event<AppEv>)
pub fn host_os_name(&self) -> &str
pub fn host_os_version(&self) -> Option<String>
pub fn host_architecture(&self) -> Option<String>
pub fn host_hostname(&self) -> Option<String>
pub fn host_cpu_count(&self) -> usize
pub fn host_cpu_max(&self) -> usize
pub async fn schedule_event(&self, duration: Duration, ev: Event<AppEv>)
pub async fn schedule_task<F, Fut>( &self, duration: Duration, future: F, ) -> JoinHandle<TaskOp>
Auto Trait Implementations§
impl<AppEv, AppMetric> Freeze for Wora<AppEv, AppMetric>
impl<AppEv, AppMetric> !RefUnwindSafe for Wora<AppEv, AppMetric>
impl<AppEv, AppMetric> Send for Wora<AppEv, AppMetric>
impl<AppEv, AppMetric> Sync for Wora<AppEv, AppMetric>
impl<AppEv, AppMetric> Unpin for Wora<AppEv, AppMetric>
impl<AppEv, AppMetric> !UnwindSafe for Wora<AppEv, AppMetric>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more