pub struct ResourceConnection<'id, S, P, C> { /* private fields */ }Expand description
A connection paired with its generative statement and portal namespace.
Implementations§
Source§impl<'id, S, P, C> ResourceConnection<'id, S, P, C>
impl<'id, S, P, C> ResourceConnection<'id, S, P, C>
Sourcepub const fn connection(&self) -> &Conn<S, P, C>
pub const fn connection(&self) -> &Conn<S, P, C>
Borrows the typed connection for transport-only operations such as buffering a frame returned by this wrapper.
Sourcepub const fn connection_mut(&mut self) -> &mut Conn<S, P, C>
pub const fn connection_mut(&mut self) -> &mut Conn<S, P, C>
Mutably borrows the typed connection for transport-only operations such as buffering and flushing returned frames.
Sourcepub fn statement_is_live(&self, statement: &PreparedStatement<'id>) -> bool
pub fn statement_is_live(&self, statement: &PreparedStatement<'id>) -> bool
Reports whether a prepared-statement token is still live in this connection’s namespace.
Sourcepub fn portal_is_live(&self, portal: &Portal<'id>) -> bool
pub fn portal_is_live(&self, portal: &Portal<'id>) -> bool
Reports whether a portal token is still live in this connection’s namespace.
Sourcepub fn into_connection(self) -> Conn<S, P, C>
pub fn into_connection(self) -> Conn<S, P, C>
Deliberately leaves resource-aware handling while retaining typestate.
Source§impl<'id, S, C> ResourceConnection<'id, S, Building, C>
impl<'id, S, C> ResourceConnection<'id, S, Building, C>
Sourcepub fn prepare(
self,
client_name: Bytes,
upstream_name: Bytes,
query: Bytes,
parameter_types: Vec<u32>,
) -> PrepareResult<'id, S>
pub fn prepare( self, client_name: Bytes, upstream_name: Bytes, query: Bytes, parameter_types: Vec<u32>, ) -> PrepareResult<'id, S>
Creates and sends a branded prepared statement on this connection.
§Errors
Returns namespace or wire reconstruction errors.
Sourcepub fn bind(
self,
statement: &PreparedStatement<'id>,
client_name: Bytes,
upstream_name: Bytes,
parameter_formats: Vec<i16>,
parameters: Vec<Option<Bytes>>,
result_formats: Vec<i16>,
) -> BindResult<'id, S>
pub fn bind( self, statement: &PreparedStatement<'id>, client_name: Bytes, upstream_name: Bytes, parameter_formats: Vec<i16>, parameters: Vec<Option<Bytes>>, result_formats: Vec<i16>, ) -> BindResult<'id, S>
Creates and sends a branded portal on this connection.
§Errors
Returns namespace or wire reconstruction errors.
Sourcepub fn describe_statement(
self,
statement: &PreparedStatement<'id>,
) -> Result<(Self, Frame), ResourceProtocolError>
pub fn describe_statement( self, statement: &PreparedStatement<'id>, ) -> Result<(Self, Frame), ResourceProtocolError>
Describes only a live statement from this connection.
§Errors
Returns an error for a stale statement or invalid wire value.
Sourcepub fn close_statement(
self,
statement: PreparedStatement<'id>,
) -> Result<(Self, Frame), ResourceProtocolError>
pub fn close_statement( self, statement: PreparedStatement<'id>, ) -> Result<(Self, Frame), ResourceProtocolError>
Closes a live statement and invalidates its token.
§Errors
Returns an error for a stale statement or invalid wire value.
Sourcepub fn close_portal(
self,
portal: Portal<'id>,
) -> Result<(Self, Frame), ResourceProtocolError>
pub fn close_portal( self, portal: Portal<'id>, ) -> Result<(Self, Frame), ResourceProtocolError>
Closes a live portal and invalidates its token.
§Errors
Returns an error for a stale portal or invalid wire value.
Sourcepub fn sync(self) -> (ResourceConnection<'id, S, AwaitingReady, C>, Frame)
pub fn sync(self) -> (ResourceConnection<'id, S, AwaitingReady, C>, Frame)
Emits Sync while retaining the namespace through response consumption.
Source§impl<'id, S, C> ResourceConnection<'id, S, Ready, C>
impl<'id, S, C> ResourceConnection<'id, S, Ready, C>
Sourcepub fn begin_extended(self) -> ResourceConnection<'id, S, Building, C>
pub fn begin_extended(self) -> ResourceConnection<'id, S, Building, C>
Begins another extended-query cycle with the same resource namespace.
Sourcepub fn query(
self,
query: &[u8],
) -> Result<(ResourceConnection<'id, S, SimpleQuery, Dirty>, Frame), ResourceProtocolError>
pub fn query( self, query: &[u8], ) -> Result<(ResourceConnection<'id, S, SimpleQuery, Dirty>, Frame), ResourceProtocolError>
Begins a simple query and invalidates the unnamed prepared statement.
§Errors
Returns an error if the query cannot be reconstructed on the wire.
Source§impl<'id, S, C> ResourceConnection<'id, S, BoundBuilding, C>
impl<'id, S, C> ResourceConnection<'id, S, BoundBuilding, C>
Sourcepub fn prepare(
self,
client_name: Bytes,
upstream_name: Bytes,
query: Bytes,
parameter_types: Vec<u32>,
) -> BoundPrepareResult<'id, S>
pub fn prepare( self, client_name: Bytes, upstream_name: Bytes, query: Bytes, parameter_types: Vec<u32>, ) -> BoundPrepareResult<'id, S>
Creates another prepared statement while retaining executable portals.
§Errors
Returns namespace or wire reconstruction errors.
Sourcepub fn bind(
self,
statement: &PreparedStatement<'id>,
client_name: Bytes,
upstream_name: Bytes,
parameter_formats: Vec<i16>,
parameters: Vec<Option<Bytes>>,
result_formats: Vec<i16>,
) -> RebindResult<'id, S>
pub fn bind( self, statement: &PreparedStatement<'id>, client_name: Bytes, upstream_name: Bytes, parameter_formats: Vec<i16>, parameters: Vec<Option<Bytes>>, result_formats: Vec<i16>, ) -> RebindResult<'id, S>
Creates another portal while retaining prior live portals.
§Errors
Returns namespace or wire reconstruction errors.
Sourcepub fn describe_statement(
self,
statement: &PreparedStatement<'id>,
) -> Result<(Self, Frame), ResourceProtocolError>
pub fn describe_statement( self, statement: &PreparedStatement<'id>, ) -> Result<(Self, Frame), ResourceProtocolError>
Describes only a live statement from this connection.
§Errors
Returns an error for a stale statement or invalid wire value.
Sourcepub fn describe_portal(
self,
portal: &Portal<'id>,
) -> Result<(Self, Frame), ResourceProtocolError>
pub fn describe_portal( self, portal: &Portal<'id>, ) -> Result<(Self, Frame), ResourceProtocolError>
Describes only a live portal from this connection.
§Errors
Returns an error for a stale portal or invalid wire value.
Sourcepub fn execute(
self,
portal: &Portal<'id>,
max_rows: i32,
) -> Result<(Self, Frame), ResourceProtocolError>
pub fn execute( self, portal: &Portal<'id>, max_rows: i32, ) -> Result<(Self, Frame), ResourceProtocolError>
Sends an execute which can name only a live portal from this connection.
§Errors
Returns an error for a stale portal or invalid wire value.
Sourcepub fn close_statement(
self,
statement: PreparedStatement<'id>,
) -> Result<(Self, Frame), ResourceProtocolError>
pub fn close_statement( self, statement: PreparedStatement<'id>, ) -> Result<(Self, Frame), ResourceProtocolError>
Closes a live statement and invalidates its token.
§Errors
Returns an error for a stale statement or invalid wire value.
Sourcepub fn close_portal(
self,
portal: Portal<'id>,
) -> Result<(Self, Frame), ResourceProtocolError>
pub fn close_portal( self, portal: Portal<'id>, ) -> Result<(Self, Frame), ResourceProtocolError>
Closes a live portal and invalidates its token.
§Errors
Returns an error for a stale portal or invalid wire value.
Sourcepub fn sync(self) -> (ResourceConnection<'id, S, AwaitingReady, C>, Frame)
pub fn sync(self) -> (ResourceConnection<'id, S, AwaitingReady, C>, Frame)
Emits Sync while retaining the namespace through response consumption.
Source§impl<'id, S, C> ResourceConnection<'id, S, AwaitingReady, C>
impl<'id, S, C> ResourceConnection<'id, S, AwaitingReady, C>
Sourcepub fn offer(self, item: SessionItem) -> ResourceAwaitingTransition<'id, S, C>
pub fn offer(self, item: SessionItem) -> ResourceAwaitingTransition<'id, S, C>
Consumes one backend response while retaining the branded namespace.
Source§impl<'id, S, C> ResourceConnection<'id, S, Draining, C>
impl<'id, S, C> ResourceConnection<'id, S, Draining, C>
Sourcepub fn offer(self, item: SessionItem) -> ResourceDrainingTransition<'id, S, C>
pub fn offer(self, item: SessionItem) -> ResourceDrainingTransition<'id, S, C>
Drains one backend response after an error while retaining resources.