pub struct LocalTransport { /* private fields */ }Available on crate feature
code only.Expand description
In-process collaboration transport backed by a broadcast channel.
This is the phase 1 default transport. It keeps all collaboration local
to the process while preserving the same CollaborationTransport trait
contract that a future A2A-backed transport would implement.
§Example
use adk_code::a2a_compat::{CollaborationTransport, LocalTransport};
use adk_code::{CollaborationEvent, CollaborationEventKind};
let transport = LocalTransport::new(128);
let mut rx = transport.subscribe();
transport.publish(CollaborationEvent::new(
"c1", "topic", "agent", CollaborationEventKind::WorkPublished,
)).await.unwrap();
let event = rx.recv().await.unwrap();
assert_eq!(event.correlation_id, "c1");Implementations§
Source§impl LocalTransport
impl LocalTransport
Sourcepub fn new(capacity: usize) -> LocalTransport
pub fn new(capacity: usize) -> LocalTransport
Create a new local transport with the given channel capacity.
The capacity determines how many events can be buffered before slow subscribers start lagging. A reasonable default is 256.
Trait Implementations§
Source§impl CollaborationTransport for LocalTransport
impl CollaborationTransport for LocalTransport
Source§fn publish<'life0, 'async_trait>(
&'life0 self,
event: CollaborationEvent,
) -> Pin<Box<dyn Future<Output = Result<(), ExecutionError>> + Send + 'async_trait>>where
'life0: 'async_trait,
LocalTransport: 'async_trait,
fn publish<'life0, 'async_trait>(
&'life0 self,
event: CollaborationEvent,
) -> Pin<Box<dyn Future<Output = Result<(), ExecutionError>> + Send + 'async_trait>>where
'life0: 'async_trait,
LocalTransport: 'async_trait,
Publish a collaboration event to all subscribers.
Source§fn subscribe(&self) -> Box<dyn CollaborationReceiver>
fn subscribe(&self) -> Box<dyn CollaborationReceiver>
Create a new receiver for collaboration events.
Source§impl Debug for LocalTransport
impl Debug for LocalTransport
Source§impl Default for LocalTransport
impl Default for LocalTransport
Source§fn default() -> LocalTransport
fn default() -> LocalTransport
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for LocalTransport
impl RefUnwindSafe for LocalTransport
impl Send for LocalTransport
impl Sync for LocalTransport
impl Unpin for LocalTransport
impl UnsafeUnpin for LocalTransport
impl UnwindSafe for LocalTransport
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