Struct warpgrapher::engine::loader::NodeLoader
source · [−]pub struct NodeLoader<RequestCtx: RequestContext> { /* private fields */ }
Implementations
sourceimpl<RequestCtx> NodeLoader<RequestCtx> where
RequestCtx: RequestContext,
impl<RequestCtx> NodeLoader<RequestCtx> where
RequestCtx: RequestContext,
pub fn new(
pool: <<RequestCtx as RequestContext>::DBEndpointType as DatabaseEndpoint>::PoolType,
info: Info
) -> Self
Trait Implementations
sourceimpl<RequestCtx> Fetcher for NodeLoader<RequestCtx> where
RequestCtx: RequestContext,
impl<RequestCtx> Fetcher for NodeLoader<RequestCtx> where
RequestCtx: RequestContext,
type Key = NodeLoaderKey
type Key = NodeLoaderKey
The type used to look up a single value in a batch.
type Value = Node<RequestCtx>
type Value = Node<RequestCtx>
The type returned in a batch. Value
is usually a single database
record, but could also be a more sophisticated type, such as a
Vec
of values for a Fetcher
that deals with one-to-many
relationships. Read more
sourcefn fetch<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
keys: &'life1 [NodeLoaderKey],
values: &'life2 mut Cache<'life3, NodeLoaderKey, Node<RequestCtx>>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
fn fetch<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
keys: &'life1 [NodeLoaderKey],
values: &'life2 mut Cache<'life3, NodeLoaderKey, Node<RequestCtx>>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
Retrieve the values associated with the given keys, and insert them into
values
if found. If Ok(_)
is returned, then any keys not inserted
into values
will be marked as “not found” (meaning any future attempts
to retrieve them will fail). If Err(_)
is returned, then the caller(s)
waiting on the batch will receive a LoadError::FetchError
with the message from returned error (note that any values inserted into
values
before the Err(_)
is returned will still be cached). See the
Batcher
docs for more details. Read more
Auto Trait Implementations
impl<RequestCtx> RefUnwindSafe for NodeLoader<RequestCtx> where
<<RequestCtx as RequestContext>::DBEndpointType as DatabaseEndpoint>::PoolType: RefUnwindSafe,
impl<RequestCtx> Send for NodeLoader<RequestCtx>
impl<RequestCtx> Sync for NodeLoader<RequestCtx>
impl<RequestCtx> Unpin for NodeLoader<RequestCtx> where
<<RequestCtx as RequestContext>::DBEndpointType as DatabaseEndpoint>::PoolType: Unpin,
impl<RequestCtx> UnwindSafe for NodeLoader<RequestCtx> where
<<RequestCtx as RequestContext>::DBEndpointType as DatabaseEndpoint>::PoolType: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more