Skip to main content

Audit

Struct Audit 

Source
pub struct Audit { /* private fields */ }

Implementations§

Source§

impl Audit

Source

pub fn open(cfg: AuditConfig) -> Result<Audit, Error>

Source

pub fn wants_raw_html(&self) -> bool

快照要用渲染或抓取得到的原始 HTML:开着快照时内部多要一份 rawHtml。

Source

pub fn record_scrape( &self, kind: &str, url: &str, opts: &ScrapeOptions, result: &Result<Document, ApiError>, raw_html: Option<&str>, elapsed: Duration, )

记一次抓取。raw_html 是这次得到的 HTML(缓存命中、出错时没有)。

Source

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(原因)。

Source

pub fn record_robots_ignored(&self, request: &str, url: &str, reason: &str)

一次整站爬取或 map 实际忽略了 robots.txt:起始 URL、请求类型、原因(调用方见 client)。 爬取里每一页的抓取记录另带 robotsIgnored。

Source

pub fn record_parse( &self, name: &str, file_bytes: usize, opts: &ScrapeOptions, result: &Result<Document, ApiError>, elapsed: Duration, )

记一次上传文件解析(/v2/parse):name 是 upload:<文件名>,另记文件大小;不存快照。

Source

pub fn record_report(&self, report: Value)

调用方(MCP 的 report_issue)报告的问题,和抓取记录写进同一个日志。

Source

pub fn collect_only(source: &str) -> Audit

只收集记录、不写本地文件(没配置审计日志的工人:记录随结果交给网关)。不存快照。

Source

pub fn append_from(&self, rec: Value, worker: &str)

网关:追加一条工人交来的记录,带上工人 id。

Source

pub fn flush(&self)

等已记录的行都写到文件里(测试和需要立刻读日志的调用方用)。

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more