Skip to main content

DataEvent

Trait DataEvent 

Source
pub trait DataEvent {
    // Required methods
    fn payload(&self) -> &[u8] ;
    fn timestamp_ns(&self) -> u64;
    fn direction(&self) -> Direction;
    fn connection_id(&self) -> u64;
    fn process_id(&self) -> u32;
    fn remote_port(&self) -> u16;

    // Provided method
    fn into_payload(self) -> Bytes
       where Self: Sized { ... }
}
Expand description

Trait for data events that can be collated into HTTP exchanges.

Implement this trait for your data source (e.g., eBPF events, pcap packets) to enable HTTP collation.

Required Methods§

Source

fn payload(&self) -> &[u8]

The raw payload bytes of this event

Source

fn timestamp_ns(&self) -> u64

Timestamp in nanoseconds (monotonic, for latency calculation)

Source

fn direction(&self) -> Direction

Direction of the data flow

Source

fn connection_id(&self) -> u64

Connection identifier (0 if unavailable, falls back to process_id)

Source

fn process_id(&self) -> u32

Process ID for connection tracking

Source

fn remote_port(&self) -> u16

Remote port (0 if unknown)

Provided Methods§

Source

fn into_payload(self) -> Bytes
where Self: Sized,

Consume self and return the payload as Bytes.

The default implementation copies via payload().to_vec(). Implementors that already own a Bytes (or Vec<u8>) should override this to avoid the copy.

Implementors§