pub struct GitHubTaskStorage { /* private fields */ }Expand description
GitHub Issues task storage implementation
Implementations§
Trait Implementations§
Source§impl TaskStorage for GitHubTaskStorage
impl TaskStorage for GitHubTaskStorage
Source§fn save_task<'life0, 'async_trait>(
&'life0 self,
task: A2ATask,
) -> Pin<Box<dyn Future<Output = Result<u64, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn save_task<'life0, 'async_trait>(
&'life0 self,
task: A2ATask,
) -> Pin<Box<dyn Future<Output = Result<u64, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn get_task<'life0, 'async_trait>(
&'life0 self,
id: u64,
) -> Pin<Box<dyn Future<Output = Result<Option<A2ATask>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_task<'life0, 'async_trait>(
&'life0 self,
id: u64,
) -> Pin<Box<dyn Future<Output = Result<Option<A2ATask>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn list_tasks<'life0, 'async_trait>(
&'life0 self,
filter: TaskFilter,
) -> Pin<Box<dyn Future<Output = Result<Vec<A2ATask>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_tasks<'life0, 'async_trait>(
&'life0 self,
filter: TaskFilter,
) -> Pin<Box<dyn Future<Output = Result<Vec<A2ATask>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List tasks with optional filtering
Uses GitHub API label filtering for status, combined with in-memory filtering for other criteria.
§Arguments
filter- Filter criteria (status, context_id, agent, updated_after, limit)
§Returns
List of tasks matching the filter
§Performance
- Status filtering: API-level (reduces network transfer)
- Other filters: In-memory (applied after fetch)
Source§fn list_tasks_paginated<'life0, 'async_trait>(
&'life0 self,
filter: TaskFilter,
) -> Pin<Box<dyn Future<Output = Result<PaginatedResult<A2ATask>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_tasks_paginated<'life0, 'async_trait>(
&'life0 self,
filter: TaskFilter,
) -> Pin<Box<dyn Future<Output = Result<PaginatedResult<A2ATask>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List tasks with cursor-based pagination
Implements cursor-based pagination for efficient navigation through large task lists. Cursors encode the (id, updated_at) of the last item, ensuring stable pagination.
§Arguments
filter- Filter criteria including optional cursor
§Returns
PaginatedResult with items, next_cursor, previous_cursor, and has_more flag
§Pagination Strategy
- Forward: Fetch limit+1 items after cursor to determine if has_more
- Backward: Fetch limit+1 items before cursor
- First page: No cursor provided, start from beginning
§Examples
use miyabi_a2a::{GitHubTaskStorage, TaskStorage, TaskFilter};
let storage = GitHubTaskStorage::new("token".into(), "owner".into(), "repo".into())?;
// First page (50 items)
let filter = TaskFilter { limit: Some(50), ..Default::default() };
let page1 = storage.list_tasks_paginated(filter).await?;
// Navigate to next page
if let Some(cursor) = page1.next_cursor {
let filter = TaskFilter { cursor: Some(cursor), limit: Some(50), ..Default::default() };
let page2 = storage.list_tasks_paginated(filter).await?;
}Source§fn update_task<'life0, 'async_trait>(
&'life0 self,
id: u64,
update: TaskUpdate,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn update_task<'life0, 'async_trait>(
&'life0 self,
id: u64,
update: TaskUpdate,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Update an existing task
Updates task fields via GitHub Issue API:
- Description: Updates Issue body
- Status: Updates labels (removes old status label, adds new one)
Status update process:
- Fetch current Issue to get existing labels
- Filter out old status labels (a2a:pending, a2a:in-progress, etc.)
- Add new status label
- Update Issue with new label set
§Arguments
id- GitHub Issue numberupdate- Fields to update
§Returns
Ok(()) on success
Auto Trait Implementations§
impl !Freeze for GitHubTaskStorage
impl !RefUnwindSafe for GitHubTaskStorage
impl Send for GitHubTaskStorage
impl Sync for GitHubTaskStorage
impl Unpin for GitHubTaskStorage
impl !UnwindSafe for GitHubTaskStorage
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