From 6b753ba414dee1938c3367ad0e7ea9b649b1f035 Mon Sep 17 00:00:00 2001 From: Hendrik Buschmeier <hbuschme@TechFak.Uni-Bielefeld.DE> Date: Mon, 2 Apr 2012 16:08:46 +0200 Subject: [PATCH] IU_uids are now created upon IU creation (for local IUs). --- python/src/ipaaca.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/python/src/ipaaca.py b/python/src/ipaaca.py index cd31264..7055bdd 100755 --- a/python/src/ipaaca.py +++ b/python/src/ipaaca.py @@ -295,6 +295,7 @@ class IU(IUInterface):#{{{ def __init__(self, category='undef', access_mode=IUAccessMode.PUSH, read_only=False, _payload_type='MAP'): super(IU, self).__init__(uid=None, access_mode=access_mode, read_only=read_only) self._revision = 1 + self.uid = str(uuid.uuid4()) self._category = category self._payload_type = _payload_type self.revision_lock = threading.RLock() @@ -391,7 +392,7 @@ class IU(IUInterface):#{{{ uid = property( fget=IUInterface._get_uid, fset=_set_uid, - doc='Unique ID of theIU.') + doc='Unique ID of the IU.') #}}} @@ -939,7 +940,7 @@ class OutputBuffer(Buffer): self._informer_store = {} self._id_prefix = str(owning_component_name)+'-'+str(self._uuid)+'-IU-' self.__iu_id_counter_lock = threading.Lock() - self.__iu_id_counter = 0 + #self.__iu_id_counter = 0 # hbuschme: IUs now have their Ids assigned on creation def _create_own_name_listener(self, iu_category): # FIXME replace this @@ -952,12 +953,13 @@ class OutputBuffer(Buffer): #logger.info("Added category listener for "+iu_category) #return cat_listener - def _generate_iu_uid(self): - '''Generate a unique IU id of the form''' - with self.__iu_id_counter_lock: - self.__iu_id_counter += 1 - number = self.__iu_id_counter - return self._id_prefix + str(number) + # hbuschme: IUs now have their Ids assigned on creation + #def _generate_iu_uid(self): + # '''Generate a unique IU id of the form ????''' + # with self.__iu_id_counter_lock: + # self.__iu_id_counter += 1 + # number = self.__iu_id_counter + # return self._id_prefix + str(number) def _remote_update_links(self, update): '''Apply a remotely requested update to one of the stored IU's links.''' @@ -1032,9 +1034,10 @@ class OutputBuffer(Buffer): def add(self, iu): '''Add an IU to the IU store, assign an ID and publish it.''' - if iu._uid is not None: - raise IUPublishedError(iu) - iu.uid = self._generate_iu_uid() + # hbuschme: IUs now have their Ids assigned on creation + #if iu._uid is not None: + # raise IUPublishedError(iu) + #iu.uid = self._generate_iu_uid() self._iu_store[iu._uid] = iu iu.buffer = self self._publish_iu(iu) -- GitLab