MCPcopy Create free account
hub / github.com/erans/pgsqlite / execute_with_cached_connection

Method execute_with_cached_connection

src/session/connection_manager.rs:131–141  ·  view source on GitHub ↗

Execute a query with a cached connection Arc (avoids HashMap lookup)

(
        &self,
        conn_arc: &Arc<Mutex<Connection>>,
        f: F
    )

Source from the content-addressed store, hash-verified

129
130 /// Execute a query with a cached connection Arc (avoids HashMap lookup)
131 pub fn execute_with_cached_connection<F, R>(
132 &self,
133 conn_arc: &Arc<Mutex<Connection>>,
134 f: F
135 ) -> Result<R, PgSqliteError>
136 where
137 F: FnOnce(&Connection) -> Result<R, rusqlite::Error>
138 {
139 let conn = conn_arc.lock();
140 f(&conn).map_err(PgSqliteError::Sqlite)
141 }
142
143 /// Remove a connection when session ends
144 pub fn remove_connection(&self, session_id: &Uuid) {

Callers 3

Calls

no outgoing calls

Tested by

no test coverage detected