pub struct Audit { /* private fields */ }Implementations§
Source§impl Audit
impl Audit
pub fn open(cfg: AuditConfig) -> Result<Audit, Error>
Sourcepub fn wants_raw_html(&self) -> bool
pub fn wants_raw_html(&self) -> bool
快照要用渲染或抓取得到的原始 HTML:开着快照时内部多要一份 rawHtml。
Sourcepub fn record_scrape(
&self,
kind: &str,
url: &str,
opts: &ScrapeOptions,
result: &Result<Document, ApiError>,
raw_html: Option<&str>,
elapsed: Duration,
)
pub fn record_scrape( &self, kind: &str, url: &str, opts: &ScrapeOptions, result: &Result<Document, ApiError>, raw_html: Option<&str>, elapsed: Duration, )
记一次抓取。raw_html 是这次得到的 HTML(缓存命中、出错时没有)。
Sourcepub fn record_scrape_ignoring_robots(
&self,
kind: &str,
url: &str,
opts: &ScrapeOptions,
result: &Result<Document, ApiError>,
raw_html: Option<&str>,
elapsed: Duration,
reason: &str,
)
pub fn record_scrape_ignoring_robots( &self, kind: &str, url: &str, opts: &ScrapeOptions, result: &Result<Document, ApiError>, raw_html: Option<&str>, elapsed: Duration, reason: &str, )
同 Audit::record_scrape,这次抓取实际忽略了 robots.txt:记录里另带 robotsIgnored(原因)。
Sourcepub fn record_robots_ignored(&self, request: &str, url: &str, reason: &str)
pub fn record_robots_ignored(&self, request: &str, url: &str, reason: &str)
一次整站爬取或 map 实际忽略了 robots.txt:起始 URL、请求类型、原因(调用方见 client)。
爬取里每一页的抓取记录另带 robotsIgnored。
Sourcepub fn record_parse(
&self,
name: &str,
file_bytes: usize,
opts: &ScrapeOptions,
result: &Result<Document, ApiError>,
elapsed: Duration,
)
pub fn record_parse( &self, name: &str, file_bytes: usize, opts: &ScrapeOptions, result: &Result<Document, ApiError>, elapsed: Duration, )
记一次上传文件解析(/v2/parse):name 是 upload:<文件名>,另记文件大小;不存快照。
Sourcepub fn record_report(&self, report: Value)
pub fn record_report(&self, report: Value)
调用方(MCP 的 report_issue)报告的问题,和抓取记录写进同一个日志。
Sourcepub fn collect_only(source: &str) -> Audit
pub fn collect_only(source: &str) -> Audit
只收集记录、不写本地文件(没配置审计日志的工人:记录随结果交给网关)。不存快照。
Sourcepub fn append_from(&self, rec: Value, worker: &str)
pub fn append_from(&self, rec: Value, worker: &str)
网关:追加一条工人交来的记录,带上工人 id。
Auto Trait Implementations§
impl !Freeze for Audit
impl !RefUnwindSafe for Audit
impl !UnwindSafe for Audit
impl Forget for Audit
impl Move for Audit
impl Send for Audit
impl Sync for Audit
impl Unpin for Audit
impl UnsafeUnpin for Audit
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