FileProvider

Trait FileProvider 

Source
pub trait FileProvider {
    // Required methods
    fn tracev3_files(&self) -> Box<dyn Iterator<Item = Box<dyn SourceFile>>>;
    fn uuidtext_files(&self) -> Box<dyn Iterator<Item = Box<dyn SourceFile>>>;
    fn read_uuidtext(&self, uuid: &str) -> Result<UUIDText, Error>;
    fn cached_uuidtext(&self, uuid: &str) -> Option<&UUIDText>;
    fn update_uuid(&mut self, uuid: &str, uuid2: &str);
    fn dsc_files(&self) -> Box<dyn Iterator<Item = Box<dyn SourceFile>>>;
    fn read_dsc_uuid(&self, uuid: &str) -> Result<SharedCacheStrings, Error>;
    fn cached_dsc(&self, uuid: &str) -> Option<&SharedCacheStrings>;
    fn update_dsc(&mut self, uuid: &str, uuid2: &str);
    fn timesync_files(&self) -> Box<dyn Iterator<Item = Box<dyn SourceFile>>>;
}
Expand description

Implementing this trait allows library consumers to provide the files required by the parser in arbitrary formats, as long as they are provided as an iterator of items that implement [Read].

For help mapping files to the correct filetype, see the LogFileType enum’s From<&Path> implementation.

Required Methods§

Source

fn tracev3_files(&self) -> Box<dyn Iterator<Item = Box<dyn SourceFile>>>

Provides an iterator of .tracev3 files from the /private/var/db/diagnostics/((HighVolume|Signpost|Trace|Special)/, plus the livedata.LogData.tracev3 file if it was collected via log collect.

Source

fn uuidtext_files(&self) -> Box<dyn Iterator<Item = Box<dyn SourceFile>>>

Provides an iterator of UUIDText string files from the /var/db/uuidtext/XX/ directories, where the XX is any two uppercase hex characters, along with the filename (i.e., the filename from the source file. This should be a 30-character name containing only hex digits. This should be a 30-character name containing only hex digits. It is important that this is. accurate, or else strings will not be able to be referenced from the source file.

Source

fn read_uuidtext(&self, uuid: &str) -> Result<UUIDText, Error>

Reads a provided UUID file at runtime. The UUID is obtaind by parsing the tracev3 files. Reads will fail if the UUID does not exist This avoids having to read all UUIDText files into memory.

Source

fn cached_uuidtext(&self, uuid: &str) -> Option<&UUIDText>

Check our cached UUIDText data for strings

Source

fn update_uuid(&mut self, uuid: &str, uuid2: &str)

Update our cached UUIDText data

Source

fn dsc_files(&self) -> Box<dyn Iterator<Item = Box<dyn SourceFile>>>

Provides an iterator of shared string files from the /var/db/uuidtext/dsc subdirectory, along with the filename (i.e., the filename from the source file). This should be a 30-character name containing only hex digits. It is important that this is. accurate, or else strings will not be able to be referenced from the source file.

Source

fn read_dsc_uuid(&self, uuid: &str) -> Result<SharedCacheStrings, Error>

Reads a provided UUID file at runtime. The UUID is obtaind by parsing the tracev3 files. Reads will fail if the UUID does not exist This avoids having to read all SharedCacheStrings files into memory.

Source

fn cached_dsc(&self, uuid: &str) -> Option<&SharedCacheStrings>

Check our cached SharedCacheStrings for strings

Source

fn update_dsc(&mut self, uuid: &str, uuid2: &str)

Update our cached SharedCacheStrings data

Source

fn timesync_files(&self) -> Box<dyn Iterator<Item = Box<dyn SourceFile>>>

Provides an iterator of .timesync files from the /var/db/diagnostics/timesync subdirectory.

Implementors§