Skip to content

Commit

Permalink
session: rename {query,execute}_inner to %
Browse files Browse the repository at this point in the history
As {query,execute} methods got the _unpaged prefix, now the inner
methods can drop the _inner prefix. This gives us one subtle advantage:
users now see "method {query,execute} is private" instead of
"{query,execute} method not found", which makes them more likely to
think that the API was changed on purpose. Assuming that users see
docstrings of private methods when they hover a call to them, this also
lets them read the new docstrings of {query,execute} that explain the
reasons behind the change and point to proper public methods:
{query,execute}_{unpaged,single_page,iter}.
  • Loading branch information
wprzytula committed Aug 26, 2024
1 parent a15355e commit ad4f9ab
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions scylla/src/transport/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ impl Session {
) -> Result<QueryResult, QueryError> {
let query = query.into();
let (result, paging_state_response) = self
.query_inner(&query, values, None, PagingState::start())
.query(&query, values, None, PagingState::start())
.await?;
if !paging_state_response.finished() {
let err_msg = "Unpaged unprepared query returned a non-empty paging state! This is a driver-side or server-side bug.";
Expand Down Expand Up @@ -653,7 +653,7 @@ impl Session {
paging_state: PagingState,
) -> Result<(QueryResult, PagingStateResponse), QueryError> {
let query = query.into();
self.query_inner(&query, values, Some(query.get_page_size()), paging_state)
self.query(&query, values, Some(query.get_page_size()), paging_state)
.await
}

Expand All @@ -668,7 +668,7 @@ impl Session {
/// * `query` - query to be performed
/// * `values` - values bound to the query
/// * `paging_state` - previously received paging state or [PagingState::start()]
async fn query_inner(
async fn query(
&self,
query: &Query,
values: impl SerializeRow,
Expand Down Expand Up @@ -1010,7 +1010,7 @@ impl Session {
) -> Result<QueryResult, QueryError> {
let serialized_values = prepared.serialize_values(&values)?;
let (result, paging_state) = self
.execute_inner(prepared, &serialized_values, None, PagingState::start())
.execute(prepared, &serialized_values, None, PagingState::start())
.await?;
if !paging_state.finished() {
let err_msg = "Unpaged prepared query returned a non-empty paging state! This is a driver-side or server-side bug.";
Expand All @@ -1028,7 +1028,7 @@ impl Session {
) -> Result<(QueryResult, PagingStateResponse), QueryError> {
let serialized_values = prepared.serialize_values(&values)?;
let page_size = prepared.get_page_size();
self.execute_inner(prepared, &serialized_values, Some(page_size), paging_state)
self.execute(prepared, &serialized_values, Some(page_size), paging_state)
.await
}

Expand All @@ -1038,7 +1038,7 @@ impl Session {
/// * `prepared` - a statement prepared with [prepare](crate::transport::session::Session::prepare)
/// * `values` - values bound to the statement
/// * `paging_state` - paging state from the previous execution or [PagingState::start()]
async fn execute_inner(
async fn execute(
&self,
prepared: &PreparedStatement,
serialized_values: &SerializedValues,
Expand Down

0 comments on commit ad4f9ab

Please sign in to comment.