コード例 #1
0
ファイル: benchmark_cortex.py プロジェクト: freecamel/synapse
 async def do07BAddNodesSimpleProp(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int:
     '''
     Add simple node with a single non-form secondary prop
     '''
     count = await acount(prox.addNodes(self.testdata.asns2prop))
     assert count == self.workfactor
     return count
コード例 #2
0
ファイル: benchmark_cortex.py プロジェクト: freecamel/synapse
 async def do07DAddNodesFormPropExists(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int:
     '''
     Add simple node with a single form secondary prop and that secondary prop form already exists
     '''
     count = await acount(prox.addNodes(self.testdata.asns2formexist))
     assert count == self.workfactor
     return count
コード例 #3
0
ファイル: benchmark_cortex.py プロジェクト: freecamel/synapse
 async def do10Formatting(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int:
     '''
     The same as do10AutoAdds without the adds (to isolate the autoadd part)
     '''
     q = "inet:ipv4 $val=$lib.str.format('{num}.rev', num=$(1000000-$node.value()))"
     count = await acount(prox.eval(q))
     assert count == self.workfactor
     return self.workfactor
コード例 #4
0
ファイル: benchmark_cortex.py プロジェクト: wesinator/synapse
    async def do07AAddNodesStorm(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int:
        tags_to_add = '+#test'
        msgs = []

        for node in self.testdata.asns2prop:
            props_to_add = f":name = {node[1]['props']['name']}"
            form, valu = node[0]

            opts = {'vars': {'valu': valu}, 'view': self.viewiden}
            msgs.extend([x async for x in prox.storm(f'[ {form}=$valu {props_to_add} {tags_to_add}]', opts=opts)])
            newnodes = [m for m in msgs if m[0] == 'node:edits' and m[1]['edits'][0][2][0][0] == 2]
        assert len(newnodes) == self.workfactor
        return len(newnodes)
コード例 #5
0
ファイル: benchmark_cortex.py プロジェクト: freecamel/synapse
 async def do03LiftBySecondaryAbsent(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int:
     count = await acount(prox.eval('inet:dns:a:fqdn=newp'))
     assert count == 0
     return 1
コード例 #6
0
ファイル: benchmark_cortex.py プロジェクト: freecamel/synapse
 async def do07AAddNodesSync(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int:
     count = await acount(prox.addNodes(self.testdata.asns2))
     core.view.layers[0].layrslab.lenv.sync()
     assert count == self.workfactor
     return count
コード例 #7
0
ファイル: benchmark_cortex.py プロジェクト: freecamel/synapse
 async def do05PivotAbsent(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int:
     count = await acount(prox.eval('inet:ipv4#odd -> inet:dns:a'))
     assert count == 0
     return self.workfactor // 2
コード例 #8
0
ファイル: benchmark_cortex.py プロジェクト: freecamel/synapse
 async def do06PivotPresent(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int:
     count = await acount(prox.eval('inet:ipv4#even -> inet:dns:a'))
     assert count == self.workfactor // 2 + self.workfactor // 10
     return count
コード例 #9
0
ファイル: benchmark_cortex.py プロジェクト: wesinator/synapse
 async def do02LiftFilterAbsent(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int:
     count = await acount(prox.eval('inet:ipv4 | +#newp', opts=self.opts))
     assert count == 0
     return 1
コード例 #10
0
ファイル: benchmark_cortex.py プロジェクト: freecamel/synapse
 async def do04LiftByTagPresent(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int:
     count = await acount(prox.eval('inet:ipv4#even'))
     assert count == self.workfactor // 2
     return count
コード例 #11
0
ファイル: benchmark_cortex.py プロジェクト: freecamel/synapse
 async def do07EAddNodesPresent(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int:
     count = await acount(prox.addNodes(self.testdata.asns))
     assert count == self.workfactor
     return count
コード例 #12
0
ファイル: benchmark_cortex.py プロジェクト: freecamel/synapse
 async def do10AutoAdds(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int:
     q = "inet:ipv4 $val=$lib.str.format('{num}.rev', num=$(1000000-$node.value())) [:dns:rev=$val]"
     count = await acount(prox.eval(q))
     assert count == self.workfactor
     return self.workfactor
コード例 #13
0
ファイル: benchmark_cortex.py プロジェクト: freecamel/synapse
 async def do02LiftFilterPresent(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int:
     count = await acount(prox.eval('inet:ipv4 | +#all'))
     assert count == self.workfactor
     return count
コード例 #14
0
ファイル: benchmark_cortex.py プロジェクト: freecamel/synapse
 async def do02LiftSimple(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int:
     count = await acount(prox.eval('inet:ipv4'))
     assert count == self.workfactor
     return count
コード例 #15
0
ファイル: benchmark_cortex.py プロジェクト: freecamel/synapse
 async def do01SimpleCount(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int:
     count = await acount(prox.eval('inet:ipv4 | count | spin'))
     assert count == 0
     return self.workfactor
コード例 #16
0
ファイル: benchmark_cortex.py プロジェクト: freecamel/synapse
    async def do00EmptyQuery(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int:
        for _ in range(self.workfactor // 10):
            count = await acount(prox.eval(''))

        assert count == 0
        return self.workfactor // 10
コード例 #17
0
ファイル: benchmark_cortex.py プロジェクト: wesinator/synapse
 async def do10SlashAdds(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int:
     q = '[ inet:ipv4=1.2.0.0/16 ] | spin'
     count = await acount(prox.eval(q, opts=self.opts))
     assert count == 0
     return 2 ** 16
コード例 #18
0
ファイル: benchmark_cortex.py プロジェクト: freecamel/synapse
 async def do09DelNodes(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int:
     count = await acount(prox.eval('inet:url | delnode'))
     assert count == 0
     return self.workfactor
コード例 #19
0
ファイル: benchmark_cortex.py プロジェクト: freecamel/synapse
 async def do03LiftBySecondaryPresent(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int:
     count = await acount(prox.eval('inet:dns:a:fqdn=blackhole.website'))
     assert count == self.workfactor // 10
     return count
コード例 #20
0
ファイル: benchmark_cortex.py プロジェクト: freecamel/synapse
 async def do04LiftByTagAbsent(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int:
     count = await acount(prox.eval('inet:ipv4#newp'))
     assert count == 0
     return 1
コード例 #21
0
ファイル: benchmark_cortex.py プロジェクト: wesinator/synapse
    async def do00NewQuery(self, core: s_cortex.Cortex, prox: s_telepath.Proxy) -> int:
        for i in range(self.workfactor):
            count = await acount(prox.eval(f'$x={i}', opts=self.opts))

        assert count == 0
        return self.workfactor