コード例 #1
0
 async def wait(self):
     # await a future
     future = asyncio.run_coroutine_threadsafe(super().wait(), self._event_loop)
     future = asyncio.wrap_future(future)
     done, _ = await asyncio.wait({future})
     if not done:
         raise InternalError("Some internal asyncio error during waiting asyncio.Event.wait")
コード例 #2
0
ファイル: storage.py プロジェクト: rohitkolapkar/cortx-utils
    def _add_property(self, name: str, property_type: Type[BaseType]):
        """
        Add property to mappings

        :param str name: property name
        :param Type[BaseType] property_type: type of property for given property `name`
        :return:
        """
        properties = self._mapping[ESWords.MAPPINGS][ESWords.PROPERTIES]
        if name in properties:
            raise InternalError(f"Repeated property name in model: {name}")

        properties[name] = dict()
        properties[name][ESWords.DATA_TYPE] = DATA_MAP[property_type]
        # NOTE: to perform case insensitive search we need to use custom normalizer for keywords
        if properties[name][ESWords.DATA_TYPE] == ESDataType.KEYWORD:
            properties[name]["normalizer"] = LOWERCASE_NORMALIZER