fleet/server/mdm/android
Victor Lyuboslavsky a86253d2bf
Refactoring Android datastore interface (#26982)
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
```
2025-03-13 14:28:52 -05:00
..
mock Added signup_token for Android signup callback authentication. (#26681) 2025-02-28 15:08:04 -06:00
mysql Auto-generate and check Android schema.sql (#26720) 2025-02-28 16:30:40 -06:00
service Refactoring Android datastore interface (#26982) 2025-03-13 14:28:52 -05:00
tests Refactoring Android datastore interface (#26982) 2025-03-13 14:28:52 -05:00
android.go Added Android activity and better handling of deleted users. (#26640) 2025-02-27 14:19:15 -06:00
arch_test.go Added GET enterprise API endpoint. (#26555) 2025-02-26 10:47:05 -06:00
datastore.go Auto-generate and check Android schema.sql (#26720) 2025-02-28 16:30:40 -06:00
proxy.go Delete Android PubSub topic when deleting enterprise. (#26676) 2025-02-28 15:06:52 -06:00
pubsub.go Added custom auth for PubSub push endpoint. (#26664) 2025-02-27 15:16:32 -06:00
README.md Basic Android enroll functionality (#26386) 2025-02-24 14:31:21 -06:00
service.go Added signup_token for Android signup callback authentication. (#26681) 2025-02-28 15:08:04 -06:00

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.