PluginRegistry

Struct PluginRegistry 

Source
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

Source

pub fn new() -> Self

빈 레지스트리를 생성합니다.

Source

pub fn register( &mut self, plugin: Box<dyn DynPlugin>, ) -> Result<(), IronpostError>

플러그인을 등록합니다.

동일한 이름의 플러그인이 이미 등록되어 있으면 에러를 반환합니다. 등록 순서가 보존되며, 생산자를 먼저 등록해야 합니다.

Source

pub fn unregister( &mut self, name: &str, ) -> Result<Box<dyn DynPlugin>, IronpostError>

플러그인을 해제합니다.

존재하지 않는 플러그인이면 에러를 반환합니다. 해제된 플러그인의 소유권을 반환합니다.

Source

pub fn get(&self, name: &str) -> Option<&dyn DynPlugin>

이름으로 플러그인을 조회합니다.

Source

pub fn get_mut(&mut self, name: &str) -> Option<&mut dyn DynPlugin>

이름으로 플러그인을 가변 조회합니다.

Source

pub async fn init_all(&mut self) -> Result<(), IronpostError>

모든 플러그인을 등록 순서대로 초기화합니다.

첫 번째 실패 시 즉시 반환합니다 (fail-fast).

Source

pub async fn start_all(&mut self) -> Result<(), IronpostError>

모든 플러그인을 등록 순서대로 시작합니다.

첫 번째 실패 시 즉시 반환합니다 (fail-fast). 이미 시작된 플러그인은 롤백하지 않으므로, 호출자가 stop_all을 호출해야 합니다.

Source

pub async fn stop_all(&mut self) -> Result<(), IronpostError>

모든 플러그인을 등록 순서대로 정지합니다.

생산자가 먼저 정지하여 소비자가 잔여 이벤트를 드레인할 수 있습니다. 개별 플러그인 정지 실패 시에도 나머지 플러그인의 정지를 계속합니다. 모든 에러를 수집하여 반환합니다.

Source

pub fn count(&self) -> usize

등록된 플러그인 수를 반환합니다.

Source

pub fn list(&self) -> Vec<&PluginInfo>

등록된 모든 플러그인의 정보를 반환합니다.

Source

pub async fn health_check_all(&self) -> Vec<(String, PluginState, HealthStatus)>

모든 플러그인의 건강 상태를 조회합니다.

Trait Implementations§

Source§

impl Default for PluginRegistry

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more