pub struct Health {
config: HealthConfig,
wakeup_list_check: Vec<NaiveTime>,
wakeup_list_tweet: Vec<NaiveTime>,
history: VecDeque<HistoryEntry>,
}
Expand description
ヘルスチェックシステムモジュール。
Fields§
§config: HealthConfig
設定データ。
wakeup_list_check: Vec<NaiveTime>
定期実行の時刻リスト。
wakeup_list_tweet: Vec<NaiveTime>
定期実行の時刻リスト。
history: VecDeque<HistoryEntry>
測定データの履歴。最大サイズは HISTORY_QUEUE_SIZE。
Implementations§
Source§impl Health
impl Health
Sourcepub fn new(
wakeup_list_check: Vec<NaiveTime>,
wakeup_list_tweet: Vec<NaiveTime>,
) -> Result<Self>
pub fn new( wakeup_list_check: Vec<NaiveTime>, wakeup_list_tweet: Vec<NaiveTime>, ) -> Result<Self>
コンストラクタ。
設定の読み込みのみ行い、async task の初期化は Self::on_start で行う。
Sourceasync fn check_task(&mut self, _ctrl: &Control) -> Result<()>
async fn check_task(&mut self, _ctrl: &Control) -> Result<()>
測定タスク。 Self::history に最新データを追加する。
Sourceasync fn tweet_task(&self, ctrl: &Control) -> Result<()>
async fn tweet_task(&self, ctrl: &Control) -> Result<()>
ツイートタスク。 Self::history の最新データが存在すればツイートする。
Sourceasync fn check_task_entry(ctrl: Control) -> Result<()>
async fn check_task_entry(ctrl: Control) -> Result<()>
Self::check_task のエントリ関数。 モジュールをロックしてメソッド呼び出しを行う。
Sourceasync fn tweet_task_entry(ctrl: Control) -> Result<()>
async fn tweet_task_entry(ctrl: Control) -> Result<()>
Self::tweet_task のエントリ関数。 モジュールをロックしてメソッド呼び出しを行う。
Trait Implementations§
Source§impl SystemModule for Health
impl SystemModule for Health
Source§fn on_start(&mut self, ctrl: &Control)
fn on_start(&mut self, ctrl: &Control)
SystemModule の初期化時には [crate::sys::taskserver::TaskServer] がまだ存在しないので
タスクの登録はこのタイミングまで遅延させる。
Auto Trait Implementations§
impl Freeze for Health
impl RefUnwindSafe for Health
impl Send for Health
impl Sync for Health
impl Unpin for Health
impl UnwindSafe for Health
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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