Skip to content

feat: Add async Consul persistent feature store - #491

Draft
jsonbailey wants to merge 1 commit into
mainfrom
jb/sdk-2907/async-persist-consul
Draft

feat: Add async Consul persistent feature store#491
jsonbailey wants to merge 1 commit into
mainfrom
jb/sdk-2907/async-persist-consul

Conversation

@jsonbailey

Copy link
Copy Markdown
Contributor

Overview

Adds an async Consul persistent feature store, built on the async persistence foundation introduced in #488 (AsyncFeatureStoreCore + AsyncCachingStoreWrapper).

Consul.async_feature_store(...) returns an AsyncCachingStoreWrapper around the new _AsyncConsulFeatureStoreCore, giving async SDK users a Consul-backed implementation of AsyncFeatureStore. The store uses the same Consul KV layout as the synchronous Consul feature store, so an async and a synchronous SDK can share one Consul instance.

Implementation notes

  • The underlying consul.aio.Consul client builds its aiohttp session at construction time, which needs a running event loop. The core creates the client lazily, bound to the running event loop on the first store operation, so the factory method can still be called synchronously while building configuration. The client is released in close().

New optional dependency

  • Adds the async-consul extra, which pulls in py-consul[asyncio] — the maintained Criteo fork of python-consul that provides an asyncio client over aiohttp.
  • The synchronous Consul store still depends on the older python-consul, so the SDK temporarily depends on two Consul packages. Consolidating onto a single package is tracked separately in SDK-2913.

Testing

  • Wrapper/caching logic is covered without a live backend by test_async_feature_store_helpers.
  • The Consul integration tests require a live Consul agent, so they run in CI.

References


Draft pending review.

Builds on the async persistence foundation (AsyncFeatureStoreCore and
AsyncCachingStoreWrapper) and adds the async-consul optional-dependency extra.
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