-
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
Implement :remove_link action #487
Conversation
c8d180d
to
5935e9e
Compare
5935e9e
to
6114105
Compare
2a7b2ee
to
205a509
Compare
205a509
to
390e32f
Compare
390e32f
to
49000fd
Compare
49000fd
to
2d1dfc9
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.
General question - what is the expected behaviour when removing a link, with at least one endpoint being a static pad? Shouldn't we disallow such unlinking and raise some meaningful exception?
Nevertheless, I believe we should check that case in tests.
lib/membrane/bin/action.ex
Outdated
@@ -37,6 +37,11 @@ defmodule Membrane.Bin.Action do | |||
Child.name_t() | |||
| [Child.name_t()]} | |||
|
|||
@typedoc """ | |||
Actions that removes link, that realates to specified child and pad. |
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.
Actions that removes link, that realates to specified child and pad. | |
Action that removes link, which relates to specified child and pad. |
lib/membrane/pipeline/action.ex
Outdated
@@ -29,6 +29,11 @@ defmodule Membrane.Pipeline.Action do | |||
@type remove_child_t :: | |||
{:remove_child, Child.name_t() | [Child.name_t()]} | |||
|
|||
@typedoc """ | |||
Actions that removes link, that relates to specified child and pad. |
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.
Actions that removes link, that relates to specified child and pad. | |
Action that removes link, which relates to specified child and pad. |
end | ||
end | ||
|
||
defp assert_pad_removed(pipeline, id) do |
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 believe this function should be called assert_link_removed
(and the function below should be refute_link_removed
)
@varsill if you will try to unlink static pad using |
f1c6404
to
52eb2cb
Compare
Ok, that seems fair enough ;) Probably we don't need to test that though |
if pad_id < 10 do | ||
for i <- (pad_id + 1)..10 do | ||
refute_link_removed(pipeline, i) | ||
end | ||
end |
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 pad_id < 10 do | |
for i <- (pad_id + 1)..10 do | |
refute_link_removed(pipeline, i) | |
end | |
end | |
for i <- (pad_id + 1)..10//1 do | |
refute_link_removed(pipeline, i) | |
end |
|
||
nil -> | ||
raise LinkError, """ | ||
Attempted to unlink pad #{inspect(pad_ref)} of child #{inspect(child_name)}, but this child does not have this pad |
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.
Attempted to unlink pad #{inspect(pad_ref)} of child #{inspect(child_name)}, but this child does not have this pad | |
Attempted to unlink pad #{inspect(pad_ref)} of child #{inspect(child_name)}, but no such link exists |
We should probably first check if such a child exists to give a better error when it doesn't
@@ -42,6 +42,11 @@ defmodule Membrane.Bin.Action do | |||
| Membrane.Child.group_t() | |||
| [Membrane.Child.group_t()]} | |||
|
|||
@typedoc """ | |||
Action that removes link, which relates to specified child and pad. |
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.
Maybe let's note that only dynamic pads can be unlinked
with %{^child_name => _child_entry} <- state.children do | ||
raise ParentError, """ | ||
Attempted to unlink pad #{inspect(pad_ref)} of child #{inspect(child_name)}, but such a child does not exist | ||
""" | ||
end |
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.
Doesn't this check the opposite?
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 ;P
Related Jira Ticket: https://membraneframework.atlassian.net/jira/software/c/projects/MC/boards/5?modal=detail&selectedIssue=MC-8&assignee=5e85e45732b0710c1f88dd86