Expand description
§AirServiceProvider
High-level API surface for Air service methods.
§RESPONSIBILITIES
- Service Facade: Provide convenient, high-level interface to Air daemon
- Authentication: Manage user authentication and credentials
- Updates: Check for and download application updates
- File Indexing: Query Air’s file search and indexing capabilities
- System Monitoring: Retrieve system metrics and health data
- Graceful Degradation: Handle Air unavailability with fallbacks
§ARCHITECTURAL ROLE
AirServiceProvider acts as a facade over the raw AirClient, providing:
- Simplified API for common operations
- Automatic error handling and translation
- Request ID generation for tracing
- Connection state management
Application ──► AirServiceProvider ──► AirClient ──► gRPC ──► Air Daemon§Dependencies
AirClient: Low-level gRPC clientuuid: For generating request identifiersCommonLibrary::Error::CommonError: Error types
§Dependents
Binary::Service::VineStart: Initializes Air serviceMountainEnvironment: Can delegate to Air when available
§IMPLEMENTATION
This implementation provides a fully functional provider that wraps the AirClient type with automatic request ID generation and error handling.
§ERROR HANDLING
All operations return Result<T, CommonError> with:
- Translated gRPC errors to appropriate CommonError types
- Request IDs included in logs for tracing
- Graceful fallback to local operations when Air is unavailable
§PERFORMANCE
- Request ID generation uses UUID v4 (cryptographically random)
- Thread-safe operations via
Arc<AirClient> - Non-blocking async operations via tokio
§VSCODE REFERENCE
Patterns borrowed from VS Code:
vs/platform/update/common/updateService.ts- Update managementvs/platform/authentication/common/authenticationService.ts- Auth handlingvs/platform/filesystem/common/filesystem.ts- File indexing
§MODULE CONTENTS
AirServiceProvider: Main provider structgenerate_request_id: Helper function for UUID generation
Structs§
- AirService
Provider - AirServiceProvider provides a high-level, convenient interface to the Air daemon service.
Functions§
- generate_
request_ id - Generates a unique request ID for Air operations.