pub struct PluginRegistry { /* private fields */ }Expand description
플러그인 레지스트리
플러그인의 등록, 해제, 생명주기 관리를 담당합니다. 등록 순서가 보존되며, 생산자를 먼저 등록하고 소비자를 나중에 등록합니다.
§사용 예시
ⓘ
let mut registry = PluginRegistry::new();
registry.register(Box::new(ebpf_plugin))?;
registry.register(Box::new(log_plugin))?;
registry.init_all().await?;
registry.start_all().await?;
// ... 실행 중 ...
registry.stop_all().await?;Implementations§
Source§impl PluginRegistry
impl PluginRegistry
Sourcepub fn register(
&mut self,
plugin: Box<dyn DynPlugin>,
) -> Result<(), IronpostError>
pub fn register( &mut self, plugin: Box<dyn DynPlugin>, ) -> Result<(), IronpostError>
플러그인을 등록합니다.
동일한 이름의 플러그인이 이미 등록되어 있으면 에러를 반환합니다. 등록 순서가 보존되며, 생산자를 먼저 등록해야 합니다.
Sourcepub fn unregister(
&mut self,
name: &str,
) -> Result<Box<dyn DynPlugin>, IronpostError>
pub fn unregister( &mut self, name: &str, ) -> Result<Box<dyn DynPlugin>, IronpostError>
플러그인을 해제합니다.
존재하지 않는 플러그인이면 에러를 반환합니다. 해제된 플러그인의 소유권을 반환합니다.
Sourcepub async fn init_all(&mut self) -> Result<(), IronpostError>
pub async fn init_all(&mut self) -> Result<(), IronpostError>
모든 플러그인을 등록 순서대로 초기화합니다.
첫 번째 실패 시 즉시 반환합니다 (fail-fast).
Sourcepub async fn start_all(&mut self) -> Result<(), IronpostError>
pub async fn start_all(&mut self) -> Result<(), IronpostError>
모든 플러그인을 등록 순서대로 시작합니다.
첫 번째 실패 시 즉시 반환합니다 (fail-fast).
이미 시작된 플러그인은 롤백하지 않으므로, 호출자가 stop_all을 호출해야 합니다.
Sourcepub async fn stop_all(&mut self) -> Result<(), IronpostError>
pub async fn stop_all(&mut self) -> Result<(), IronpostError>
모든 플러그인을 등록 순서대로 정지합니다.
생산자가 먼저 정지하여 소비자가 잔여 이벤트를 드레인할 수 있습니다. 개별 플러그인 정지 실패 시에도 나머지 플러그인의 정지를 계속합니다. 모든 에러를 수집하여 반환합니다.
Sourcepub fn list(&self) -> Vec<&PluginInfo>
pub fn list(&self) -> Vec<&PluginInfo>
등록된 모든 플러그인의 정보를 반환합니다.
Sourcepub async fn health_check_all(&self) -> Vec<(String, PluginState, HealthStatus)>
pub async fn health_check_all(&self) -> Vec<(String, PluginState, HealthStatus)>
모든 플러그인의 건강 상태를 조회합니다.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PluginRegistry
impl !RefUnwindSafe for PluginRegistry
impl Send for PluginRegistry
impl Sync for PluginRegistry
impl Unpin for PluginRegistry
impl !UnwindSafe for PluginRegistry
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