pub struct PhyTraceAgent { /* private fields */ }Expand description
The main PhyTrace SDK agent.
Manages the complete event lifecycle:
- License validation
- Event building and validation
- Provenance signing (optional)
- Batching and buffering
- Transport with retry logic
Implementations§
Source§impl PhyTraceAgent
impl PhyTraceAgent
Sourcepub async fn from_config(config: PhyTraceConfig) -> PhyTraceResult<Self>
pub async fn from_config(config: PhyTraceConfig) -> PhyTraceResult<Self>
Create an agent from configuration.
Sourcepub async fn with_transport(
config: PhyTraceConfig,
transport: Box<dyn Transport>,
) -> PhyTraceResult<Self>
pub async fn with_transport( config: PhyTraceConfig, transport: Box<dyn Transport>, ) -> PhyTraceResult<Self>
Create an agent with a custom transport.
Sourcepub async fn from_file<P: AsRef<Path>>(path: P) -> PhyTraceResult<Self>
pub async fn from_file<P: AsRef<Path>>(path: P) -> PhyTraceResult<Self>
Load configuration from a YAML file and create agent.
Sourcepub async fn start(&self) -> PhyTraceResult<()>
pub async fn start(&self) -> PhyTraceResult<()>
Start the agent.
Sourcepub async fn shutdown(&self) -> PhyTraceResult<()>
pub async fn shutdown(&self) -> PhyTraceResult<()>
Stop the agent gracefully.
Sourcepub fn emit(&self) -> AgentEventBuilder<'_>
pub fn emit(&self) -> AgentEventBuilder<'_>
Create an event builder for fluent emission.
Sourcepub async fn send(&self, event: UdmEvent) -> PhyTraceResult<()>
pub async fn send(&self, event: UdmEvent) -> PhyTraceResult<()>
Send a pre-built event.
Sourcepub async fn flush(&self) -> PhyTraceResult<()>
pub async fn flush(&self) -> PhyTraceResult<()>
Flush buffered events immediately.
Sourcepub async fn stats(&self) -> TransportStats
pub async fn stats(&self) -> TransportStats
Get transport statistics.
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Check if the agent is running.
Sourcepub fn config(&self) -> &PhyTraceConfig
pub fn config(&self) -> &PhyTraceConfig
Get a reference to the configuration.
Sourcepub fn set_validation_level(&mut self, level: ValidationLevel)
pub fn set_validation_level(&mut self, level: ValidationLevel)
Set the validation level.
Auto Trait Implementations§
impl !Freeze for PhyTraceAgent
impl !RefUnwindSafe for PhyTraceAgent
impl Send for PhyTraceAgent
impl Sync for PhyTraceAgent
impl Unpin for PhyTraceAgent
impl !UnwindSafe for PhyTraceAgent
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