def clearRelatedData(self): """ Removes all related information from database for this environment. """ Cache.delete(self._key) Storage.delete(self._key) for _, v in self._idGenerators.items(): v.release()
def clearRelatedData(self): """ Removes all related information from database for this environment. """ from uds.core.util.Cache import Cache from uds.core.util.Storage import Storage Cache.delete(self._key) Storage.delete(self._key) for __, v in six.iteritems(self._idGenerators): v.release()
def clearRelatedData(self): ''' Removes all related information from database for this environment. ''' from uds.core.util.Cache import Cache from uds.core.util.Storage import Storage Cache.delete(self._key) Storage.delete(self._key) for __, v in self._idGenerators.iteritems(): v.release()
def __init__(self, uniqueKey, idGenerators={}): ''' Initialized the Environment for the specified id @param uniqueId: Key for this environment @param idGenerators: Hash of generators of ids for this environment. This "generators of ids" feature is used basically at User Services to auto-create ids for macs or names, using {'mac' : UniqueMacGenerator, 'name' : UniqueNameGenerator } as argument. ''' from uds.core.util.Cache import Cache from uds.core.util.Storage import Storage self._key = uniqueKey self._cache = Cache(uniqueKey) self._storage = Storage(uniqueKey) self._idGenerators = idGenerators
def __init__(self, uniqueKey, idGenerators=None): """ Initialized the Environment for the specified id @param uniqueKey: Key for this environment @param idGenerators: Hash of generators of ids for this environment. This "generators of ids" feature is used basically at User Services to auto-create ids for macs or names, using {'mac' : UniqueMacGenerator, 'name' : UniqueNameGenerator } as argument. """ if idGenerators is None: idGenerators = dict() self._key = uniqueKey self._cache = Cache(uniqueKey) self._storage = Storage(uniqueKey) self._idGenerators = idGenerators