Expand description
§AirClient
gRPC client wrapper for the Air daemon service, providing Mountain with access to cloud-based backend services including updates, authentication, file indexing, and system monitoring.
IMPORTANT: The gRPC client is wrapped in Arc<Mutex<>> to enable safe concurrent access from multiple threads, as tonic’s client methods require mutable access.
§RESPONSIBILITIES
- Connection Management: Manage gRPC connection lifecycle to Air service
- Service Methods: Implement all Air service RPC methods
- Error Translation: Convert tonic/transport errors to CommonError
- Connection Retry: (Optional) Provide automatic retry with backoff
- Health Checking: Monitor Air service availability
§ARCHITECTURAL ROLE
AirClient serves as the primary interface between Mountain and the Air backend service:
Mountain (Frontend) ──► AirClient ──► gRPC ──► Air Daemon (Backend)§Position in Mountain
- Communication module for Air integration
- Part of the service management layer
- Features-gated behind
AirIntegrationfeature flag
§IMPLEMENTATION
This implementation uses the generated gRPC client from the Air library:
AirLibrary::Vine::Generated::air_service_client::AirServiceClient
§CONFIGURATION
- Default Address:
[::1]:50053(configurable via constructor) - Transport: gRPC over TCP/IP with optional TLS
- Connection Pooling: (TODO) Implement for multiple concurrent requests
§ERROR HANDLING
All methods return Result<T, CommonError> with appropriate error types:
IPCError: gRPC communication failuresSerializationError: Message encoding/decoding failuresUnknown: Uncategorized errors
§THREAD SAFETY
AirClientisCloneable and can be shared across threads viaArc<AirClient>- The underlying tonic client is thread-safe
- All public methods are safe to call from multiple threads
§PERFORMANCE CONSIDERATIONS
- Connection establishment is lazy (deferred until first use)
- (TODO) Implement connection pooling for high-throughput scenarios
- (TODO) Add request caching for frequently accessed data
- (TODO) Implement request timeout configuration
§TODO
High Priority:
- Add connection retry with exponential backoff
- Implement proper connection pooling
Medium Priority:
- Add request/response logging for debugging
- Implement connection health monitoring
- Add metrics collection for RPC calls
§MODULE CONTENTS
AirClient: Main client structDEFAULT_AIR_SERVER_ADDRESS: Default gRPC server address constant
Structs§
- AirClient
- Air gRPC client wrapper that handles connection to the Air daemon service. This provides a clean interface for Mountain to interact with Air’s capabilities including update management, authentication, file indexing, and system monitoring.
- AirMetrics
- Metrics from the Air daemon.
- AirStatus
- Status of the Air daemon.
- Download
Stream - Wrapper for an asynchronous download stream.
- Download
Stream Chunk - Chunk of data from a streaming download.
- Extended
File Info - Extended file information.
- File
Info - Information about a downloaded file.
- File
Result - Result of a file search.
- Index
Info - Information about file indexing.
- Resource
Usage - Resource usage information.
- Update
Info - Information about an available update.
Constants§
- DEFAULT_
AIR_ SERVER_ ADDRESS - Default gRPC server address for the Air daemon.
Traits§
- Into
Request 🔒Ext - Helper trait for converting types to tonic::Request