Skip to content
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

Write upgrading guide for v1.0.0-rc1 #625

Merged
merged 1 commit into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions guides/upgrading/v1.0.0-rc1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Upgrading to v1.0.0-rc1

### Remove `handle_buffers_batch/4`/`handle_process_list/4`/`handle_write_list/4` callback

In `v1.0.0-rc1` we removed `handle_buffers_batch/4` callback. Instead of handling list of buffer in this callback, you have to handle every single buffer separately in `hanlde_buffer/4` callback.

```diff
@impl true
- def handle_buffers_batch(pad_ref, buffers_list, ctx, state) do
+ def handle_buffer(pad_ref, buffer, ctx, state) do
...
end
```

Notice, if you are upgrading your code from `v0.12.*` directly to `v1.0.0-rc1`, omitting `v1.0.0-rc0`, there is a chance, that your elements still have callback named `handle_process_list/4` or `handle_write_list/4`, instead of `handle_buffers_batch/4`.

```diff
@impl true
- def handle_process_list(pad_ref, buffers_list, ctx, state) do
+ def handle_buffer(pad_ref, buffer, ctx, state) do
...
end
```

```diff
@impl true
- def handle_write_list(pad_ref, buffers_list, ctx, state) do
+ def handle_buffer(pad_ref, buffer, ctx, state) do
...
end
```

### Implement you own `start/*`, `start_link/*` or `terminate/1` function (if you want to)

Until `v1.0.0-rc0`, Membrane has generated `start/2`, `start_link/2`, and `terminate/1` functions in modules using `Membrane.Pipeline`, if code developer hadn't done it explicitly. Since `v1.0.0-rc1`, if you want to have these functions implemented in your pipeline module, you have to implement them on your own. Alternatively, you can always call `Membrane.Pipeline.start(YourPipelineModule, init_arg, opts)`, `Membrane.Pipeline.start_link(YourPipelineModule, init_arg, opts)`, and `Membrane.Pipeline.terminate(pipeline_pid)` from beyond `YourPipelineModule` without wrapping it into public functions.

### Rename `:structure` option passed to the `Membrane.Testing.Pipeline` into `:spec`

```diff
import Membrane.ChildrenSpec

spec =
child(:source, %Membrane.Testing.Source{some_field: some_arg})
|> child(:sink), %Membrane.Testing.Sink{another_filed: another_arg}

- pipeline = Membrane.Testing.Pipeline.start_link_supervised(structure: spec)
+ pipeline = Membrane.Testing.Pipeline.start_link_supervised(spec: spec)
```
1 change: 1 addition & 0 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ defmodule Membrane.Mixfile do
"CONTRIBUTING.md",
"guides/upgrading/v0.11.md",
"guides/upgrading/v1.0.0-rc0.md",
"guides/upgrading/v1.0.0-rc1.md",
LICENSE: [title: "License"]
],
formatters: ["html"],
Expand Down