- Add gitignore and prettier configuration files for project scaffolding - Implement room access control service with project member verification - Create user access key management with CRUD operations and activity logging - Add accordion UI component for frontend expandable sections - Implement room AI configuration with list, upsert, and delete operations - Add AI event types for agent join/leave/status change tracking - Create streaming AI processing services for mode and react patterns - Build room AI service with model detection and idempotency handling - Integrate chat service orchestration for AI message processing - Add typing indicators and stream cancellation for AI interactions - Implement mention parsing and context extraction for AI agents
41 lines
1.3 KiB
Rust
41 lines
1.3 KiB
Rust
use std::sync::Arc;
|
|
|
|
#[derive(Clone)]
|
|
pub struct TransportMetrics {
|
|
pub messages_sent: Arc<std::sync::atomic::AtomicU64>,
|
|
pub messages_received: Arc<std::sync::atomic::AtomicU64>,
|
|
pub messages_failed: Arc<std::sync::atomic::AtomicU64>,
|
|
pub active_connections: Arc<std::sync::atomic::AtomicI64>,
|
|
}
|
|
|
|
impl TransportMetrics {
|
|
pub fn new() -> Self {
|
|
Self {
|
|
messages_sent: Arc::new(std::sync::atomic::AtomicU64::new(0)),
|
|
messages_received: Arc::new(std::sync::atomic::AtomicU64::new(0)),
|
|
messages_failed: Arc::new(std::sync::atomic::AtomicU64::new(0)),
|
|
active_connections: Arc::new(std::sync::atomic::AtomicI64::new(0)),
|
|
}
|
|
}
|
|
|
|
pub fn increment_sent(&self) {
|
|
self.messages_sent.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
|
|
}
|
|
|
|
pub fn increment_received(&self) {
|
|
self.messages_received.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
|
|
}
|
|
|
|
pub fn increment_failed(&self) {
|
|
self.messages_failed.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
|
|
}
|
|
|
|
pub fn increment_connections(&self) {
|
|
self.active_connections.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
|
|
}
|
|
|
|
pub fn decrement_connections(&self) {
|
|
self.active_connections.fetch_sub(1, std::sync::atomic::Ordering::Relaxed);
|
|
}
|
|
}
|