59330bdf84
- 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.
1.9 KiB
1.9 KiB
Control Plane Client
ControlPlaneClient is the main public entry point for plugins.
ControlPlaneClient client = NetworkPlugin.client();
Public Clients
client.server(); // ServerClient
client.presence(); // PresenceClient
client.players(); // PlayersClient
client.batch(); // BatchClient
client.cache(); // ApiDataCacheClient
Handwritten Domain Clients
ServerClient
ServerProfile profile = client.server().currentProfile();
PresenceClient
client.presence().register(instanceId, registrationPayload);
client.presence().heartbeat(instanceId, HeartbeatPayload.running(12, 150));
client.presence().shutdown(instanceId, "restart");
PlayersClient
PlayerSessionProfile profile = client.players().getSessionProfile(playerId);
List<PlayerEntitlement> entitlements = client.players().getEntitlements(playerId);
Error Handling
Transport errors use checked ControlPlaneException subclasses:
AuthExceptionfor401and403NotFoundExceptionfor404ValidationExceptionfor422RemoteExceptionfor5xxControlPlaneExceptionfor other transport or parsing failures
Example:
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:
net.kewwbec.network.generated.api.v1
Use them for stable route metadata and URI templates. Resolve path variables with PathBuilder.
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.