Skip to content

Define platform traits, ClientInfo, PlatformError, RuntimeServices #483

@aram356

Description

@aram356

Description

Create platform/ module in core crate with all platform trait interfaces (PlatformConfigStore, PlatformSecretStore, PlatformKvStore, PlatformBackend, PlatformHttpClient, PlatformGeo), ClientInfo struct, PlatformError enum, and RuntimeServices struct. Wire async_trait with target-conditional ?Send on wasm.

ClientInfo (extract-once pattern)

ClientInfo is a plain data struct, not a trait. Each adapter constructs it once at the entry point from the platform request (before dispatching to handlers) and stores it in RuntimeServices. Handlers read it from there — no request parameter needed. This follows the existing GeoInfo::from_request() pattern.

pub struct ClientInfo {
    pub client_ip: Option<IpAddr>,
    pub tls_protocol: Option<String>,
    pub tls_cipher: Option<String>,
}

RuntimeServices stores it as pub client_info: ClientInfo (not Box<dyn ...>).

PlatformHttpClient and EdgeZero ProxyClient

PlatformHttpClient is a superset of EdgeZero's existing ProxyClient (sync send + async fan-out via send_async + select, backend correlation, WASM-compatible). These must not coexist as parallel abstractions. File an EdgeZero issue to generalize ProxyClient into an HttpClient trait before PR 6 merges. During Phase 1, the trusted-server defines its own PlatformHttpClient backed by Fastly SDK calls; when EdgeZero's generalized HttpClient lands, swap to implementing that trait instead.

Done when

  • Traits compile on host + wasm
  • Object-safety static assertion + dummy RuntimeServices unit test pass
  • async_trait wired with target-conditional Send
  • ClientInfo struct defined
  • Per-PR gates pass

Blocked by

PR 1

References

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions