-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove in-pull direction from event processing and transport layers
* New direction names: out -> out in-push -> in in-pull removed * Remove `rsb.event-processing:pull-processor' * Remove in-pull- connector variants from all transports fixes #3
- Loading branch information
Showing
33 changed files
with
118 additions
and
468 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
;;;; in-route-configurator.lisp --- Configurator for incoming event route. | ||
;;;; | ||
;;;; Copyright (C) 2011-2017 Jan Moringen | ||
;;;; Copyright (C) 2011-2018 Jan Moringen | ||
;;;; | ||
;;;; Author: Jan Moringen <[email protected]> | ||
|
||
|
@@ -18,14 +18,12 @@ | |
The client generally is an event receiving participant.")) | ||
|
||
(defmethod collect-processor-mixins append ((configurator in-route-configurator)) | ||
`(error-policy-handler-mixin | ||
'(error-policy-handler-mixin | ||
restart-handler-mixin | ||
restart-dispatcher-mixin | ||
filtering-processor-mixin | ||
deliver-timestamp-mixin | ||
,(ecase (configurator-direction configurator) | ||
(:in-push 'broadcast-processor) | ||
(:in-pull 'pull-processor)))) | ||
broadcast-processor)) | ||
|
||
;;; Connectors | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
;;;; listener.lisp --- Listeners receive events that are broadcast on a bus. | ||
;;;; | ||
;;;; Copyright (C) 2011, 2012, 2013, 2014, 2015 Jan Moringen | ||
;;;; Copyright (C) 2011-2018 Jan Moringen | ||
;;;; | ||
;;;; Author: Jan Moringen <[email protected]> | ||
|
||
(cl:in-package #:rsb) | ||
|
||
(defclass listener (receiving-client) | ||
((direction :allocation :class | ||
:initform :in-push) | ||
:initform :in) | ||
(handlers :type list | ||
:accessor rsb.ep:handlers | ||
:initform '() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
;;;; participant.lisp --- A superclass for participant classes. | ||
;;;; | ||
;;;; Copyright (C) 2011-2017 Jan Moringen | ||
;;;; Copyright (C) 2011-2018 Jan Moringen | ||
;;;; | ||
;;;; Author: Jan Moringen <[email protected]> | ||
|
||
|
@@ -74,8 +74,8 @@ | |
(list (cons t converters)))) | ||
(configurator (make-instance | ||
(ecase direction | ||
((:in-push :in-pull) 'rsb.ep:in-route-configurator) | ||
(:out 'rsb.ep:out-route-configurator)) | ||
(:in 'rsb.ep:in-route-configurator) | ||
(:out 'rsb.ep:out-route-configurator)) | ||
:scope scope | ||
:direction direction | ||
:transform transform)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,21 @@ | ||
;;;; connector-mixins.lisp --- Mixin for connector classes. | ||
;;;; | ||
;;;; Copyright (C) 2011-2017 Jan Moringen | ||
;;;; Copyright (C) 2011-2018 Jan Moringen | ||
;;;; | ||
;;;; Author: Jan Moringen <[email protected]> | ||
|
||
(cl:in-package #:rsb.transport) | ||
|
||
;;; Mixin class `error-handling-pull-receiver-mixin' | ||
;;; Mixin class `error-handling-receiver-mixin' | ||
|
||
(defclass error-handling-pull-receiver-mixin (error-policy-mixin) | ||
(defclass error-handling-receiver-mixin (error-policy-mixin) | ||
() | ||
(:documentation | ||
"This class is intended to be mixed into in-direction, pull-style | ||
connector classes to provide client-supplied error handling policies | ||
for the `emit' method.")) | ||
|
||
(defmethod emit :around ((connector error-handling-pull-receiver-mixin) | ||
(block? t)) | ||
;; Call the actual `emit' method with a condition handler that | ||
;; applies the error policy of CONNECTOR. | ||
(with-error-policy (connector) (call-next-method))) | ||
|
||
;;; Mixin class `error-handling-push-receiver-mixin' | ||
|
||
(defclass error-handling-push-receiver-mixin (error-policy-mixin) | ||
() | ||
(:documentation | ||
"This class is intended to be mixed into in-direction, push-style | ||
connector classes to provide client-supplied error handling policies | ||
for the `receive-messages' method.")) | ||
"This class is intended to be mixed into in-direction connector | ||
classes to provide client-supplied error handling policies for the | ||
`receive-messages' method.")) | ||
|
||
(defmethod receive-messages :around ((connector error-handling-push-receiver-mixin)) | ||
(defmethod receive-messages :around ((connector error-handling-receiver-mixin)) | ||
;; Call the actual `receive-messages' method with a condition | ||
;; handler that applies the error policy of CONNECTOR. | ||
(with-error-policy (connector) (call-next-method))) | ||
|
@@ -172,9 +157,7 @@ converter.")) | |
"This class is intended to be mixed into connector classes that | ||
perform two tasks: | ||
1) receive notifications | ||
2) decode received notifications | ||
The associated protocol is designed to be | ||
direction-agnostic (i.e. should work for both push and pull).")) | ||
2) decode received notifications")) | ||
|
||
(defmethod notification->event :around ((connector timestamping-receiver-mixin) | ||
(notification t) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
;;;; connectors.lisp --- Connectors of the inprocess transport. | ||
;;;; | ||
;;;; Copyright (C) 2011-2016 Jan Moringen | ||
;;;; Copyright (C) 2011-2018 Jan Moringen | ||
;;;; | ||
;;;; Author: Jan Moringen <[email protected]> | ||
|
||
|
@@ -28,12 +28,18 @@ | |
|
||
;;; `in-connector' | ||
|
||
(defclass in-connector (connector) | ||
(defclass in-connector (broadcast-processor | ||
error-policy-handler-mixin | ||
restart-handler-mixin | ||
restart-dispatcher-mixin | ||
connector) | ||
() | ||
(:metaclass connector-class) | ||
(:direction :in) | ||
(:documentation | ||
"Superclass for in-direction connector classes of the inprocess | ||
transport.")) | ||
"Receives events from the in-process bus.")) | ||
|
||
(register-connector :inprocess :in 'in-connector) | ||
|
||
(defmethod notify ((connector in-connector) | ||
(scope scope) | ||
|
@@ -55,75 +61,7 @@ | |
(log:debug "~@<Scope trie after removing ~A:~@:_~/rsb.ep::print-trie/~@:>" | ||
connector scope-sinks))) | ||
|
||
;;; `in-pull-connector' class | ||
|
||
(defclass in-pull-connector (broadcast-processor | ||
error-handling-pull-receiver-mixin | ||
restart-dispatcher-mixin | ||
in-connector) | ||
((queue :type lparallel.queue:queue | ||
:reader connector-queue | ||
:initform (lparallel.queue:make-queue) | ||
:documentation | ||
"Stores events as they arrive via the message bus.")) | ||
(:metaclass connector-class) | ||
(:direction :in-pull) | ||
(:documentation | ||
"Instances of this connector class deliver RSB events within a | ||
process.")) | ||
|
||
(register-connector :inprocess :in-pull 'in-pull-connector) | ||
|
||
(defmethod handle ((connector in-pull-connector) | ||
(event event)) | ||
;; Put EVENT into the queue maintained by CONNECTOR. | ||
(lparallel.queue:push-queue event (connector-queue connector))) | ||
|
||
(defmethod receive-notification ((connector in-pull-connector) | ||
(block? (eql nil))) | ||
;; Extract and return one event from the queue maintained by | ||
;; CONNECTOR, if there are any. If there are no queued events, | ||
;; return nil. | ||
(lparallel.queue:try-pop-queue (connector-queue connector))) | ||
|
||
(defmethod receive-notification ((connector in-pull-connector) | ||
(block? t)) | ||
;; Extract and return one event from the queue maintained by | ||
;; CONNECTOR, if there are any. If there are no queued events, | ||
;; block. | ||
(lparallel.queue:pop-queue (connector-queue connector))) | ||
|
||
(defmethod emit ((connector in-pull-connector) (block? t)) | ||
(when-let ((event (receive-notification connector block?))) | ||
(setf (timestamp event :receive) (local-time:now)) | ||
(dispatch connector event) | ||
t)) | ||
|
||
(defmethod print-object ((object in-pull-connector) stream) | ||
(print-unreadable-object (object stream :identity t) | ||
(format stream "~A ~A (~D)" | ||
(connector-direction object) | ||
(connector-relative-url object "/") | ||
(lparallel.queue:queue-count | ||
(connector-queue object))))) | ||
|
||
;;; `in-push-connector' class | ||
|
||
(defclass in-push-connector (broadcast-processor | ||
error-policy-handler-mixin | ||
restart-handler-mixin | ||
restart-dispatcher-mixin | ||
in-connector) | ||
() | ||
(:metaclass connector-class) | ||
(:direction :in-push) | ||
(:documentation | ||
"Instances of this connector class deliver RSB events within a | ||
process.")) | ||
|
||
(register-connector :inprocess :in-push 'in-push-connector) | ||
|
||
(defmethod handle :before ((connector in-push-connector) | ||
(defmethod handle :before ((connector in-connector) | ||
(event event)) | ||
(setf (timestamp event :receive) (local-time:now))) | ||
|
||
|
@@ -138,8 +76,7 @@ | |
(:metaclass connector-class) | ||
(:direction :out) | ||
(:documentation | ||
"Instances of this connector class deliver RSB events within a | ||
process.")) | ||
"Send events to the in-process bus.")) | ||
|
||
(register-connector :inprocess :out 'out-connector) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
;;;; package.lisp --- Package definition for the transport module. | ||
;;;; | ||
;;;; Copyright (C) 2011-2016 Jan Moringen | ||
;;;; Copyright (C) 2011-2016, 2018 Jan Moringen | ||
;;;; | ||
;;;; Author: Jan Moringen <[email protected]> | ||
|
||
|
@@ -134,9 +134,7 @@ | |
|
||
;; Error handling mixin classes | ||
(:export | ||
#:error-handling-push-receiver-mixin | ||
|
||
#:error-handling-pull-receiver-mixin | ||
#:error-handling-receiver-mixin | ||
|
||
#:error-handling-sender-mixin) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.