How aosedge/aos_common works
Main Components
• Common Infrastructure:
• Core packages like “aoserrors” (error handling) and “aostypes” (shared types).
• gRPC API and Protobuf Definitions:
• Under the “api” directory, you have separate submodules (cloudprotocol, communicationmanager, iamanager, servicemanager, updatemanager, visprotocol) that define the gRPC services and message contracts.
• That “api/common” contains generated protobuf Go files, which should be shown as part of the API layer.
• Specialized Functionality Modules:
• Modules handling system-level logic such as “image”, “journalalerts”, “migration”, “partition”, “resourcemonitor”, “spaceallocator”, and “tpmkey”.
• Client/Server Components:
• “iamclient” and the wsclient/wsserver packages serve as client and server implementations, likely used for communication with identity management or websocket interactions.
• Utility Libraries:
• The “utils” directory covers a wide variety of helper functionalities (for actions, alerts, file system operations, cryptographic operations, gRPC connection helpers, retry logic, semantic versioning, etc.). These are secondary components that support almost every aspect of the system.
• Build and CI/CD:
Relationships and Interactions
• API & gRPC Services:
• Library Usage:
• Derived packages such as “iamclient”, “wsclient”, and “wsserver” interact with the exposed APIs and common utilities for implementing business logic.
• Utilities Integration:
• Internal Components:
• The specialized modules (like resourcemonitor or spaceallocator) may also expose specific services or handle internal state changes that can be connected to the overall flows in the system.
Architectural Patterns & Design Principles
• Modular Design:
• The repository is clearly organized in a modular fashion, with dedicated directories for each area of responsibility.
• Interface-Based Communication:
• With its emphasis on gRPC and protobuf contracts, the design likely uses clear interface definitions to decouple service implementations.
• Reusability and Composability:
• The common utilities (within “utils” and the standalone packages) adhere to design principles that encourage reusability across different system components.
Relevant Technologies and Their Roles
• Go Language:
• The primary language of the project.
• gRPC & Protobuf:
• Used for defining service contracts (note the generate_api.sh script which is used to generate gRPC code from proto definitions).
• CI/CD Pipelines:
• GitHub Actions (.github/workflows) and GitLab CI (.gitlab-ci.yml) are used for continuous integration, testing, and quality control.
• Testing:
• Almost every module has accompanying _test.go files, indicating a strong focus on unit testing.