pub struct BlueGreenManager { /* private fields */ }Expand description
Blue-Green デプロイメントマネージャ
Implementations§
Source§impl BlueGreenManager
impl BlueGreenManager
Sourcepub fn new(config: BlueGreenConfig) -> Result<Self, ApplicatorError>
pub fn new(config: BlueGreenConfig) -> Result<Self, ApplicatorError>
新しい Manager を作成
Sourcepub fn config(&self) -> &BlueGreenConfig
pub fn config(&self) -> &BlueGreenConfig
設定を取得
Sourcepub fn state(&self) -> ServerState
pub fn state(&self) -> ServerState
現在のサーバー状態を取得
Sourcepub fn active_endpoint(&self) -> String
pub fn active_endpoint(&self) -> String
現在リクエストを送るべきエンドポイントを取得
状態に応じて適切なサーバーを返す:
- Active: アクティブサーバー
- Starting: 旧サーバー(まだ稼働中)
- Releasing: 新サーバー(既に稼働中)
- Down: アクティブサーバー(実際は利用不可)
Sourcepub fn standby_endpoint(&self) -> String
pub fn standby_endpoint(&self) -> String
Standby(次に起動する側)のエンドポイントを取得
Sourcepub async fn switch_with_new_lora(
&self,
new_lora: &Path,
) -> Result<(), ApplicatorError>
pub async fn switch_with_new_lora( &self, new_lora: &Path, ) -> Result<(), ApplicatorError>
新しい LoRA を追加して切り替え
Sourcepub async fn switch_with_loras(
&self,
loras: &[PathBuf],
) -> Result<(), ApplicatorError>
pub async fn switch_with_loras( &self, loras: &[PathBuf], ) -> Result<(), ApplicatorError>
指定した LoRA セットで切り替え
§状態遷移
Active → Starting → Active → Releasing → Active
(新起動) (切替) (旧停止)Starting/Releasing 中もリクエストは処理可能(ダウンタイムなし)
Sourcepub async fn switch_with_model(
&self,
model: &TrainedModel,
) -> Result<(), ApplicatorError>
pub async fn switch_with_model( &self, model: &TrainedModel, ) -> Result<(), ApplicatorError>
TrainedModel を使って切り替え
Sourcepub async fn stop_all(&self) -> Result<(), ApplicatorError>
pub async fn stop_all(&self) -> Result<(), ApplicatorError>
両サーバーを停止
Sourcepub fn loaded_loras(&self) -> Vec<PathBuf>
pub fn loaded_loras(&self) -> Vec<PathBuf>
現在ロード済みの LoRA 一覧を取得
Sourcepub fn is_blue_active(&self) -> bool
pub fn is_blue_active(&self) -> bool
Blue がアクティブかどうか
Sourcepub fn switching_behavior(&self) -> &SwitchingBehavior
pub fn switching_behavior(&self) -> &SwitchingBehavior
切り替え中の挙動設定を取得
Sourcepub async fn wait_until_available(&self) -> Result<(), ApplicatorError>
pub async fn wait_until_available(&self) -> Result<(), ApplicatorError>
サーバーが利用可能になるまで待機(Waiting モード用)
Starting/Releasing 状態でもリクエスト可能なので、この関数は 主に Down 状態からの回復待機に使用。
SwitchingBehavior::WaitForReady の場合、利用可能になるまで待機。
SwitchingBehavior::FailImmediately の場合は即座に結果を返す。
Trait Implementations§
Source§impl EndpointResolver for BlueGreenManager
impl EndpointResolver for BlueGreenManager
Source§fn current_endpoint(&self) -> String
fn current_endpoint(&self) -> String
現在リクエストを送るべきエンドポイントを取得 Read more
Source§fn is_available(&self) -> bool
fn is_available(&self) -> bool
サーバーが利用可能かどうか Read more
Source§fn switching_behavior(&self) -> SwitchingBehavior
fn switching_behavior(&self) -> SwitchingBehavior
切り替え中の挙動を取得
Auto Trait Implementations§
impl !Freeze for BlueGreenManager
impl RefUnwindSafe for BlueGreenManager
impl Send for BlueGreenManager
impl Sync for BlueGreenManager
impl Unpin for BlueGreenManager
impl UnwindSafe for BlueGreenManager
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