def setModProp(self, prop, valu): ''' Set a module property within the cortex storage layer. Args: prop (str): The property name. valu (obj): A str/int valu. ''' if self._mod_iden is None: raise s_common.NoModIden(name=self._mod_name, ctor=self.__class__.__name__) prop = '.:mod:' + self._mod_iden + '/' + prop self.core.setRowsByIdProp(self._mod_iden, prop, valu)
def getModProp(self, prop, defval=None): ''' Retrieve a module property from the cortex storage layer. Args: prop (str): The property name Returns: (obj): The int/str or None ''' if self._mod_iden is None: raise s_common.NoModIden(name=self._mod_name, ctor=self.__class__.__name__) prop = '.:mod:' + self._mod_iden + '/' + prop rows = self.core.getRowsByProp(prop, limit=1) if not rows: return defval return rows[0][2]