Module Air

Module Air 

Source
Expand description

§Air (Air Integration Module)

RESPONSIBILITIES:

  • Provides gRPC client connectivity to the Air daemon service
  • Implements Air service methods for:
    • Update management and distribution
    • Authentication and credential management
    • File indexing and search operations
    • System monitoring and metrics collection
  • Handles connection management and error translation to CommonError
  • Wraps client in Arc for shared access across the application

ARCHITECTURAL ROLE:

  • Integration point with the Air background service (daemon)
  • Used by multiple Mountain components:
  • UpdateService for self-updates
  • Connection is optional; Mountain can function without Air (graceful degradation)
  • Service discovery and health checking via gRPC

MODULE STRUCTURE:

  • AirClient - gRPC client wrapper with connection management
  • AirServiceProvider - high-level provider with automatic request ID generation
  • AirServiceTypesStub - stub types for when Air library is unavailable (legacy)

CONNECTION PATTERNS:

  • Uses tonic gRPC client for transport
  • Connection establishment via connect() method
  • Health checking with timeout protection
  • Thread-safe operations via Arc<AirClient>

ERROR HANDLING:

  • All gRPC errors translated to CommonError::IPCError
  • Connection failures logged and return error
  • Service unavailability handled gracefully (return error, caller decides fallback)

PERFORMANCE:

  • gRPC channels are expensive; reuse via Arc<AirClient>
  • Non-blocking async operations via tokio
  • Request ID generation for tracing

VS CODE REFERENCE:

  • vs/platform/telemetry/common/telemetry.ts - telemetry/analytics service pattern
  • vs/platform/update/common/update.ts - update service integration
  • vs/workbench/services/search/common/search.ts - search service architecture

TODO:

  • Implement connection retry with exponential backoff
  • Add connection pooling for multiple concurrent requests
  • Implement request caching for frequently accessed data (auth tokens, etc.)
  • Add metrics collection for Air service calls (latency, success rate, errors)
  • Implement fallback strategies when Air unavailable (local search, etc.)
  • Support for multiple Air daemons (load balancing/failover)
  • Add request timeout configuration (configurable per operation type)
  • Implement request/response logging for debugging
  • Add telemetry for Air service health and usage
  • Implement bidirectional streaming for real-time updates

MODULE CONTENTS:

  • Re-exports: AirClient, AirServiceProvider, response types, and helper functions

Re-exports§

pub use AirClient::AirClient as Client;
pub use AirClient::AirMetrics;
pub use AirClient::AirStatus;
pub use AirClient::DEFAULT_AIR_SERVER_ADDRESS;
pub use AirClient::DownloadStream;
pub use AirClient::DownloadStreamChunk;
pub use AirClient::ExtendedFileInfo;
pub use AirClient::FileInfo;
pub use AirClient::FileResult;
pub use AirClient::IndexInfo;
pub use AirClient::ResourceUsage;
pub use AirClient::UpdateInfo;
pub use AirServiceProvider::generate_request_id;

Modules§

AirClient
AirClient
AirServiceProvider
AirServiceProvider
AirServiceTypesStubDeprecated
Air Service Types Stub