X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=o2ims%2Fdomain%2Fsubscription_repo.py;h=82df3779bdd32b639d2e5f3c3ffdbd537cc1999c;hb=refs%2Fchanges%2F28%2F7528%2F1;hp=d12c00d53365776d65abaff562b2b038165b870a;hpb=b86917339a9fc4ea0da6c2deadace89c3b0e1bef;p=pti%2Fo2.git diff --git a/o2ims/domain/subscription_repo.py b/o2ims/domain/subscription_repo.py index d12c00d..82df377 100644 --- a/o2ims/domain/subscription_repo.py +++ b/o2ims/domain/subscription_repo.py @@ -55,3 +55,43 @@ class SubscriptionRepository(abc.ABC): @abc.abstractmethod def _delete(self, subscription_id): raise NotImplementedError + + +class RegistrationRepository(abc.ABC): + def __init__(self): + self.seen = set() # type: Set[subobj.Subscription] + + def add(self, registration: subobj.Registration): + self._add(registration) + self.seen.add(registration) + + def get(self, registration_id) -> subobj.Registration: + registration = self._get(registration_id) + if registration: + self.seen.add(registration) + return registration + + def list(self) -> List[subobj.Registration]: + return self._list() + + def update(self, registration: subobj.Registration): + self._update(registration) + + def delete(self, registration_id): + self._delete(registration_id) + + @abc.abstractmethod + def _add(self, registration: subobj.Registration): + raise NotImplementedError + + @abc.abstractmethod + def _get(self, registration_id) -> subobj.Registration: + raise NotImplementedError + + @abc.abstractmethod + def _update(self, registration: subobj.Registration): + raise NotImplementedError + + @abc.abstractmethod + def _delete(self, registration_id): + raise NotImplementedError