[][src]Struct cannyls::device::DeviceBuilder

pub struct DeviceBuilder { /* fields omitted */ }

Deviceのビルダ.

Methods

impl DeviceBuilder
[src]

pub fn new() -> Self
[src]

デフォルト設定でDeviceBuilderインスタンスを生成する.

pub fn metrics(&mut self, metrics: MetricBuilder) -> &mut Self
[src]

メトリクス用の共通設定を登録する.

デフォルト値はMetricBuilder::new().

pub fn idle_threshold(&mut self, duration: Duration) -> &mut Self
[src]

デバイスが暇だと判定するための閾値(時間)を設定する.

この値以上、新規コマンドを受信しない期間が続いた場合には、 デバイス(用のスレッド)が空いていると判断されて、 ストレージの補助タスクが実行されるようになる.

デフォルト値はDuration::from_millis(100).

pub fn max_queue_len(&mut self, n: usize) -> &mut Self
[src]

デバイスの最大キュー長.

これを超えた数のコマンドがデバイスのキューに溜まると、 そのデバイスは致命的に過負荷であると判断され、 ErrorKind::DeviceBusyを終了理由として停止する.

デフォルト値は100_000.

pub fn max_keep_busy_duration(&mut self, duration: Duration) -> &mut Self
[src]

デバイスが最大継続ビジー時間.

これを超えてビジーな状態が続いた場合には、何か異常が発生しているものと判断され、 ErrorKind::DeviceBusyの終了理由でデバイスが停止する.

ビジー状態かどうかの判断にはbusy_thresholdの値を用いる.

デフォルト値はDuration::from_secs(600).

pub fn busy_threshold(&mut self, n: usize) -> &mut Self
[src]

デバイスがビジー状態かどうかを判定するための閾値.

コマンドのキューの長さがこの値を超えている場合には、 そのデバイスはビジー状態であるとみなされる.

デバイス側は、特定のコマンドの優先度等は分からないため、 ビジー状態だからといってコマンドを拒否することはないが、 この状態が一定(max_keep_busy_duration)以上継続した場合には、 そのデバイスが何かしらの異常により過負荷に陥っていると判断して、 停止させられる.

デフォルト値は1_000.

pub fn spawn<F, N>(&self, init_storage: F) -> Device where
    F: FnOnce() -> Result<Storage<N>> + Send + 'static,
    N: NonVolatileMemory + Send + 'static, 
[src]

指定されたストレージを扱うDeviceを起動する.

起動したデバイス用に、一つの専用OSスレッドが割り当てられる.

なお、スレッド起動後には、まずinit_storage()が呼び出されて、 ストレージインスタンスが生成される.

注意

返り値のDeviceインスタンスが破棄されると、 起動したデバイススレッドも停止させられるので注意が必要.

Trait Implementations

impl Default for DeviceBuilder
[src]

impl Clone for DeviceBuilder
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for DeviceBuilder
[src]

Auto Trait Implementations

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]