Module AirServiceProvider

Module AirServiceProvider 

Source
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 client
  • uuid: For generating request identifiers
  • CommonLibrary::Error::CommonError: Error types

§Dependents

  • Binary::Service::VineStart: Initializes Air service
  • MountainEnvironment: 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 management
  • vs/platform/authentication/common/authenticationService.ts - Auth handling
  • vs/platform/filesystem/common/filesystem.ts - File indexing

§MODULE CONTENTS

Structs§

AirServiceProvider
AirServiceProvider provides a high-level, convenient interface to the Air daemon service.

Functions§

generate_request_id
Generates a unique request ID for Air operations.