pub struct NativeHttp { /* private fields */ }Expand description
Compatibility wrapper for PC/Tauri code.
HTTP execution, header injection, and error classification live in
helix-driver-host so native and FFI share one implementation. 横切层(鉴权/401/
outcome observer/trace)可选叠加——with_crosscut 装配后,请求经
CrossCuttingHttp,否则裸发。
headers 是底层 SharedHttpClient 的共享 registry 句柄(Arc clone),无论是否叠加横切层,
set/remove_global_header(connectionId / 通用头运行时注入)始终可达——横切层只管鉴权头,
通用头仍走此 registry(不互相干扰)。
Implementations§
Source§impl NativeHttp
impl NativeHttp
pub fn with_config(config: HostNetworkConfig) -> Result<Self, PortError>
pub fn with_config_and_metric_sink( config: HostNetworkConfig, metrics: Arc<dyn AsyncMetricSink>, ) -> Result<Self, PortError>
Sourcepub fn with_crosscut(
client: SharedHttpClient,
event_sink: Arc<NativeEventSink>,
auth: AuthTokenRegistry,
outcome_observer: HttpOutcomeObserver,
) -> Self
pub fn with_crosscut( client: SharedHttpClient, event_sink: Arc<NativeEventSink>, auth: AuthTokenRegistry, outcome_observer: HttpOutcomeObserver, ) -> Self
装配出站横切层(P1.5 / M2 接缝③):把裸 SharedHttpClient 包进 CrossCuttingHttp,
注入业务事件回报通道(event_sink)+ 真鉴权 token 源(auth,平台壳登录后写入)+
业务结果策略(outcome_observer)。
底层 registry 句柄保留 → 通用头注入路径不受横切层影响。
Sourcepub fn with_crosscut_and_otel(
client: SharedHttpClient,
event_sink: Arc<NativeEventSink>,
auth: AuthTokenRegistry,
outcome_observer: HttpOutcomeObserver,
otel: HostOtelRuntime,
) -> Self
pub fn with_crosscut_and_otel( client: SharedHttpClient, event_sink: Arc<NativeEventSink>, auth: AuthTokenRegistry, outcome_observer: HttpOutcomeObserver, otel: HostOtelRuntime, ) -> Self
host-cli/Tauri composition root 显式注入 OTel;兼容构造仍保持 no-op。
pub async fn set_global_header( &self, name: &str, value: &str, ) -> Result<(), PortError>
pub async fn remove_global_header(&self, name: &str) -> Result<(), PortError>
pub fn is_otel_enabled(&self) -> bool
Trait Implementations§
Source§impl Clone for NativeHttp
impl Clone for NativeHttp
Source§impl HttpRequester for NativeHttp
impl HttpRequester for NativeHttp
Auto Trait Implementations§
impl !RefUnwindSafe for NativeHttp
impl !UnwindSafe for NativeHttp
impl Freeze for NativeHttp
impl Send for NativeHttp
impl Sync for NativeHttp
impl Unpin for NativeHttp
impl UnsafeUnpin for NativeHttp
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request