pub struct ExchangeRecord {Show 24 fields
pub schema: String,
pub protocol: String,
pub binding: ArtifactId,
pub members: Vec<ExchangeMember>,
pub request_digest: Option<String>,
pub response_digest: Option<String>,
pub bytes_sent: bool,
pub status: Option<u16>,
pub retry_after: Option<String>,
pub requested_model: Option<String>,
pub served: ServedIdentity,
pub route: Vec<String>,
pub generation_id: Option<String>,
pub usage: BTreeMap<String, u64>,
pub reported_cost: Option<ReportedCost>,
pub exchange_charge: Charge,
pub attribution: Attribution,
pub privacy_requested: BTreeMap<String, String>,
pub provider_extras: BTreeMap<String, String>,
pub late: bool,
pub truncated: bool,
pub principal: Option<PrincipalEvidence>,
pub phase_expiry: Option<PhaseExpiry>,
pub connection: Option<ConnectionObservation>,
}Expand description
One exchange, keyed by the attempt ids it served (spec 009, 3.9.1).
Bounded: every string is cut to MAX_TEXT_BYTES and every collection
to its cap by ExchangeRecord::bounded, so a record never exceeds
EXCHANGE_V1’s max_bytes. Request and response bytes are never in
the record; only their digests are.
Fields§
§schema: String§protocol: StringThe wire protocol: PROTOCOL or a foreign mapping’s own label.
binding: ArtifactIdThe adapter binding identity (the adapter’s artifact, 3.2.3).
members: Vec<ExchangeMember>Every member attempt, in attempt-id order.
request_digest: Option<String>sha256: digest of the request bytes, when any were built.
response_digest: Option<String>sha256: digest of the response bytes, when any were read.
bytes_sent: boolWhether any request byte left the process.
status: Option<u16>§retry_after: Option<String>Recorded verbatim, never slept on.
requested_model: Option<String>§served: ServedIdentity§route: Vec<String>§generation_id: Option<String>§usage: BTreeMap<String, u64>Usage as reported (for example token counts), by name.
reported_cost: Option<ReportedCost>Cost as reported, verbatim; units are not money.
exchange_charge: ChargeThe exchange’s charge in deployment units, before attribution.
attribution: Attribution§privacy_requested: BTreeMap<String, String>§provider_extras: BTreeMap<String, String>Provider-reported extras (3.5.5): argmax, confidence, explanations.
late: boolThe response arrived after the attempts stopped waiting; nothing in it was supplied (3.4.4).
truncated: boolSomething was cut to fit the record’s bounds.
principal: Option<PrincipalEvidence>The digest and mapping version of the principal reference the request carried (spec 020, 3.6); absent when none was sent.
phase_expiry: Option<PhaseExpiry>The transport phase that ran out, when an enabled phase policy governed the exchange (spec 020, 3.4). Absent otherwise, so a record without one keeps its spec 009 bytes.
connection: Option<ConnectionObservation>The pooled connection the exchange used (spec 020, 3.5); absent when connection reuse is disabled.
Implementations§
Source§impl ExchangeRecord
impl ExchangeRecord
Sourcepub fn bounded(self) -> Self
pub fn bounded(self) -> Self
The record cut to its fixed bounds: every string to
MAX_TEXT_BYTES, members to MAX_ITEMS, route to MAX_ROUTE
and each map to MAX_ENTRIES, with truncated set when anything
was cut. The schema is set.
Sourcepub fn is_bounded(&self) -> bool
pub fn is_bounded(&self) -> bool
True when the record is within its bounds, as Self::bounded
leaves it. A parsed record that is not is refused by
Self::parse_checked.
Sourcepub fn parse_checked(bytes: &[u8]) -> Result<Self, DocumentError>
pub fn parse_checked(bytes: &[u8]) -> Result<Self, DocumentError>
Parse under EXCHANGE_V1 and refuse a record beyond its bounds.
Trait Implementations§
Source§impl Clone for ExchangeRecord
impl Clone for ExchangeRecord
Source§impl Debug for ExchangeRecord
impl Debug for ExchangeRecord
Source§impl<'de> Deserialize<'de> for ExchangeRecord
impl<'de> Deserialize<'de> for ExchangeRecord
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Document for ExchangeRecord
impl Document for ExchangeRecord
Source§const SCHEMA: &'static str = schema::REMOTE_EXCHANGE
const SCHEMA: &'static str = schema::REMOTE_EXCHANGE
Source§const LIMITS: ParseLimits = EXCHANGE_V1
const LIMITS: ParseLimits = EXCHANGE_V1
Source§fn parse(bytes: &[u8]) -> Result<Self, DocumentError>
fn parse(bytes: &[u8]) -> Result<Self, DocumentError>
Source§fn record_canonical(&self) -> Result<Vec<u8>, CanonicalError>where
Self: PartialEq,
fn record_canonical(&self) -> Result<Vec<u8>, CanonicalError>where
Self: PartialEq,
Source§fn record_digest(&self) -> Result<ContentDigest, CanonicalError>where
Self: PartialEq,
fn record_digest(&self) -> Result<ContentDigest, CanonicalError>where
Self: PartialEq,
sha256(SCHEMA || 0x00 || record canonical bytes) (spec 004, 3.1.6).
Equal to the identity of an identified document.impl Eq for ExchangeRecord
Source§impl JsonSchema for ExchangeRecord
impl JsonSchema for ExchangeRecord
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more