mirror of
https://github.com/fleetdm/fleet
synced 2026-05-14 20:48:35 +00:00
For #26219 Refactoring the interface between Android service and Android datastore to use 1 common datastore interface: `fleet.AndroidDatastore` These changes are based on feedback from the recent Backend Sync. ```mermaid --- title: Partial class diagram --- classDiagram direction LR class `android.Service` <<interface>> `android.Service` class `android/service.Service` `android/service.Service` ..|> `android.Service`: implements class `fleet.AndroidDatastore` <<interface>> `fleet.AndroidDatastore` class `fleet.Datastore` <<interface>> `fleet.Datastore` class `android.Datastore` <<interface>> `android.Datastore` `android/service.Service` *-- `fleet.AndroidDatastore`: USES (THIS IS THE KEY CHANGE) `fleet.Datastore` *-- `fleet.AndroidDatastore`: contains `mysql.Datastore` ..|> `fleet.Datastore`: implements `fleet.AndroidDatastore` *-- `android.Datastore`: contains `mysql.Datastore` *-- `android.Datastore`: contains `android/mysql.Datastore` ..|> `android.Datastore`: implements ``` |
||
|---|---|---|
| .. | ||
| mock | ||
| mysql | ||
| service | ||
| tests | ||
| android.go | ||
| arch_test.go | ||
| datastore.go | ||
| proxy.go | ||
| pubsub.go | ||
| README.md | ||
| service.go | ||
The MDM Android package attempts to decouple Android-specific service and datastore implementations from the core Fleet server code.
Any tightly coupled code that needs both the core Fleet server and the Android-specific features must live in the main server/fleet, server/service, and server/datastore packages. Typical example are MySQL queries. Any code that implements Android-specific functionality should live in the server/mdm/android package. For example, the common code from server/datastore package can call the android datastore methods as needed.
This decoupled approach attempts to achieve the following goals:
- Easier to understand and find Android-specific code.
- Easier to fix Android-specific bugs and add new features.
- Easier to maintain Android-specific feature branches.
- Faster Android-specific tests, including ability to run all tests in parallel.