Pipeline

Trait Pipeline 

Source
pub trait Pipeline: Send + Sync {
    // Required methods
    fn start(
        &mut self,
    ) -> impl Future<Output = Result<(), IronpostError>> + Send;
    fn stop(&mut self) -> impl Future<Output = Result<(), IronpostError>> + Send;
    fn health_check(&self) -> impl Future<Output = HealthStatus> + Send;
}
Expand description

모든 파이프라인 모듈이 구현하는 생명주기 trait

ironpost-daemon에서 각 모듈을 시작/정지하고 상태를 확인하는 데 사용됩니다.

§구현 예시

struct EbpfPipeline { /* ... */ }

impl Pipeline for EbpfPipeline {
    async fn start(&mut self) -> Result<(), IronpostError> {
        // XDP 프로그램 로드, 링 버퍼 설정 등
        Ok(())
    }

    async fn stop(&mut self) -> Result<(), IronpostError> {
        // 리소스 정리, 프로그램 언로드
        Ok(())
    }

    async fn health_check(&self) -> HealthStatus {
        HealthStatus::Healthy
    }
}

Required Methods§

Source

fn start(&mut self) -> impl Future<Output = Result<(), IronpostError>> + Send

모듈을 시작합니다.

리소스 초기화, 워커 스폰, 채널 연결 등을 수행합니다.

§Errors

이미 실행 중인 경우 PipelineError::AlreadyRunning을 반환합니다.

Source

fn stop(&mut self) -> impl Future<Output = Result<(), IronpostError>> + Send

모듈을 정지합니다.

Graceful shutdown을 수행합니다. 진행 중인 작업을 완료하고 리소스를 정리합니다.

§Errors

정지 과정에서 문제가 발생하면 에러를 반환합니다.

Source

fn health_check(&self) -> impl Future<Output = HealthStatus> + Send

모듈의 현재 상태를 확인합니다.

주기적으로 호출되어 모듈의 건강 상태를 모니터링합니다.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§