pub enum QueryTarget<'a> {
Database(&'a Database),
Transaction(&'a TransactionContext),
Proxy(&'a ProxyQueryConnection),
}Expand description
Where one terminal runs.
Variants§
Database(&'a Database)
A direct database; the terminal opens its own read transaction.
Transaction(&'a TransactionContext)
A transaction the caller opened.
Proxy(&'a ProxyQueryConnection)
A TypeBridge server.
Implementations§
Source§impl QueryTarget<'_>
impl QueryTarget<'_>
Sourcepub const fn answer_limits(&self) -> Option<QueryExecutionResourceLimits>
pub const fn answer_limits(&self) -> Option<QueryExecutionResourceLimits>
The answer-limit ceiling of the target’s connection, if it has one.
Sourcepub const fn constrain(
&self,
requested: QueryExecutionResourceLimits,
) -> QueryExecutionResourceLimits
pub const fn constrain( &self, requested: QueryExecutionResourceLimits, ) -> QueryExecutionResourceLimits
requested constrained by the connection’s ceiling: the policy a
session on this target runs under. Sessions apply it when they are
created, so their deadline already honours the ceiling.
Sourcepub fn budget(
&self,
resources: QueryExecutionResourceLimits,
deadline: QueryExecutionDeadline,
) -> (QueryExecutionResourceLimits, QueryExecutionDeadline)
pub fn budget( &self, resources: QueryExecutionResourceLimits, deadline: QueryExecutionDeadline, ) -> (QueryExecutionResourceLimits, QueryExecutionDeadline)
The resources and deadline a terminal on this target runs under:
resources constrained by the connection’s ceiling, and the earlier
of deadline and the ceiling’s timeout. A binding that materializes
the result itself uses the same budget.
Sourcepub async fn execute(
&self,
registry: &DescriptorRegistry,
validated: ValidatedMatchRequest,
resources: QueryExecutionResourceLimits,
cancellation: &AnswerCancellation,
deadline: QueryExecutionDeadline,
) -> Result<(ValidatedMatchRequest, ValidatedMatchResult), QueryTargetError>
pub async fn execute( &self, registry: &DescriptorRegistry, validated: ValidatedMatchRequest, resources: QueryExecutionResourceLimits, cancellation: &AnswerCancellation, deadline: QueryExecutionDeadline, ) -> Result<(ValidatedMatchRequest, ValidatedMatchResult), QueryTargetError>
Run one validated request under resources and deadline, both of
which this call constrains by the connection’s ceiling again, so a
caller cannot exceed it.
§Errors
Returns the direct, proxy, or interruption failure. A proxy connection
without the built-in route refuses with
proxy_exchange_caller_owned; use ProxyQueryConnection::prepare.
Trait Implementations§
Source§impl<'a> Clone for QueryTarget<'a>
impl<'a> Clone for QueryTarget<'a>
impl<'a> Copy for QueryTarget<'a>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for QueryTarget<'a>
impl<'a> !UnwindSafe for QueryTarget<'a>
impl<'a> Freeze for QueryTarget<'a>
impl<'a> Send for QueryTarget<'a>
impl<'a> Sync for QueryTarget<'a>
impl<'a> Unpin for QueryTarget<'a>
impl<'a> UnsafeUnpin for QueryTarget<'a>
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> 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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request