예제 #1
0
    def addGestData(self, name, data):
        '''
        Ingest data according to a previously registered ingest format.

        Example:

            data = getDataFromThing()

            # use the foo:bar ingest
            iapi.addGestData('foo:bar', data)

        '''
        gest = self._gest_cache.get(name)
        if gest is None:
            raise s_common.NoSuchTufo(prop='syn:ingest', valu=name)

        gest.ingest(self._gest_core, data=data)
예제 #2
0
파일: ingest.py 프로젝트: mari0d/synapse
    def addGestData(self, name, data):
        '''
        Ingest data according to a previously registered ingest format.

        Example:

            data = getDataFromThing()

            # use the foo:bar ingest
            iapi.addGestData('foo:bar', data)

        '''
        func = self._gest_funcs.get(name)
        if func is not None:
            with self._gest_core.getCoreXact() as xact:
                return func(data)

        gest = self._gest_cache.get(name)
        if gest is None:
            raise s_common.NoSuchTufo(prop='syn:ingest', valu=name)

        gest.ingest(self._gest_core, data=data)