feat: Implement runtime API cache store and related configurations

- Added RuntimeApiCacheStore for managing API cache entries in memory.
- Introduced StorageTarget enum to define various storage targets.
- Created StoredCacheEntry record to encapsulate cache entries.
- Defined SyncState enum to represent the synchronization state of cache entries.
- Added ControlPlaneConfigurationSource enum for different configuration sources.
- Developed ControlPlaneRuntimeConfig class for runtime configuration management.
- Implemented ControlPlaneStartupConfigResolver for resolving configuration from various sources.
- Created ControlPlaneStartupSettings to hold startup configuration values.
- Added ResolvedControlPlaneStartupConfig record to encapsulate resolved configuration.
- Implemented tests for batch client and cache client functionalities.
- Added tests for ControlPlaneStartupConfigResolver to validate configuration resolution logic.
This commit is contained in:
2026-06-05 07:00:14 -07:00
parent 7a4a0bd4bd
commit 59330bdf84
56 changed files with 3627 additions and 490 deletions
+82
View File
@@ -0,0 +1,82 @@
# Control Plane Client
`ControlPlaneClient` is the main public entry point for plugins.
```java
ControlPlaneClient client = NetworkPlugin.client();
```
## Public Clients
```java
client.server(); // ServerClient
client.presence(); // PresenceClient
client.players(); // PlayersClient
client.batch(); // BatchClient
client.cache(); // ApiDataCacheClient
```
## Handwritten Domain Clients
`ServerClient`
```java
ServerProfile profile = client.server().currentProfile();
```
`PresenceClient`
```java
client.presence().register(instanceId, registrationPayload);
client.presence().heartbeat(instanceId, HeartbeatPayload.running(12, 150));
client.presence().shutdown(instanceId, "restart");
```
`PlayersClient`
```java
PlayerSessionProfile profile = client.players().getSessionProfile(playerId);
List<PlayerEntitlement> entitlements = client.players().getEntitlements(playerId);
```
## Error Handling
Transport errors use checked `ControlPlaneException` subclasses:
- `AuthException` for `401` and `403`
- `NotFoundException` for `404`
- `ValidationException` for `422`
- `RemoteException` for `5xx`
- `ControlPlaneException` for other transport or parsing failures
Example:
```java
try {
ServerProfile profile = client.server().currentProfile();
} catch (AuthException e) {
// token is missing, invalid, inactive, or lacks ability
} catch (ControlPlaneException e) {
// generic control-plane failure
}
```
## Endpoint Descriptors
Generated endpoint descriptors are available under:
```text
net.kewwbec.network.generated.api.v1
```
Use them for stable route metadata and URI templates. Resolve path variables with `PathBuilder`.
```java
String uri = PathBuilder.resolve(
SessionProfileEndpoint.VALUE.uri(),
"player",
playerId
);
```
Do not edit generated descriptors manually. Update routes in `core-control-plane`, then run the SDK sync command from that repo.