-
Notifications
You must be signed in to change notification settings - Fork 39
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
Refactor callback contexts #504
Conversation
43ef8b5
to
0dfdbd9
Compare
0dfdbd9
to
5499334
Compare
f2dafe6
to
cfe7ac6
Compare
b8ee62d
to
eb44237
Compare
eb44237
to
1bab5d4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIR we decided to document callback-specific fields in these callbacks' docs
@@ -7,13 +7,13 @@ defmodule Membrane.Core.Child.LifecycleController do | |||
@spec handle_parent_notification(Membrane.ParentNotification.t(), Membrane.Core.Child.state_t()) :: | |||
Membrane.Core.Child.state_t() | |||
def handle_parent_notification(notification, state) do | |||
context = Component.callback_context_generator(:child, ParentNotification, state) | |||
# context = Component.callback_context(state) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leftover
@@ -22,13 +22,13 @@ defmodule Membrane.Core.Parent.LifecycleController do | |||
@spec handle_setup(Parent.state_t()) :: Parent.state_t() | |||
def handle_setup(state) do | |||
Membrane.Logger.debug("Setup") | |||
context = Component.callback_context_generator(:parent, Setup, state) | |||
# context = Component.callback_context(state) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another leftover. There are more, fix them all
playback: Membrane.Playback.t(), | ||
resource_guard: Membrane.ResourceGuard.t(), | ||
utility_supervisor: Membrane.UtilitySupervisor.t() | ||
@type option_t :: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- It seems that the singular form is not needed (we can leave
options_t
only) - This should be called
optional_fields_t
orcallback_specific_fields_t
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will change a name, but singular form is used in Membrane.Core.Component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only to create the plural form again :P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but otherwise we would have to duplicate every option in code and put eg. {:incoming_demand, non_neg_integer()}
in Membrane.Core.Element.CallbackContext
and in Membrane.Core.Componenet
as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you know, how to do it without repeating every key and value type in these 2 modules, let me know
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Membrane.Core.Component
there should be an alternative of lists instead of a list with alternative:
options_t :: Membrane.Core.Element.CallbackContext.options_t | Membrane.Core.Bin.CallbackContext.options_t | Membrane.Core.Pipeline.CallbackContext.options_t
Related Jira ticket: https://membraneframework.atlassian.net/browse/MC-138