[−][src]Struct frugalos_mds::Service
MDS用のサービスを表すFuture
実装.
MDSノードの管理やRPC要求の処理等を担当する.
一つのサーバ(HTTPサーバ)につき、一つのサービスインスタンスが起動していることを想定.
Implementations
impl Service
[src]
pub fn new(
logger: Logger,
rpc: &mut RpcServerBuilder,
tracer: ThreadLocalTracer
) -> Result<Self>
[src]
logger: Logger,
rpc: &mut RpcServerBuilder,
tracer: ThreadLocalTracer
) -> Result<Self>
新しいService
インスタンスを生成する.
pub fn handle(&self) -> ServiceHandle
[src]
Service
を操作するためのハンドルを返す.
pub fn stop(&mut self)
[src]
サービスを停止する.
サービス停止前には、全てのローカルノードでスナップショットが取得される.
サービスの停止時に考慮すべきこと
(a) すべてのノードが停止するまでに発生するノードの取得エラー(存在しない ノードへの参照)を減らすこと.
(b) 停止時のノードのスナップショット取得以降に LogSuffix
を伸ばしすぎ
ないこと. 次回起動に時間がかかるようになってしまうため.
ノードを順次停止することの問題点
旧実装のようにスナップショットを取得し終えたノードから順次停止して いくと存在しないノードに対するリクエストが発生しやすくなる.なぜなら、 MDS に RPC 呼び出しをするクライアント側は RPC サーバが停止するまでは 停止済みのノードに対するリクエストを送り続けてくるからである.
特にここで問題となるのは、ノードがすべて停止するまでの間に発生する、 停止済みのノードの取得失敗によるエラーであり、この状況ではクライアント 側のリトライで状況が改善しないため実質的にリトライが意味をなさない.
停止時のエラーを極力抑える新実装
上述の問題を避けるためにサービスの停止処理を以下の2段階に分ける.
- スナップショットの取得
- 1 がすべてのノードで完了するまで待ち合わせてからノードを停止
1 で Node
の状態が Stopping
に変更され、スナップショットの取得
もされる.スナップショットの取得が完了した際にそれを Service
に
Monitored
経由で通知する.
すべてのノードがスナップショットを取得したら(あるいは、スキップ)、
Request::Exit
を Node
に送り Node
の状態を Stopped
に変更
する.
この実装と Leader ノード以外もリクエストに応答できるようにする変更 を組み合わせることで停止時のエラーを減らすことが可能になっている.
新実装のデメリット
(b) について、スナップショットの取得に時間がかかる環境では LogSuffix
が伸びて、スナップショット取得の効果が薄れてしまうことは許容する.
pub fn take_snapshot(&mut self)
[src]
スナップショットを取得する.
pub fn start_segment_gc(&self, local_id: LocalNodeId, tx: StartSegmentGcReply)
[src]
Performs segment_gc on a single node. After this command, mds sends to Synchronizer a command which contains the following:
- machine
- next_commit_id
pub fn stop_segment_gc(&self, local_id: LocalNodeId, tx: StopSegmentGcReply)
[src]
Stops segment_gc on a single node.
Trait Implementations
impl Debug for Service
[src]
impl Future for Service
[src]
type Item = ()
The type of value that this future will resolved with if it is successful. Read more
type Error = Error
The type of error that this future will resolve with if it fails in a normal fashion. Read more
pub fn poll(&mut self) -> Poll<Self::Item, Self::Error>
[src]
pub fn wait(self) -> Result<Self::Item, Self::Error>
[src]
pub fn map<F, U>(self, f: F) -> Map<Self, F> where
F: FnOnce(Self::Item) -> U,
[src]
F: FnOnce(Self::Item) -> U,
pub fn map_err<F, E>(self, f: F) -> MapErr<Self, F> where
F: FnOnce(Self::Error) -> E,
[src]
F: FnOnce(Self::Error) -> E,
pub fn from_err<E>(self) -> FromErr<Self, E> where
E: From<Self::Error>,
[src]
E: From<Self::Error>,
pub fn then<F, B>(self, f: F) -> Then<Self, B, F> where
B: IntoFuture,
F: FnOnce(Result<Self::Item, Self::Error>) -> B,
[src]
B: IntoFuture,
F: FnOnce(Result<Self::Item, Self::Error>) -> B,
pub fn and_then<F, B>(self, f: F) -> AndThen<Self, B, F> where
B: IntoFuture<Error = Self::Error>,
F: FnOnce(Self::Item) -> B,
[src]
B: IntoFuture<Error = Self::Error>,
F: FnOnce(Self::Item) -> B,
pub fn or_else<F, B>(self, f: F) -> OrElse<Self, B, F> where
B: IntoFuture<Item = Self::Item>,
F: FnOnce(Self::Error) -> B,
[src]
B: IntoFuture<Item = Self::Item>,
F: FnOnce(Self::Error) -> B,
pub fn select<B>(self, other: B) -> Select<Self, <B as IntoFuture>::Future> where
B: IntoFuture<Item = Self::Item, Error = Self::Error>,
[src]
B: IntoFuture<Item = Self::Item, Error = Self::Error>,
pub fn select2<B>(self, other: B) -> Select2<Self, <B as IntoFuture>::Future> where
B: IntoFuture,
[src]
B: IntoFuture,
pub fn join<B>(self, other: B) -> Join<Self, <B as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,
[src]
B: IntoFuture<Error = Self::Error>,
pub fn join3<B, C>(
self,
b: B,
c: C
) -> Join3<Self, <B as IntoFuture>::Future, <C as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,
C: IntoFuture<Error = Self::Error>,
[src]
self,
b: B,
c: C
) -> Join3<Self, <B as IntoFuture>::Future, <C as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,
C: IntoFuture<Error = Self::Error>,
pub fn join4<B, C, D>(
self,
b: B,
c: C,
d: D
) -> Join4<Self, <B as IntoFuture>::Future, <C as IntoFuture>::Future, <D as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,
C: IntoFuture<Error = Self::Error>,
D: IntoFuture<Error = Self::Error>,
[src]
self,
b: B,
c: C,
d: D
) -> Join4<Self, <B as IntoFuture>::Future, <C as IntoFuture>::Future, <D as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,
C: IntoFuture<Error = Self::Error>,
D: IntoFuture<Error = Self::Error>,
pub fn join5<B, C, D, E>(
self,
b: B,
c: C,
d: D,
e: E
) -> Join5<Self, <B as IntoFuture>::Future, <C as IntoFuture>::Future, <D as IntoFuture>::Future, <E as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,
C: IntoFuture<Error = Self::Error>,
D: IntoFuture<Error = Self::Error>,
E: IntoFuture<Error = Self::Error>,
[src]
self,
b: B,
c: C,
d: D,
e: E
) -> Join5<Self, <B as IntoFuture>::Future, <C as IntoFuture>::Future, <D as IntoFuture>::Future, <E as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,
C: IntoFuture<Error = Self::Error>,
D: IntoFuture<Error = Self::Error>,
E: IntoFuture<Error = Self::Error>,
pub fn into_stream(self) -> IntoStream<Self>
[src]
pub fn flatten(self) -> Flatten<Self> where
Self::Item: IntoFuture,
<Self::Item as IntoFuture>::Error: From<Self::Error>,
[src]
Self::Item: IntoFuture,
<Self::Item as IntoFuture>::Error: From<Self::Error>,
pub fn flatten_stream(self) -> FlattenStream<Self> where
Self::Item: Stream,
<Self::Item as Stream>::Error == Self::Error,
[src]
Self::Item: Stream,
<Self::Item as Stream>::Error == Self::Error,
pub fn fuse(self) -> Fuse<Self>
[src]
pub fn inspect<F>(self, f: F) -> Inspect<Self, F> where
F: FnOnce(&Self::Item),
[src]
F: FnOnce(&Self::Item),
pub fn catch_unwind(self) -> CatchUnwind<Self> where
Self: UnwindSafe,
[src]
Self: UnwindSafe,
pub fn shared(self) -> Shared<Self>
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Service
impl Send for Service
impl !Sync for Service
impl Unpin for Service
impl !UnwindSafe for Service
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<F> IntoFuture for F where
F: Future,
[src]
F: Future,
type Future = F
The future that this type can be converted into.
type Item = <F as Future>::Item
The item that the future may resolve with.
type Error = <F as Future>::Error
The error that the future may resolve with.
pub fn into_future(self) -> F
[src]
impl<T> TimerExt for T where
T: Future,
[src]
T: Future,
pub fn timeout_after(self, duration: Duration) -> TimeoutAfter<Self>
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,