Skip to content

Construct backend interfaces from a shared server - #1254

Open
floitsch wants to merge 3 commits into
floitsch/build-artemis-service.s-new.110from
floitsch/build-artemis-service.s-new.120
Open

Construct backend interfaces from a shared server#1254
floitsch wants to merge 3 commits into
floitsch/build-artemis-service.s-new.110from
floitsch/build-artemis-service.s-new.120

Conversation

@floitsch

@floitsch floitsch commented Aug 26, 2026

Copy link
Copy Markdown
Member

Depends on #1253.

Why

The CLI should depend on the roles it needs, while transport, authentication,
scope, and connection lifetime can still be shared. A combined backend object
would preserve the coupling we are trying to remove and would make it harder
to assign different implementations to different roles later.

What

  • Introduce a Server connection abstraction that owns transport,
    authentication, scope, and lifetime.
  • Define independent role interfaces:
    • UpdateBroker publishes desired update state and handles provisioning.
    • ArtifactStore stores firmware and application images.
    • PodStore stores pod metadata, manifests, and parts.
  • Model reported state and events as separate optional broker capabilities:
    BrokerStateReader and BrokerEventReader.
  • Do not introduce a remote FleetStore: the fleet is currently the local
    filesystem/YAML model, and belongs behind a different future boundary.
  • Construct HTTP or Supabase implementations for each role from the configured
    Server; there is no CombinedBackend adapter.
  • Remove the generic tenancy setting. When the same configured server is
    assigned to both Artemis and broker roles, construct the combined
    UpdateBroker implementation that also registers the device with Artemis.
  • Keep standalone and combined provisioning behavior in separate HTTP and
    Supabase update-broker implementations.
  • Keep the current wire protocol and /functions/v1/b endpoint unchanged.

This matches the intended configuration model: construct a server and assign
its implementations to selected roles. Later configurations can mix providers,
and the Supabase v1 edge functions can split by interface without changing the
CLI call sites again.

Verification

  • Analyzed the affected Toit sources and tests.
  • Ran broker-test.toit with standalone and combined HTTP brokers.
  • Ran pod-registry-test.toit with standalone and combined HTTP brokers.
  • Supabase verification runs in CI; the combined implementation now preserves
    the two-argument new_provisioned RPC payload.

@floitsch floitsch changed the title Split combined backend into concern interfaces Construct backend interfaces from a shared server Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant