示例#1
0
 def do_inventory(self, via, timeout, arguments):
     if arguments:
         print('inventory does not take any arguments')
         return
     if via != 'functor':
         print('inventory can only be called via functor')
         return
     request = store_pb2.Empty()
     result = self._execute_rpc('ListInventory', via, timeout, request)
     for query in result:
         print(query.name, '\t', query.count)
示例#2
0
 def AddItems(self, request_iter, context):
     for request in request_iter:
         self._inventory[request.name] += 1
     return store_pb2.Empty()
示例#3
0
 def AddItem(self, request, context):
     self._inventory[request.name] += 1
     return store_pb2.Empty()