You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rh...@apache.org on 2015/01/17 15:26:04 UTC
[2/2] qpid-proton git commit: python bindings for reactor selectables
python bindings for reactor selectables
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/5a10b780
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/5a10b780
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/5a10b780
Branch: refs/heads/master
Commit: 5a10b78034907c322508ee24d770b65babe53ea6
Parents: 03ecbaa
Author: Rafael Schloming <rh...@alum.mit.edu>
Authored: Sat Jan 17 09:25:42 2015 -0500
Committer: Rafael Schloming <rh...@alum.mit.edu>
Committed: Sat Jan 17 09:25:42 2015 -0500
----------------------------------------------------------------------
proton-c/bindings/python/proton/__init__.py | 7 ++++++-
proton-c/bindings/python/proton/reactors.py | 10 +++++++++-
proton-c/include/proton/cproton.i | 1 +
proton-c/src/reactor/reactor.c | 5 +++++
.../main/java/org/apache/qpid/proton/engine/Event.java | 6 +++++-
proton-j/src/main/resources/cengine.py | 3 +++
6 files changed, 29 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5a10b780/proton-c/bindings/python/proton/__init__.py
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/proton/__init__.py b/proton-c/bindings/python/proton/__init__.py
index ec1894d..936d61d 100644
--- a/proton-c/bindings/python/proton/__init__.py
+++ b/proton-c/bindings/python/proton/__init__.py
@@ -3258,7 +3258,8 @@ wrappers = {
"pn_session": lambda x: Session.wrap(pn_cast_pn_session(x)),
"pn_link": lambda x: Link.wrap(pn_cast_pn_link(x)),
"pn_delivery": lambda x: Delivery.wrap(pn_cast_pn_delivery(x)),
- "pn_transport": lambda x: Transport.wrap(pn_cast_pn_transport(x))
+ "pn_transport": lambda x: Transport.wrap(pn_cast_pn_transport(x)),
+ "pn_selectable": lambda x: Selectable.wrap(pn_cast_pn_selectable(x))
}
class Collector:
@@ -3353,6 +3354,10 @@ class Event(Wrapper, EventBase):
TRANSPORT_TAIL_CLOSED = EventType(PN_TRANSPORT_TAIL_CLOSED, "on_transport_tail_closed")
TRANSPORT_CLOSED = EventType(PN_TRANSPORT_CLOSED, "on_transport_closed")
+ SELECTABLE_READABLE = EventType(PN_SELECTABLE_READABLE, "on_selectable_readable")
+ SELECTABLE_WRITABLE = EventType(PN_SELECTABLE_WRITABLE, "on_selectable_writable")
+ SELECTABLE_EXPIRED = EventType(PN_SELECTABLE_EXPIRED, "on_selectable_expired")
+
@staticmethod
def wrap(impl):
if impl is None:
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5a10b780/proton-c/bindings/python/proton/reactors.py
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/proton/reactors.py b/proton-c/bindings/python/proton/reactors.py
index 2a4fd5a..b70bf7e 100644
--- a/proton-c/bindings/python/proton/reactors.py
+++ b/proton-c/bindings/python/proton/reactors.py
@@ -835,7 +835,7 @@ class Container(object):
def do_work(self, timeout=None):
return self.loop.do_work(timeout)
-from proton import WrappedHandler, _chandler, Connection, secs2millis
+from proton import WrappedHandler, _chandler, Connection, secs2millis, Selectable
from wrapper import Wrapper
from cproton import *
@@ -903,6 +903,14 @@ class Reactor(Wrapper):
pn_decref(impl)
return result
+ def selectable(self):
+ impl = pn_reactor_selectable(self._impl)
+ pn_selectable_collect(impl, pn_reactor_collector(self._impl))
+ return Selectable.wrap(impl)
+
+ def update(self, sel):
+ pn_reactor_update(self._impl, sel._impl)
+
from proton import wrappers as _wrappers
_wrappers["pn_reactor"] = lambda x: Reactor.wrap(pn_cast_pn_reactor(x))
_wrappers["pn_task"] = lambda x: Task.wrap(pn_cast_pn_task(x))
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5a10b780/proton-c/include/proton/cproton.i
----------------------------------------------------------------------
diff --git a/proton-c/include/proton/cproton.i b/proton-c/include/proton/cproton.i
index 17a8c37..bf800a0 100644
--- a/proton-c/include/proton/cproton.i
+++ b/proton-c/include/proton/cproton.i
@@ -1396,6 +1396,7 @@ typedef unsigned long int uintptr_t;
pn_transport_t *pn_cast_pn_transport(void *x) { return (pn_transport_t *) x; }
pn_reactor_t *pn_cast_pn_reactor(void *x) { return (pn_reactor_t *) x; }
pn_task_t *pn_cast_pn_task(void *x) { return (pn_task_t *) x; }
+ pn_selectable_t *pn_cast_pn_selectable(void *x) { return (pn_selectable_t *) x; }
%}
%include "proton/url.h"
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5a10b780/proton-c/src/reactor/reactor.c
----------------------------------------------------------------------
diff --git a/proton-c/src/reactor/reactor.c b/proton-c/src/reactor/reactor.c
index f654c4f..0c30fce 100644
--- a/proton-c/src/reactor/reactor.c
+++ b/proton-c/src/reactor/reactor.c
@@ -270,6 +270,11 @@ pn_reactor_t *pn_event_reactor(pn_event_t *event) {
pn_record_t *record = pn_connection_attachments(conn);
return pni_record_get_reactor(record);
}
+ case CID_pn_selectable:
+ {
+ pn_selectable_t *sel = (pn_selectable_t *) pn_event_context(event);
+ return (pn_reactor_t *) pni_selectable_get_context(sel);
+ }
default:
return NULL;
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5a10b780/proton-j/src/main/java/org/apache/qpid/proton/engine/Event.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/engine/Event.java b/proton-j/src/main/java/org/apache/qpid/proton/engine/Event.java
index 36d1a7b..1970085 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/engine/Event.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/engine/Event.java
@@ -67,7 +67,11 @@ public interface Event
TRANSPORT_ERROR,
TRANSPORT_HEAD_CLOSED,
TRANSPORT_TAIL_CLOSED,
- TRANSPORT_CLOSED
+ TRANSPORT_CLOSED,
+
+ SELECTABLE_READABLE,
+ SELECTABLE_WRITABLE,
+ SELECTABLE_EXPIRED
}
Type getType();
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5a10b780/proton-j/src/main/resources/cengine.py
----------------------------------------------------------------------
diff --git a/proton-j/src/main/resources/cengine.py b/proton-j/src/main/resources/cengine.py
index ad70587..5c0de79 100644
--- a/proton-j/src/main/resources/cengine.py
+++ b/proton-j/src/main/resources/cengine.py
@@ -984,6 +984,9 @@ PN_TRANSPORT_ERROR = Event.Type.TRANSPORT_ERROR
PN_TRANSPORT_HEAD_CLOSED = Event.Type.TRANSPORT_HEAD_CLOSED
PN_TRANSPORT_TAIL_CLOSED = Event.Type.TRANSPORT_TAIL_CLOSED
PN_TRANSPORT_CLOSED = Event.Type.TRANSPORT_CLOSED
+PN_SELECTABLE_READABLE = Event.Type.SELECTABLE_READABLE
+PN_SELECTABLE_WRITABLE = Event.Type.SELECTABLE_WRITABLE
+PN_SELECTABLE_EXPIRED = Event.Type.SELECTABLE_EXPIRED
def pn_collector():
return Proton.collector()
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org