Skip to content

Commit

Permalink
Write upgrading guide for v1.0.0-rc1 (#625)
Browse files Browse the repository at this point in the history
  • Loading branch information
FelonEkonom authored Oct 3, 2023
1 parent fd16779 commit 4d4283d
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
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

0 comments on commit 4d4283d

Please sign in to comment.