MCPcopy Create free account
hub / github.com/dtormoen/tsk-tsk / get_task

Method get_task

src/context/task_storage.rs:339–355  ·  view source on GitHub ↗
(
        &self,
        id: &str,
    )

Source from the content-addressed store, hash-verified

337 }
338
339 pub async fn get_task(
340 &self,
341 id: &str,
342 ) -> Result<Option<Task>, Box<dyn std::error::Error + Send + Sync>> {
343 let conn = Arc::clone(&self.conn);
344 let id = id.to_string();
345 tokio::task::spawn_blocking(move || {
346 let conn = conn.lock().map_err(|e| format!("Lock error: {e}"))?;
347 let mut stmt = conn.prepare("SELECT * FROM tasks WHERE id = ?1")?;
348 let mut rows = stmt.query_map(rusqlite::params![id], row_to_task)?;
349 match rows.next() {
350 Some(row) => Ok(Some(row?)),
351 None => Ok(None),
352 }
353 })
354 .await?
355 }
356
357 pub async fn list_tasks(&self) -> Result<Vec<Task>, Box<dyn std::error::Error + Send + Sync>> {
358 let conn = Arc::clone(&self.conn);

Callers 15

test_store_and_runFunction · 0.80
delete_taskMethod · 0.80
retry_taskMethod · 0.80
test_delete_taskFunction · 0.80
test_retry_taskFunction · 0.80
executeMethod · 0.80
test_cancel_queued_taskFunction · 0.80
test_cancel_running_taskFunction · 0.80
wait_for_tasksFunction · 0.80

Calls

no outgoing calls