Skip to content

Feature/radex stores - #36

Draft
AymenFJA wants to merge 8 commits into
mainfrom
feature/radex-stores
Draft

Feature/radex stores#36
AymenFJA wants to merge 8 commits into
mainfrom
feature/radex-stores

Conversation

@AymenFJA

Copy link
Copy Markdown
Collaborator

No description provided.

…Store

Introduces radex.store (Store/Endpoint base + RedisStore/DragonStore) so
RADEX can provision and tear down its own Redis or Dragon DDict backend
instead of requiring callers to do it manually, with idempotent async
lifecycle (start/ready/endpoints/shutdown), plus tests and examples.
Store and Endpoint now only launch backends and expose connection info
(.endpoints/.serialize()) -- callers build the typed RADEX client
(DragonClient/RedisClient) themselves from an endpoint, giving clean
N-clients-per-endpoint / clients-across-M-endpoints support instead of
Store guessing cardinality. RedisStore keeps a .client() convenience for
a raw redis-py client only; DragonStore has no client() at all. Updated
both examples and the affected tests to match.
total_mem: int | None = None,
*,
working_set_size: int = 2,
wait_for_keys: bool = True,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see the point of letting devs set wait_for_keys (e.g. like we do in the unit tests). What about to make it double extra clear that you shouldn't do that put it as a _wait_for_keys?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, probably super paranoid, but also check that wait_for_keys isn't set in extra_ddict_kwargs

_DDict = None


_PROBE_KEY = "__radex_store_liveness_probe__"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a nice way to do the check. Could we breadcrumb somewhere a TODO to wire in some a more direct health check (at least for dragon)

self._processes: dict[int, asyncio.subprocess.Process] = {}
self._planned: list[tuple[str, int]] = []

def client(self, index: int = 0, **kwargs: Any) -> "redis.Redis":

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to use "our" radex client. From what I see it's only really being used in testing as a ping. Let's do this as a "probe" key.

return f"{self.host}:{self.port}"


class RedisStore(Store):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to leave this as single-node only for now (not N-independent instances). For SmartRedis users rotating onto this, I'd rather have them complain to us that they want clustered behaviour as opposed to being confused why their multi-node db doesn't have a global key space

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants