pub struct Opts {Show 20 fields
pub op: Op,
pub room_id: Option<OwnedRoomId>,
pub event_id: Option<OwnedEventId>,
pub ts: Option<MilliSecondsSinceUnixEpoch>,
pub dir: Option<Direction>,
pub earliest_events: EventWindow,
pub latest_events: EventWindow,
pub hint: Option<OwnedServerName>,
pub candidates: Candidates,
pub room_version: Option<RoomVersionId>,
pub attempt_limit: Option<NonZeroUsize>,
pub backfill_limit: Option<NonZeroUsize>,
pub fanout_growth: FanoutGrowth,
pub fanout_max_width: Option<NonZeroUsize>,
pub fanout_rounds: Option<NonZeroUsize>,
pub check_event_id: bool,
pub check_conforms: bool,
pub check_hashes: bool,
pub authoritative_redaction: bool,
pub check_signature: bool,
}Expand description
Re-exports the fetch request contract, operation types, and response value.
Callers build an Opts value for an Op and receive the winning
Outcome through Service::fetch.
Re-exports the fetch request contract, operation types, and response value.
Callers build an Opts value for an Op and receive the winning
Outcome through Service::fetch.
Re-exports the fetch request contract, operation types, and response value.
Callers build an Opts value for an Op and receive the winning
Outcome through Service::fetch.
Describes one caller’s federation fetch policy.
event_id addresses Event, AuthEvent, AuthChain, and StateIds requests and
anchors Backfill; MissingEvents uses its event windows, while
TimestampToEvent uses ts and dir. Candidate, retry, fanout, and
validation settings also participate in single-flight identity.
Fields§
§op: OpFederation endpoint this fetch targets.
room_id: Option<OwnedRoomId>Room the fetch is scoped to, or None for an unscoped id-addressed
fetch.
event_id: Option<OwnedEventId>Target for Event, AuthEvent, AuthChain, and StateIds or Backfill anchor; unused by MissingEvents and TimestampToEvent.
ts: Option<MilliSecondsSinceUnixEpoch>Timestamp the Op::TimestampToEvent search starts from; None for
every other op.
dir: Option<Direction>Direction the Op::TimestampToEvent search runs; None for every
other op.
earliest_events: EventWindowBoundary events the requester already holds; an Op::MissingEvents
window stops its backward walk here. Empty for every other op.
latest_events: EventWindowFrontier events an Op::MissingEvents window fills the predecessors
of. Empty for every other op.
hint: Option<OwnedServerName>Server to try ahead of the ranked candidates.
candidates: CandidatesCaller-supplied candidate pool tried in place of the room-derived ranking; empty defers to the room-derived candidates.
room_version: Option<RoomVersionId>Room version for Event and AuthEvent validation; None assumes V11, and other operations do not consult it.
attempt_limit: Option<NonZeroUsize>Cap on candidate servers tried; None tries every candidate.
backfill_limit: Option<NonZeroUsize>Event count requested per Op::Backfill / Op::MissingEvents batch
response; defaults to 10.
fanout_growth: FanoutGrowthPer-round width curve for staged fan-out. Fixed(1) is sequential.
fanout_max_width: Option<NonZeroUsize>Per-round concurrency ceiling. None lets the curve run free, clamped
only by the candidate pool and attempt_limit; Some(n) caps each
round at n.
fanout_rounds: Option<NonZeroUsize>Optional per-call round cap; the global round cap still applies.
check_event_id: boolFor Event and AuthEvent, reject a response whose calculated event ID differs; other operations ignore this flag.
check_conforms: boolReject a response that is not well-formed JSON.
check_hashes: boolRequests combined event verification for Event and AuthEvent responses.
Either this flag or check_signature runs the verifier. Its returned
Verified status is currently ignored, so a content-hash mismatch with
valid signatures is accepted; other operations ignore the flag.
Accepted but not yet consulted; redaction-aware hash verification is unimplemented.
check_signature: boolFor Event and AuthEvent, reject verifier errors when either verification flag is enabled; other operations ignore this flag.
Implementations§
Source§impl Opts
impl Opts
Sourcepub fn new(op: Op, room_id: OwnedRoomId) -> Self
pub fn new(op: Op, room_id: OwnedRoomId) -> Self
Creates a fetch scoped to a room.
Validation gates start enabled, while the fixed width of one keeps attempts sequential unless the caller opts into staged fanout.
Sourcepub fn unscoped(op: Op) -> Self
pub fn unscoped(op: Op) -> Self
Creates an unscoped fetch for an ID-addressed operation.
Room-derived candidate ranking is skipped, leaving the hint, caller-supplied pool, and event ID origin as candidate sources.
Sourcefn with_room_id(op: Op, room_id: Option<OwnedRoomId>) -> Self
fn with_room_id(op: Op, room_id: Option<OwnedRoomId>) -> Self
All validation toggles default on; the caller relaxes them per request.
Sourcepub fn event_id(self, event_id: OwnedEventId) -> Self
pub fn event_id(self, event_id: OwnedEventId) -> Self
Sets the target event or Backfill anchor.
Event, AuthEvent, AuthChain, Backfill, and StateIds require this value; MissingEvents and TimestampToEvent do not consult it.
Sourcepub fn ts(self, ts: MilliSecondsSinceUnixEpoch) -> Self
pub fn ts(self, ts: MilliSecondsSinceUnixEpoch) -> Self
Sets the timestamp for a Op::TimestampToEvent search.
Other operations retain the value in coalescing identity but do not consult it during transport.
Sourcepub fn dir(self, dir: Direction) -> Self
pub fn dir(self, dir: Direction) -> Self
Sets the direction for a Op::TimestampToEvent search.
Other operations retain the value in coalescing identity but do not consult it during transport.
Sourcepub fn earliest_events<I>(self, earliest_events: I) -> Selfwhere
I: IntoIterator<Item = OwnedEventId>,
pub fn earliest_events<I>(self, earliest_events: I) -> Selfwhere
I: IntoIterator<Item = OwnedEventId>,
Sets the boundary where a Op::MissingEvents backward walk stops.
Only MissingEvents consults this window, whose order is normalized in the single-flight key.
Sourcepub fn latest_events<I>(self, latest_events: I) -> Selfwhere
I: IntoIterator<Item = OwnedEventId>,
pub fn latest_events<I>(self, latest_events: I) -> Selfwhere
I: IntoIterator<Item = OwnedEventId>,
Sets the frontier a Op::MissingEvents request fills behind.
Only MissingEvents consults this window, whose order is normalized in the single-flight key.
Sourcepub fn hint(self, hint: OwnedServerName) -> Self
pub fn hint(self, hint: OwnedServerName) -> Self
Adds a server ahead of the initial candidate order.
Reachability ranking may still drop or deprioritize it, and a failed attempt falls through to remaining candidates.
Sourcepub fn candidates<I>(self, candidates: I) -> Selfwhere
I: IntoIterator<Item = OwnedServerName>,
pub fn candidates<I>(self, candidates: I) -> Selfwhere
I: IntoIterator<Item = OwnedServerName>,
Supplies a candidate pool in place of room-derived discovery.
The supplied servers remain subject to eligibility filtering, deduplication, and peer-reachability ranking.
Sourcepub fn room_version(self, room_version: RoomVersionId) -> Self
pub fn room_version(self, room_version: RoomVersionId) -> Self
Sets the room version for Event and AuthEvent deep validation.
None keeps the V11 default, so callers from another room version must
set it to avoid spurious rejection. Other operations retain the value in
coalescing identity but do not consult it during validation.
Sourcepub fn attempt_limit(self, attempt_limit: NonZeroUsize) -> Self
pub fn attempt_limit(self, attempt_limit: NonZeroUsize) -> Self
Caps the number of candidate servers contacted.
None permits candidate exhaustion, and each round stays within the
remaining budget.
Sourcepub fn backfill_limit(self, backfill_limit: NonZeroUsize) -> Self
pub fn backfill_limit(self, backfill_limit: NonZeroUsize) -> Self
Sets the event limit for Backfill and MissingEvents batches.
Other operations retain the value in coalescing identity but do not send it on the wire.
Sourcepub fn fanout(self, growth: FanoutGrowth) -> Self
pub fn fanout(self, growth: FanoutGrowth) -> Self
Sets the per-round fanout width schedule.
The worker clamps each computed width to the candidate pool, optional ceiling, and remaining attempt budget.
Sourcepub fn fanout_max_width(self, max_width: NonZeroUsize) -> Self
pub fn fanout_max_width(self, max_width: NonZeroUsize) -> Self
Caps concurrent candidate attempts in each fanout round.
None lets the configured growth curve run until another budget binds.
Sourcepub fn fanout_rounds(self, rounds: NonZeroUsize) -> Self
pub fn fanout_rounds(self, rounds: NonZeroUsize) -> Self
Caps the number of fanout escalation rounds.
None leaves the per-call cap unset; the global round cap, candidate pool,
or attempt budget can still stop escalation.
Sourcepub fn fanout_for_op(self) -> Self
pub fn fanout_for_op(self) -> Self
Applies the operation’s recommended staged fanout profile.
Opts::new is sequential unless the caller opts in here. AuthEvent,
AuthChain, StateIds, and MissingEvents receive profiles; Event, Backfill,
and TimestampToEvent remain unchanged.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Opts
impl RefUnwindSafe for Opts
impl Send for Opts
impl Sync for Opts
impl Unpin for Opts
impl UnsafeUnpin for Opts
impl UnwindSafe for Opts
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ExpectInto for T
impl<T> ExpectInto for T
Source§impl<T> Expected for T
impl<T> Expected for T
Source§fn expected_add(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedAdd,
fn expected_add(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedAdd,
rhs with an expectation that the operation is valid. Read moreSource§fn expected_sub(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedSub,
fn expected_sub(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedSub,
rhs with an expectation that the operation is valid. Read moreSource§fn expected_mul(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedMul,
fn expected_mul(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedMul,
rhs with an expectation that the operation is valid. Read moreSource§fn expected_div(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedDiv,
fn expected_div(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedDiv,
rhs with an expectation that the operation is valid. Read moreSource§fn expected_rem(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedRem,
fn expected_rem(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedRem,
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreimpl<T> JsonCastable<CanonicalJsonValue> for T
impl<T> JsonCastable<Value> for T
§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute] value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi [Quirk] value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ServiceExt for T
impl<T> ServiceExt for T
§fn add_extension<T>(self, value: T) -> AddExtension<Self, T>where
Self: Sized,
fn add_extension<T>(self, value: T) -> AddExtension<Self, T>where
Self: Sized,
§fn compression(self) -> Compression<Self>where
Self: Sized,
fn compression(self) -> Compression<Self>where
Self: Sized,
§fn decompression(self) -> Decompression<Self>where
Self: Sized,
fn decompression(self) -> Decompression<Self>where
Self: Sized,
§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
§fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
§fn sensitive_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<SetSensitiveResponseHeaders<Self>>where
Self: Sized,
fn sensitive_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<SetSensitiveResponseHeaders<Self>>where
Self: Sized,
§fn sensitive_request_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<Self>where
Self: Sized,
fn sensitive_request_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<Self>where
Self: Sized,
§fn sensitive_response_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveResponseHeaders<Self>where
Self: Sized,
fn sensitive_response_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveResponseHeaders<Self>where
Self: Sized,
§fn override_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn override_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
§fn append_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn append_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
§fn insert_request_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn insert_request_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
§fn override_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn override_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
§fn append_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn append_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
§fn insert_response_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn insert_response_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
§fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>where
Self: Sized,
fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>where
Self: Sized,
500 Internal Server responses. Read moreSource§impl<T> Tried for T
impl<T> Tried for T
Source§fn try_add(self, rhs: Self) -> Result<Self, Error>where
Self: Sized + CheckedAdd,
fn try_add(self, rhs: Self) -> Result<Self, Error>where
Self: Sized + CheckedAdd,
rhs with checked arithmetic. Read moreSource§fn try_sub(self, rhs: Self) -> Result<Self, Error>where
Self: Sized + CheckedSub,
fn try_sub(self, rhs: Self) -> Result<Self, Error>where
Self: Sized + CheckedSub,
rhs with checked arithmetic. Read moreSource§fn try_mul(self, rhs: Self) -> Result<Self, Error>where
Self: Sized + CheckedMul,
fn try_mul(self, rhs: Self) -> Result<Self, Error>where
Self: Sized + CheckedMul,
rhs with checked arithmetic. Read more