-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support returning a status from an async port as an alternate queue full behavior #555
Comments
@timcanham @LeStarch This seems like a good idea to me. Thoughts? |
I'm not sure this would be a specified queue full behavior at the receiver end. I think it would be a change to the port invocation interface. Any port type that does not have a return value in the FPP model (and so could be used in an asynchronous context) would have an implicit status return. Invoking the port would cause the status to be produced. If the port is connected to a sync port at the other end, it would always return OK. But if the port at the other end is async, it could return something else like QUEUE_FULL. |
I don't think you want to impact every output port that doesn't return a value. You'd either end up with lots of code sprinkled with Here's an alternative proposal: you could have a particular return type for a port that can be used in an asynchronous context.
This would not require a major change to how we handle port calls without return values in general. It would just open the door to returning a status from one particular kind of async port. This status would be returned by the autocoded port implementation when it enqueues or fails to enqueue the message. |
It might be OK to require a check or a cast to If we wanted to be more rigorous in the model, we could allow an output port instance P to specify that it must be connected to a sync input port; in this case the code generator would omit the status return for the port invocation function for P. However, this would limit the contexts in which the output port could be used. If an output port P has port type T, and T returns data, then we know that P cannot be connected to an async input port. Otherwise I don't think we should use the port type T to determine whether the output invocation function for P returns a status. The status return depends on the kind of connection (sync or async) and not on the port type. Also, it's a common pattern to use the same port type in different contexts (sync and async) in different components. |
Also, the status is not the return type of the input port handler -- an async input handler never gets called unless the message went through the queue, and it always has return type |
I think we're talking past each other. Let's schedule a meeting to discuss this. |
Sounds good. |
Currently there is no easy way for the sender of a message on an async port to observe whether the queue is full.
Let's look at adding a queue full behavior that returns a status instead of either dropping or invoking a behavior on the receiver. For example,
OK
if the message was successfully placed on the queue, andDROPPED
if the message was dropped.The text was updated successfully, but these errors were encountered: