tidy(nodes): remove object serializer on_saved

It's unused.
This commit is contained in:
psychedelicious 2024-02-07 23:43:22 +11:00
parent 9f382419dc
commit 507aeac8a5
2 changed files with 0 additions and 10 deletions

View File

@ -8,7 +8,6 @@ class ObjectSerializerBase(ABC, Generic[T]):
"""Saves and loads arbitrary python objects."""
def __init__(self) -> None:
self._on_saved_callbacks: list[Callable[[str, T], None]] = []
self._on_deleted_callbacks: list[Callable[[str], None]] = []
@abstractmethod
@ -36,18 +35,10 @@ class ObjectSerializerBase(ABC, Generic[T]):
"""
pass
def on_saved(self, on_saved: Callable[[str, T], None]) -> None:
"""Register a callback for when an object is saved"""
self._on_saved_callbacks.append(on_saved)
def on_deleted(self, on_deleted: Callable[[str], None]) -> None:
"""Register a callback for when an object is deleted"""
self._on_deleted_callbacks.append(on_deleted)
def _on_saved(self, name: str, obj: T) -> None:
for callback in self._on_saved_callbacks:
callback(name, obj)
def _on_deleted(self, name: str) -> None:
for callback in self._on_deleted_callbacks:
callback(name)

View File

@ -41,7 +41,6 @@ class ObjectSerializerForwardCache(ObjectSerializerBase[T]):
def save(self, obj: T) -> str:
name = self._underlying_storage.save(obj)
self._set_cache(name, obj)
self._on_saved(name, obj)
return name
def delete(self, name: str) -> None: