Source code for fedn.network.storage.models.modelstorage

from abc import ABC, abstractmethod


[docs] class ModelStorage(ABC):
[docs] @abstractmethod def exist(self, model_id): """Check if model exists in storage :param model_id: The model id :type model_id: str :return: True if model exists, False otherwise :rtype: bool """ pass
[docs] @abstractmethod def get(self, model_id): """Get model from storage :param model_id: The model id :type model_id: str :return: The model :rtype: object """ pass
[docs] @abstractmethod def get_model_metadata(self, model_id): """Get model metadata from storage :param model_id: The model id :type model_id: str :return: The model metadata :rtype: dict """ pass
[docs] @abstractmethod def set_model_metadata(self, model_id, model_metadata): """Set model metadata in storage :param model_id: The model id :type model_id: str :param model_metadata: The model metadata :type model_metadata: dict :return: True if successful, False otherwise :rtype: bool """ pass
[docs] @abstractmethod def delete(self, model_id): """Delete model from storage :param model_id: The model id :type model_id: str :return: True if successful, False otherwise :rtype: bool """ pass
[docs] @abstractmethod def delete_all(self): """Delete all models from storage :return: True if successful, False otherwise :rtype: bool """ pass