pub struct PcapWriter { /* private fields */ }Expand description
PCAP数据集写入器
提供对PCAP数据集的高性能写入功能,支持:
- 自动文件管理和切换
- 智能索引生成和更新
- 高性能写入优化
- 数据完整性保证
Implementations§
Source§impl PcapWriter
impl PcapWriter
Sourcepub fn new_with_config<P: AsRef<Path>>(
base_path: P,
dataset_name: &str,
configuration: WriterConfig,
) -> PcapResult<Self>
pub fn new_with_config<P: AsRef<Path>>( base_path: P, dataset_name: &str, configuration: WriterConfig, ) -> PcapResult<Self>
Sourcepub fn initialize(&mut self) -> PcapResult<()>
pub fn initialize(&mut self) -> PcapResult<()>
初始化写入器
Sourcepub fn finalize(&mut self) -> PcapResult<()>
pub fn finalize(&mut self) -> PcapResult<()>
完成写入并生成索引
Sourcepub fn get_dataset_info(&self) -> DatasetInfo
pub fn get_dataset_info(&self) -> DatasetInfo
获取数据集信息
Sourcepub fn get_file_info_list(&self) -> Vec<FileInfo>
pub fn get_file_info_list(&self) -> Vec<FileInfo>
获取文件信息列表
Sourcepub fn index(&self) -> &IndexManager
pub fn index(&self) -> &IndexManager
获取索引管理器的引用 允许外部通过 writer.index().method() 的方式访问索引功能
Sourcepub fn index_mut(&mut self) -> &mut IndexManager
pub fn index_mut(&mut self) -> &mut IndexManager
获取索引管理器的可变引用 允许外部通过 writer.index_mut().method() 的方式访问索引功能
Sourcepub fn dataset_path(&self) -> &Path
pub fn dataset_path(&self) -> &Path
获取数据集路径
Sourcepub fn dataset_name(&self) -> &str
pub fn dataset_name(&self) -> &str
获取数据集名称
Sourcepub fn write_packet(&mut self, packet: &DataPacket) -> PcapResult<()>
pub fn write_packet(&mut self, packet: &DataPacket) -> PcapResult<()>
Sourcepub fn write_packets(&mut self, packets: &[DataPacket]) -> PcapResult<()>
pub fn write_packets(&mut self, packets: &[DataPacket]) -> PcapResult<()>
Sourcepub fn flush(&mut self) -> PcapResult<()>
pub fn flush(&mut self) -> PcapResult<()>
刷新当前文件
将当前文件的缓冲区数据写入磁盘,确保数据完整性。
Sourcepub fn get_cache_stats(&self) -> CacheStats
pub fn get_cache_stats(&self) -> CacheStats
获取缓存统计信息
Sourcepub fn clear_cache(&mut self) -> PcapResult<()>
pub fn clear_cache(&mut self) -> PcapResult<()>
清理缓存
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PcapWriter
impl RefUnwindSafe for PcapWriter
impl Send for PcapWriter
impl Sync for PcapWriter
impl Unpin for PcapWriter
impl UnwindSafe for PcapWriter
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