Skip to content

KV Geo: publish an artifact to the Axum local KV store #540

Backlog

Description

@ChristianPavilonis

Description

The KV Geo tool in examples/geo-kv-prototype publishes only to celld or DynamoDB. Axum's production runner already prepares a local redb store for an unbound Geo store ID, but nothing can put an artifact into it. A single-process Axum deployment that wants KV Geo therefore has to run celld or DynamoDB Local next to it, only to hold a read-only index.

Steps to reproduce

  1. Build Trusted Server's Axum adapter with geo-kv on a revision that includes Portable KV-backed Geo lookup #454.

  2. Build an artifact from a GeoLite City CSV with geo-kv-prototype build.

  3. Start the server with KV Geo selected and no store binding for geo_index:

    EDGEZERO__ADAPTER__DATA_DIR=/data
    EDGEZERO__ADAPTER__GEO__PROVIDER=kv
    EDGEZERO__ADAPTER__GEO__STORE_ID=geo_index
    EDGEZERO__ADAPTER__GEO__PIN=<generation>@<manifest sha256>
    EDGEZERO__ADAPTER__GEO__READER_IP=forwarded-required
  4. Startup creates /data/kv-geo-index-<hash>.redb next to the record store's file, then exits before listening with native_geo: pinned KV data could not be prepared.

The local store exists and is the right shape. It is empty because no tool writes to it.

Expected behavior

  • geo-kv-prototype publish can target the Axum local KV store, given the data directory and the logical store ID.
  • It opens the same file the runner derives for that ID. Today kv_store_file_name in dev_server.rs is private, so the derivation needs to be exposed or wrapped in a constructor.
  • Publication keeps its existing contract: read before write, skip identical bytes, abort on different bytes, read back, manifest last. verify-remote works against the same store.
  • redb lets one process open the file (DatabaseAlreadyOpen), so publishing happens while the server is stopped. The tool reports that case clearly rather than waiting.
  • The serving reader doesn't change. It still reads through KvHandle.

Impact

On Trusted Server, an Unknown jurisdiction fails closed in allows_ec_creation, so without Geo no Edge Cookie is ever issued. A developer running TS on Axum locally can't exercise identity unless they also run celld or DynamoDB Local and publish an index. The same applies to single-node self-hosted Axum (#391). Trusted Server's test lab runs a celld per instance only for this.

Proposed fix

Add a backend to the tool behind a feature, for example axum-local, that opens EdgeZero's Axum persistent KV store at the path the runner uses. Expose that path derivation from edgezero-adapter-axum. Document in native-geo.md that an unbound Geo store ID uses the local provider, and how to fill it.

Out of scope: making a local store the default, publishing while the server runs, and any change to selection precedence, the reader or consent policy.

Done when

  • publish and verify-remote work against the Axum local store, with interrupted, identical and conflicting publication covered as for the other backends.
  • The tool and the runner derive the same file from one shared function.
  • A managed Axum test starts with an unbound Geo store ID filled by the tool, and resolves sampled lookups that match the CSV oracle.
  • Opening the store while the server holds it fails with a clear message.
  • native-geo.md describes the local store and its single-process limit.

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions