From: John Mulligan Date: Tue, 1 Jul 2025 21:15:10 +0000 (-0400) Subject: mgr/smb: add a RawConfigEntry protocol type X-Git-Tag: testing/wip-vshankar-testing-20250821.112602-debug~44^2~14 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=6d9e126eb25625dec5a2de61955ad625a6303d1a;p=ceph-ci.git mgr/smb: add a RawConfigEntry protocol type Previously, the ConfigEntry type was created to be general interface for serializing structures to JSON and persist them in a store. However, there are times we want to retain data in a store that is not serialized JSON - but just raw data. Create a new protocol for that purpose. Signed-off-by: John Mulligan --- diff --git a/src/pybind/mgr/smb/proto.py b/src/pybind/mgr/smb/proto.py index b04c3e90e0e..3cb5a201485 100644 --- a/src/pybind/mgr/smb/proto.py +++ b/src/pybind/mgr/smb/proto.py @@ -62,7 +62,27 @@ class ResourceKey(Protocol): ... # pragma: no cover -class ConfigEntry(Protocol): +class BaseEntry(Protocol): + """Base protocol class for Entry objects. Entry objects are stored + peristently and can by identified by an internal key or URI. + """ + + def remove(self) -> bool: + ... # pragma: no cover + + def exists(self) -> bool: + ... # pragma: no cover + + @property + def uri(self) -> str: + ... # pragma: no cover + + @property + def full_key(self) -> EntryKey: + ... # pragma: no cover + + +class ConfigEntry(BaseEntry, Protocol): """A protocol for describing a configuration object that can be kept within a configuration store. Has the ability to identify itself either by a relative key or by a global URI value. @@ -74,18 +94,14 @@ class ConfigEntry(Protocol): def set(self, obj: Simplified) -> None: ... # pragma: no cover - def remove(self) -> bool: - ... # pragma: no cover - def exists(self) -> bool: - ... # pragma: no cover +class RawConfigEntry(BaseEntry, Protocol): + """Like a ConfigEntry but for opaque data blobs.""" - @property - def uri(self) -> str: + def get_data(self) -> str: ... # pragma: no cover - @property - def full_key(self) -> EntryKey: + def set_data(self, obj: Simplified) -> None: ... # pragma: no cover