pub struct Executor<T> {
pub session: Arc<Session>,
/* private fields */
}
Expand description
Fields§
§session: Arc<Session>
Implementations§
source§impl<T: QueryCollection + Clone> Executor<T>
impl<T: QueryCollection + Clone> Executor<T>
sourcepub async fn new(session: Arc<Session>) -> Result<Self, ScyllaxError>
pub async fn new(session: Arc<Session>) -> Result<Self, ScyllaxError>
Creates a new Executor
from a Session
and a QueryCollection
.
sourcepub async fn execute_read<Q>(&self, query: Q) -> Result<Q::Output, ScyllaxError>
pub async fn execute_read<Q>(&self, query: Q) -> Result<Q::Output, ScyllaxError>
Executes a read query and returns the result.
sourcepub async fn read_task<Q>(
&self,
request_receiver: Receiver<ShardMessage<Q>>,
query_runner: Sender<QueryRunnerMessage<Q>>
)
pub async fn read_task<Q>( &self, request_receiver: Receiver<ShardMessage<Q>>, query_runner: Sender<QueryRunnerMessage<Q>> )
§internal
the read task is responsible for coalescing requests
sourcepub async fn read_query_runner<Q>(
&self,
query_receiver: Receiver<QueryRunnerMessage<Q>>
)where
Q: Query + ReadQuery + Hash + Send + Sync,
T: GetPreparedStatement<Q> + GetCoalescingSender<Q>,
pub async fn read_query_runner<Q>(
&self,
query_receiver: Receiver<QueryRunnerMessage<Q>>
)where
Q: Query + ReadQuery + Hash + Send + Sync,
T: GetPreparedStatement<Q> + GetCoalescingSender<Q>,
§internal
This function is repsonsible for receiving query requests, executing them, and sending the result back to the requestor.
It is spawned by the branch of Executor::read_task
that is responsible for coalescing requests.
sourcepub async fn execute_write<Q>(
&self,
query: Q
) -> Result<QueryResult, ScyllaxError>where
Q: WriteQuery,
T: GetPreparedStatement<Q>,
pub async fn execute_write<Q>(
&self,
query: Q
) -> Result<QueryResult, ScyllaxError>where
Q: WriteQuery,
T: GetPreparedStatement<Q>,
Executes a write query and returns the scylla::QueryResult
.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Executor<T>where
T: Freeze,
impl<T> !RefUnwindSafe for Executor<T>
impl<T> Send for Executor<T>where
T: Send,
impl<T> Sync for Executor<T>where
T: Sync,
impl<T> Unpin for Executor<T>where
T: Unpin,
impl<T> !UnwindSafe for Executor<T>
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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 more