From acb340bb568d1f23f2a9f557f362e0a89e3e00ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=B4=D0=B5=D0=BB=D0=B8=D0=BD=D0=B0=20=D0=A1=D0=B0?= =?UTF-8?q?=D1=82=D1=82=D0=B0=D1=80=D0=BE=D0=B2=D0=B0?= Date: Wed, 27 May 2026 08:29:49 +0000 Subject: [PATCH] add memory_client.py --- memory_client.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 memory_client.py diff --git a/memory_client.py b/memory_client.py new file mode 100644 index 0000000..c3950b3 --- /dev/null +++ b/memory_client.py @@ -0,0 +1,33 @@ +""" +Memory Client implementation. + +This module provides a simple client that interacts with the MemoryServer via a local function call interface. In real deployments, this could be replaced with network communication (e.g., gRPC or HTTP). +""" + +from typing import Any +from memory_server import MemoryServer + +class MemoryClient: + """A thin wrapper around MemoryServer. + + The client holds a reference to a :class:`MemoryServer` instance and forwards operations. + """ + + def __init__(self, server: MemoryServer) -> None: + self._server = server + + def set(self, key: str, value: Any) -> None: + self._server.set(key, value) + + def get(self, key: str) -> Any: + return self._server.get(key) + + def delete(self, key: str) -> None: + self._server.delete(key) + +# Simple demo when run as a script +if __name__ == "__main__": + srv = MemoryServer() + cli = MemoryClient(srv) + cli.set("bar", [1, 2, 3]) + print(cli.get("bar"))