Permalink
Browse files

Remove the driver mix-in from codegen and spec

  • Loading branch information...
Gavin M. Roy
Gavin M. Roy committed Oct 14, 2012
1 parent f2f1d95 commit 97b0976577a2c9f569fb66454f76e0cdb2fc463a
Showing with 0 additions and 379 deletions.
  1. +0 −318 pika/spec.py
  2. +0 −61 utils/codegen.py
View
@@ -2763,321 +2763,3 @@ def has_content(methodNumber):
return True
return False
-
-class DriverMixin(object):
-
- def exchange_declare(self, callback=None, ticket=0, exchange=None, type='direct', passive=False, durable=False, auto_delete=False, internal=False, nowait=False, arguments={}):
- """
- Implements the Exchange.Declare AMQP command. For context and usage:
-
- http://www.rabbitmq.com/amqp-0-9-1-quickref.html#exchange.declare
-
- This is a synchronous method that will not allow other commands to be
- send to the AMQP broker until it has completed. It is recommended to
- pass in a parameter to callback to be notified when this command has
- completed.
- """
- data.validate_type('ticket', ticket, 'short')
- data.validate_type('exchange', exchange, 'shortstr')
- data.validate_type('type', type, 'shortstr')
- data.validate_type('passive', passive, 'bit')
- data.validate_type('durable', durable, 'bit')
- data.validate_type('auto_delete', auto_delete, 'bit')
- data.validate_type('internal', internal, 'bit')
- data.validate_type('nowait', nowait, 'bit')
- data.validate_type('arguments', arguments, 'table')
-
- return self.transport.rpc(Exchange.Declare(ticket=ticket, exchange=exchange, type=type, passive=passive, durable=durable, auto_delete=auto_delete, internal=internal, nowait=nowait, arguments=arguments), callback,
- [Exchange.DeclareOk])
-
- def exchange_delete(self, callback=None, ticket=0, exchange=None, if_unused=False, nowait=False):
- """
- Implements the Exchange.Delete AMQP command. For context and usage:
-
- http://www.rabbitmq.com/amqp-0-9-1-quickref.html#exchange.delete
-
- This is a synchronous method that will not allow other commands to be
- send to the AMQP broker until it has completed. It is recommended to
- pass in a parameter to callback to be notified when this command has
- completed.
- """
- data.validate_type('ticket', ticket, 'short')
- data.validate_type('exchange', exchange, 'shortstr')
- data.validate_type('if_unused', if_unused, 'bit')
- data.validate_type('nowait', nowait, 'bit')
-
- return self.transport.rpc(Exchange.Delete(ticket=ticket, exchange=exchange, if_unused=if_unused, nowait=nowait), callback,
- [Exchange.DeleteOk])
-
- def exchange_bind(self, callback=None, ticket=0, destination=None, source=None, routing_key='', nowait=False, arguments={}):
- """
- Implements the Exchange.Bind AMQP command. For context and usage:
-
- http://www.rabbitmq.com/amqp-0-9-1-quickref.html#exchange.bind
-
- This is a synchronous method that will not allow other commands to be
- send to the AMQP broker until it has completed. It is recommended to
- pass in a parameter to callback to be notified when this command has
- completed.
- """
- data.validate_type('ticket', ticket, 'short')
- data.validate_type('destination', destination, 'shortstr')
- data.validate_type('source', source, 'shortstr')
- data.validate_type('routing_key', routing_key, 'shortstr')
- data.validate_type('nowait', nowait, 'bit')
- data.validate_type('arguments', arguments, 'table')
-
- return self.transport.rpc(Exchange.Bind(ticket=ticket, destination=destination, source=source, routing_key=routing_key, nowait=nowait, arguments=arguments), callback,
- [Exchange.BindOk])
-
- def exchange_unbind(self, callback=None, ticket=0, destination=None, source=None, routing_key='', nowait=False, arguments={}):
- """
- Implements the Exchange.Unbind AMQP command. For context and usage:
-
- http://www.rabbitmq.com/amqp-0-9-1-quickref.html#exchange.unbind
-
- This is a synchronous method that will not allow other commands to be
- send to the AMQP broker until it has completed. It is recommended to
- pass in a parameter to callback to be notified when this command has
- completed.
- """
- data.validate_type('ticket', ticket, 'short')
- data.validate_type('destination', destination, 'shortstr')
- data.validate_type('source', source, 'shortstr')
- data.validate_type('routing_key', routing_key, 'shortstr')
- data.validate_type('nowait', nowait, 'bit')
- data.validate_type('arguments', arguments, 'table')
-
- return self.transport.rpc(Exchange.Unbind(ticket=ticket, destination=destination, source=source, routing_key=routing_key, nowait=nowait, arguments=arguments), callback,
- [Exchange.UnbindOk])
-
- def queue_declare(self, callback=None, ticket=0, queue='', passive=False, durable=False, exclusive=False, auto_delete=False, nowait=False, arguments={}):
- """
- Implements the Queue.Declare AMQP command. For context and usage:
-
- http://www.rabbitmq.com/amqp-0-9-1-quickref.html#queue.declare
-
- This is a synchronous method that will not allow other commands to be
- send to the AMQP broker until it has completed. It is recommended to
- pass in a parameter to callback to be notified when this command has
- completed.
- """
- data.validate_type('ticket', ticket, 'short')
- data.validate_type('queue', queue, 'shortstr')
- data.validate_type('passive', passive, 'bit')
- data.validate_type('durable', durable, 'bit')
- data.validate_type('exclusive', exclusive, 'bit')
- data.validate_type('auto_delete', auto_delete, 'bit')
- data.validate_type('nowait', nowait, 'bit')
- data.validate_type('arguments', arguments, 'table')
-
- return self.transport.rpc(Queue.Declare(ticket=ticket, queue=queue, passive=passive, durable=durable, exclusive=exclusive, auto_delete=auto_delete, nowait=nowait, arguments=arguments), callback,
- [Queue.DeclareOk])
-
- def queue_bind(self, callback=None, ticket=0, queue='', exchange=None, routing_key='', nowait=False, arguments={}):
- """
- Implements the Queue.Bind AMQP command. For context and usage:
-
- http://www.rabbitmq.com/amqp-0-9-1-quickref.html#queue.bind
-
- This is a synchronous method that will not allow other commands to be
- send to the AMQP broker until it has completed. It is recommended to
- pass in a parameter to callback to be notified when this command has
- completed.
- """
- data.validate_type('ticket', ticket, 'short')
- data.validate_type('queue', queue, 'shortstr')
- data.validate_type('exchange', exchange, 'shortstr')
- data.validate_type('routing_key', routing_key, 'shortstr')
- data.validate_type('nowait', nowait, 'bit')
- data.validate_type('arguments', arguments, 'table')
-
- return self.transport.rpc(Queue.Bind(ticket=ticket, queue=queue, exchange=exchange, routing_key=routing_key, nowait=nowait, arguments=arguments), callback,
- [Queue.BindOk])
-
- def queue_purge(self, callback=None, ticket=0, queue='', nowait=False):
- """
- Implements the Queue.Purge AMQP command. For context and usage:
-
- http://www.rabbitmq.com/amqp-0-9-1-quickref.html#queue.purge
-
- This is a synchronous method that will not allow other commands to be
- send to the AMQP broker until it has completed. It is recommended to
- pass in a parameter to callback to be notified when this command has
- completed.
- """
- data.validate_type('ticket', ticket, 'short')
- data.validate_type('queue', queue, 'shortstr')
- data.validate_type('nowait', nowait, 'bit')
-
- return self.transport.rpc(Queue.Purge(ticket=ticket, queue=queue, nowait=nowait), callback,
- [Queue.PurgeOk])
-
- def queue_delete(self, callback=None, ticket=0, queue='', if_unused=False, if_empty=False, nowait=False):
- """
- Implements the Queue.Delete AMQP command. For context and usage:
-
- http://www.rabbitmq.com/amqp-0-9-1-quickref.html#queue.delete
-
- This is a synchronous method that will not allow other commands to be
- send to the AMQP broker until it has completed. It is recommended to
- pass in a parameter to callback to be notified when this command has
- completed.
- """
- data.validate_type('ticket', ticket, 'short')
- data.validate_type('queue', queue, 'shortstr')
- data.validate_type('if_unused', if_unused, 'bit')
- data.validate_type('if_empty', if_empty, 'bit')
- data.validate_type('nowait', nowait, 'bit')
-
- return self.transport.rpc(Queue.Delete(ticket=ticket, queue=queue, if_unused=if_unused, if_empty=if_empty, nowait=nowait), callback,
- [Queue.DeleteOk])
-
- def queue_unbind(self, callback=None, ticket=0, queue='', exchange=None, routing_key='', arguments={}):
- """
- Implements the Queue.Unbind AMQP command. For context and usage:
-
- http://www.rabbitmq.com/amqp-0-9-1-quickref.html#queue.unbind
-
- This is a synchronous method that will not allow other commands to be
- send to the AMQP broker until it has completed. It is recommended to
- pass in a parameter to callback to be notified when this command has
- completed.
- """
- data.validate_type('ticket', ticket, 'short')
- data.validate_type('queue', queue, 'shortstr')
- data.validate_type('exchange', exchange, 'shortstr')
- data.validate_type('routing_key', routing_key, 'shortstr')
- data.validate_type('arguments', arguments, 'table')
-
- return self.transport.rpc(Queue.Unbind(ticket=ticket, queue=queue, exchange=exchange, routing_key=routing_key, arguments=arguments), callback,
- [Queue.UnbindOk])
-
- def basic_qos(self, callback=None, prefetch_size=0, prefetch_count=0, global_=False):
- """
- Implements the Basic.Qos AMQP command. For context and usage:
-
- http://www.rabbitmq.com/amqp-0-9-1-quickref.html#basic.qos
-
- This is a synchronous method that will not allow other commands to be
- send to the AMQP broker until it has completed. It is recommended to
- pass in a parameter to callback to be notified when this command has
- completed.
- """
- data.validate_type('prefetch_size', prefetch_size, 'long')
- data.validate_type('prefetch_count', prefetch_count, 'short')
- data.validate_type('global_', global_, 'bit')
-
- return self.transport.rpc(Basic.Qos(prefetch_size=prefetch_size, prefetch_count=prefetch_count, global_=global_), callback,
- [Basic.QosOk])
-
- def basic_get(self, callback=None, ticket=0, queue='', no_ack=False):
- """
- Implements the Basic.Get AMQP command. For context and usage:
-
- http://www.rabbitmq.com/amqp-0-9-1-quickref.html#basic.get
-
- This is a synchronous method that will not allow other commands to be
- send to the AMQP broker until it has completed. It is recommended to
- pass in a parameter to callback to be notified when this command has
- completed.
- """
- data.validate_type('ticket', ticket, 'short')
- data.validate_type('queue', queue, 'shortstr')
- data.validate_type('no_ack', no_ack, 'bit')
-
- return self.transport.rpc(Basic.Get(ticket=ticket, queue=queue, no_ack=no_ack), callback,
- [Basic.GetOk, Basic.GetEmpty])
-
- def basic_ack(self, delivery_tag=0, multiple=False):
- """
- Implements the basic.ack AMQP command. For context and usage:
-
- http://www.rabbitmq.com/amqp-0-9-1-quickref.html#basic.ack
- """
-
- data.validate_type('delivery_tag', delivery_tag, 'longlong')
- data.validate_type('multiple', multiple, 'bit')
- return self.transport.rpc(Basic.Ack(delivery_tag=delivery_tag, multiple=multiple))
-
- def basic_reject(self, delivery_tag=None, requeue=True):
- """
- Implements the basic.reject AMQP command. For context and usage:
-
- http://www.rabbitmq.com/amqp-0-9-1-quickref.html#basic.reject
- """
-
- data.validate_type('delivery_tag', delivery_tag, 'longlong')
- data.validate_type('requeue', requeue, 'bit')
- return self.transport.rpc(Basic.Reject(delivery_tag=delivery_tag, requeue=requeue))
-
- def basic_recover_async(self, requeue=False):
- """
- Implements the basic.recover-async AMQP command. For context and usage:
-
- http://www.rabbitmq.com/amqp-0-9-1-quickref.html#basic.recover_async
- """
-
- data.validate_type('requeue', requeue, 'bit')
- return self.transport.rpc(Basic.RecoverAsync(requeue=requeue))
-
- def basic_recover(self, callback=None, requeue=False):
- """
- Implements the Basic.Recover AMQP command. For context and usage:
-
- http://www.rabbitmq.com/amqp-0-9-1-quickref.html#basic.recover
-
- This is a synchronous method that will not allow other commands to be
- send to the AMQP broker until it has completed. It is recommended to
- pass in a parameter to callback to be notified when this command has
- completed.
- """
- data.validate_type('requeue', requeue, 'bit')
-
- return self.transport.rpc(Basic.Recover(requeue=requeue), callback,
- [Basic.RecoverOk])
-
- def tx_select(self, callback=None):
- """
- Implements the Tx.Select AMQP command. For context and usage:
-
- http://www.rabbitmq.com/amqp-0-9-1-quickref.html#tx.select
-
- This is a synchronous method that will not allow other commands to be
- send to the AMQP broker until it has completed. It is recommended to
- pass in a parameter to callback to be notified when this command has
- completed.
- """
-
- return self.transport.rpc(Tx.Select(), callback,
- [Tx.SelectOk])
-
- def tx_commit(self, callback=None):
- """
- Implements the Tx.Commit AMQP command. For context and usage:
-
- http://www.rabbitmq.com/amqp-0-9-1-quickref.html#tx.commit
-
- This is a synchronous method that will not allow other commands to be
- send to the AMQP broker until it has completed. It is recommended to
- pass in a parameter to callback to be notified when this command has
- completed.
- """
-
- return self.transport.rpc(Tx.Commit(), callback,
- [Tx.CommitOk])
-
- def tx_rollback(self, callback=None):
- """
- Implements the Tx.Rollback AMQP command. For context and usage:
-
- http://www.rabbitmq.com/amqp-0-9-1-quickref.html#tx.rollback
-
- This is a synchronous method that will not allow other commands to be
- send to the AMQP broker until it has completed. It is recommended to
- pass in a parameter to callback to be notified when this command has
- completed.
- """
-
- return self.transport.rpc(Tx.Rollback(), callback,
- [Tx.RollbackOk])
View
@@ -376,67 +376,6 @@ def fieldInitList(prefix, fields):
print ' return True'
print " return False"
print
- print
-
- print "class DriverMixin(object):"
-
- for m in spec.allMethods():
- if m.structName() in DRIVER_METHODS:
- acceptable_replies = DRIVER_METHODS[m.structName()]
- print
- anchor = pyize("%s.%s" % (m.klass.name, m.name))
- if 'immediate' in m.arguments:
- m.arguments.remove('immediate')
- if m.isSynchronous:
-
- #Synchronous events have a CPS callback parameter
- print " def %s(self, callback=None%s):" % \
- (pyize("%s_%s" % (m.klass.name, m.name)),
- fieldDeclList(m.arguments))
- print ' """'
- print ' Implements the %s AMQP command. For context and usage:' % m.structName()
- print
- print ' http://www.rabbitmq.com/amqp-0-9-1-quickref.html#%s' % anchor
- print
- print ' This is a synchronous method that will not allow other commands to be'
- print ' send to the AMQP broker until it has completed. It is recommended to'
- print ' pass in a parameter to callback to be notified when this command has'
- print ' completed.'
- print ' """'
-
- for argument in m.arguments:
- print " data.validate_type('%s', %s, '%s')" % \
- (pyize(argument.name), pyize(argument.name),
- argument.domain)
-
- print
- print " return self.transport.rpc(%s(%s), callback," % \
- (m.structName(),
- ', '.join(["%s=%s" % (pyize(f.name), pyize(f.name))
- for f in m.arguments]))
- print " [%s])" % \
- ', '.join(acceptable_replies)
-
- else:
- print " def %s(self%s):" % \
- (pyize("%s_%s" % (m.klass.name, m.name)),
- fieldDeclList(m.arguments))
- print ' """'
- print ' Implements the %s.%s AMQP command. For context and usage:' % (m.klass.name, m.name)
- print
- print ' http://www.rabbitmq.com/amqp-0-9-1-quickref.html#%s' % anchor
- print ' """'
- print
-
- for argument in m.arguments:
- print " data.validate_type('%s', %s, '%s')" % \
- (pyize(argument.name), pyize(argument.name),
- argument.domain)
-
- print " return self.transport.rpc(%s(%s))" % \
- (m.structName(),
- ', '.join(["%s=%s" % (pyize(f.name), pyize(f.name))
- for f in m.arguments]))
if __name__ == "__main__":
with open(PIKA_SPEC, 'w') as handle:

0 comments on commit 97b0976

Please sign in to comment.