Skip to content

Commit 4bba6b7

Browse files
authored
remove _t sufix from types (#509)
1 parent 7b8e64c commit 4bba6b7

95 files changed

Lines changed: 788 additions & 789 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## 1.0.0
44
* Introduce `:remove_link` action in pipelines and bins.
55
* Add children groups - a mechanism that allows refering to multiple children with a single identifier.
6-
* Rename `remove_child_t` action into `remove_children_t` and allow for removing a children group with a single action.
6+
* Rename `remove_child` action into `remove_children` and allow for removing a children group with a single action.
77
* Add an ability to spawn anonymous children.
88
* Replace `Membrane.Time.round_to_<unit_name>` with `Membrane.Time.as_<unit_name>/2` with second argument equal `:round`. Rename `Membrane.Time.round_to_timebase` to `Membrane.Time.divide_by_timebase/2`. [#494](https://github.com/membraneframework/membrane_core/pull/494)
99
* Remove `:playback` action. Introduce `:setup` action. [#496](https://github.com/membraneframework/membrane_core/pull/496)
@@ -13,6 +13,7 @@
1313
* Output pads working in `:pull` mode should have their `demand_unit` specified. If case it's not available, it's assumed that the pad handles demands in both `:bytes` and `:buffers` units.
1414
* Rename callbacks `handle_process/4` and `handle_write/4` to `handle_buffer/4` in [#506](https://github.com/membraneframework/membrane_core/pull/506)
1515
* The flow control of the pad is now set with a single `:flow_control` option instead of `:mode` and `:demand_mode` options.
16+
* Remove _t suffix from types [#509](https://github.com/membraneframework/membrane_core/pull/509)
1617

1718
## 0.11.0
1819
* Separate element_name and pad arguments in handle_element_{start, end}_of_stream signature [#219](https://github.com/membraneframework/membrane_core/issues/219)

guides/upgrading/v0.11.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ Rename `Membrane.Time.to_<unit name>/1` into `Membrane.Time.round_to_<unit name>
292292
```
293293

294294
## Update the children definitions
295-
Children defintions syntax (previously known as `ParentSpec`, after the name of a structure used to define children), that was used in `Membrane.Pipeline.Action.spec_t` and `Membrane.Bin.Action.spec_t` actions, has changed.
295+
Children definitions syntax (previously known as `ParentSpec`, after the name of a structure used to define children), that was used in `Membrane.Pipeline.Action.spec_t` and `Membrane.Bin.Action.spec_t` actions, has changed.
296296
Since there are quite a few changes concerning children definition, we have decided to present them in the subsections below.
297297

298298
### Update children names

lib/membrane/bin.ex

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,20 @@ defmodule Membrane.Bin do
2020
require Membrane.Core.Message
2121
require Membrane.Logger
2222

23-
@type state_t :: any()
23+
@type state :: any()
2424

25-
@type callback_return_t :: {[Action.t()], state_t()}
25+
@type callback_return :: {[Action.t()], state()}
2626

2727
@typedoc """
2828
Defines options that can be passed to `start_link/3` and received
2929
in `c:handle_init/2` callback.
3030
"""
31-
@type options_t :: struct | nil
31+
@type options :: struct | nil
3232

3333
@typedoc """
3434
Type that defines a bin name by which it is identified.
3535
"""
36-
@type name_t :: tuple() | atom()
36+
@type name :: tuple() | atom()
3737

3838
@doc """
3939
Callback invoked on initialization of bin.
@@ -44,8 +44,8 @@ defmodule Membrane.Bin do
4444
while `handle_init` should be used for things like parsing options, initializing state or
4545
spawning children.
4646
"""
47-
@callback handle_init(context :: CallbackContext.t(), options :: options_t) ::
48-
callback_return_t()
47+
@callback handle_init(context :: CallbackContext.t(), options :: options) ::
48+
callback_return()
4949

5050
@doc """
5151
Callback that is called when new pad has been added to bin. Executed
@@ -54,10 +54,10 @@ defmodule Membrane.Bin do
5454
Context passed to this callback contains additional field `:pad_options`.
5555
"""
5656
@callback handle_pad_added(
57-
pad :: Pad.ref_t(),
57+
pad :: Pad.ref(),
5858
context :: CallbackContext.t(),
59-
state :: state_t
60-
) :: callback_return_t
59+
state :: state
60+
) :: callback_return
6161

6262
@doc """
6363
Callback that is called when some pad of the bin has been removed. Executed
@@ -66,10 +66,10 @@ defmodule Membrane.Bin do
6666
Context passed to this callback contains additional field `:pad_options`.
6767
"""
6868
@callback handle_pad_removed(
69-
pad :: Pad.ref_t(),
69+
pad :: Pad.ref(),
7070
context :: CallbackContext.t(),
71-
state :: state_t
72-
) :: callback_return_t
71+
state :: state
72+
) :: callback_return
7373

7474
@doc """
7575
Callback invoked on bin startup, right after `c:handle_init/2`.
@@ -78,36 +78,36 @@ defmodule Membrane.Bin do
7878
"""
7979
@callback handle_setup(
8080
context :: CallbackContext.t(),
81-
state :: state_t
82-
) :: callback_return_t
81+
state :: state
82+
) :: callback_return
8383

8484
@doc """
8585
Callback invoked when bin switches the playback to `:playing`.
8686
"""
8787
@callback handle_playing(
8888
context :: CallbackContext.t(),
89-
state :: state_t
89+
state :: state
9090
) ::
91-
callback_return_t
91+
callback_return
9292

9393
@doc """
9494
Callback invoked when a notification comes in from an element.
9595
"""
9696
@callback handle_child_notification(
9797
notification :: Membrane.ChildNotification.t(),
98-
element :: Child.name_t(),
98+
element :: Child.name(),
9999
context :: CallbackContext.t(),
100-
state :: state_t
101-
) :: callback_return_t
100+
state :: state
101+
) :: callback_return
102102

103103
@doc """
104104
Callback invoked when a notification comes in from an parent.
105105
"""
106106
@callback handle_parent_notification(
107107
notification :: Membrane.ParentNotification.t(),
108108
context :: CallbackContext.t(),
109-
state :: state_t
110-
) :: callback_return_t
109+
state :: state
110+
) :: callback_return
111111

112112
@doc """
113113
Callback invoked when bin receives a message that is not recognized
@@ -118,58 +118,58 @@ defmodule Membrane.Bin do
118118
@callback handle_info(
119119
message :: any,
120120
context :: CallbackContext.t(),
121-
state :: state_t
122-
) :: callback_return_t
121+
state :: state
122+
) :: callback_return
123123

124124
@doc """
125125
Callback invoked when a child element starts processing stream via given pad.
126126
"""
127127
@callback handle_element_start_of_stream(
128-
child :: Child.name_t(),
129-
pad :: Pad.ref_t(),
128+
child :: Child.name(),
129+
pad :: Pad.ref(),
130130
context :: CallbackContext.t(),
131-
state :: state_t
132-
) :: callback_return_t
131+
state :: state
132+
) :: callback_return
133133

134134
@doc """
135135
Callback invoked when a child element finishes processing stream via given pad.
136136
"""
137137
@callback handle_element_end_of_stream(
138-
child :: Child.name_t(),
139-
pad :: Pad.ref_t(),
138+
child :: Child.name(),
139+
pad :: Pad.ref(),
140140
context :: CallbackContext.t(),
141-
state :: state_t
142-
) :: callback_return_t
141+
state :: state
142+
) :: callback_return
143143

144144
@doc """
145145
Callback invoked when children of `Membrane.ChildrenSpec` are started.
146146
"""
147147
@callback handle_spec_started(
148-
children :: [Child.name_t()],
148+
children :: [Child.name()],
149149
context :: CallbackContext.t(),
150-
state :: state_t
151-
) :: callback_return_t
150+
state :: state
151+
) :: callback_return
152152

153153
@doc """
154-
Callback invoked upon each timer tick. A timer can be started with `t:Membrane.Bin.Action.start_timer_t/0`
154+
Callback invoked upon each timer tick. A timer can be started with `t:Membrane.Bin.Action.start_timer/0`
155155
action.
156156
"""
157157
@callback handle_tick(
158158
timer_id :: any,
159159
context :: CallbackContext.t(),
160-
state :: state_t
161-
) :: callback_return_t
160+
state :: state
161+
) :: callback_return
162162

163163
@doc """
164164
A callback invoked when the bin is being removed by its parent.
165165
166-
By default it returns `t:Membrane.Bin.Action.terminate_t/0` with reason `:normal`.
166+
By default it returns `t:Membrane.Bin.Action.terminate/0` with reason `:normal`.
167167
"""
168168
@callback handle_terminate_request(
169169
context :: CallbackContext.t(),
170-
state_t
170+
state
171171
) ::
172-
callback_return_t()
172+
callback_return()
173173

174174
@optional_callbacks handle_init: 2,
175175
handle_pad_added: 3,

lib/membrane/bin/action.ex

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -19,92 +19,92 @@ defmodule Membrane.Bin.Action do
1919
2020
Untils the setup lasts, the component won't enter `:playing` playback.
2121
"""
22-
@type setup_t :: {:setup, :incomplete | :complete}
22+
@type setup :: {:setup, :incomplete | :complete}
2323

2424
@typedoc """
2525
Action that sends a message to a child identified by name.
2626
"""
27-
@type notify_child_t ::
28-
{:notify_child, {Child.name_t(), Membrane.ParentNotification.t()}}
27+
@type notify_child ::
28+
{:notify_child, {Child.name(), Membrane.ParentNotification.t()}}
2929

3030
@typedoc """
3131
Sends a message to the parent.
3232
"""
33-
@type notify_parent_t :: {:notify_parent, Membrane.ChildNotification.t()}
33+
@type notify_parent :: {:notify_parent, Membrane.ChildNotification.t()}
3434

3535
@typedoc """
3636
Action that instantiates children and links them according to `Membrane.ChildrenSpec`.
3737
3838
Children's playback is changed to the current bin playback.
3939
`c:Membrane.Parent.handle_spec_started/3` callback is executed once the children are spawned.
4040
"""
41-
@type spec_t :: {:spec, ChildrenSpec.t()}
41+
@type spec :: {:spec, ChildrenSpec.t()}
4242

4343
@typedoc """
4444
Action that stops, unlinks and removes specified child/children from the bin.
4545
4646
A child ref, list of children refs, children group id or a list of children group ids can be specified
4747
as an argument. In case you need to refer to a single child from a children group, use `Membrane.Child.ref/2`.
4848
"""
49-
@type remove_children_t ::
49+
@type remove_children ::
5050
{:remove_children,
51-
Child.ref_t()
52-
| [Child.ref_t()]
53-
| Membrane.Child.group_t()
54-
| [Membrane.Child.group_t()]}
51+
Child.ref()
52+
| [Child.ref()]
53+
| Membrane.Child.group()
54+
| [Membrane.Child.group()]}
5555

5656
@typedoc """
5757
Action that removes link, which relates to specified child and pad.
5858
5959
Removed link has to have dynamic pads on both ends.
6060
"""
61-
@type remove_link_t :: {:remove_link, {Child.name_t(), Pad.ref_t()}}
61+
@type remove_link :: {:remove_link, {Child.name(), Pad.ref()}}
6262

6363
@typedoc """
6464
Starts a timer that will invoke `c:Membrane.Bin.handle_tick/3` callback
6565
every `interval` according to the given `clock`.
6666
6767
The timer's `id` is passed to the `c:Membrane.Bin.handle_tick/3`
68-
callback and can be used for changing its interval via `t:timer_interval_t/0`
69-
or stopping it via `t:stop_timer_t/0`.
68+
callback and can be used for changing its interval via `t:timer_interval/0`
69+
or stopping it via `t:stop_timer/0`.
7070
7171
If `interval` is set to `:no_interval`, the timer won't issue any ticks until
72-
the interval is set with `t:timer_interval_t/0` action.
72+
the interval is set with `t:timer_interval/0` action.
7373
7474
If no `clock` is passed, parent clock is chosen.
7575
7676
Timers use `Process.send_after/3` under the hood.
7777
"""
78-
@type start_timer_t ::
78+
@type start_timer ::
7979
{:start_timer,
80-
{timer_id :: any, interval :: Ratio.t() | Membrane.Time.non_neg_t() | :no_interval}
81-
| {timer_id :: any, interval :: Ratio.t() | Membrane.Time.non_neg_t() | :no_interval,
80+
{timer_id :: any, interval :: Ratio.t() | Membrane.Time.non_neg() | :no_interval}
81+
| {timer_id :: any, interval :: Ratio.t() | Membrane.Time.non_neg() | :no_interval,
8282
clock :: Membrane.Clock.t()}}
8383

8484
@typedoc """
85-
Changes interval of a timer started with `t:start_timer_t/0`.
85+
Changes interval of a timer started with `t:start_timer/0`.
8686
8787
Permitted only from `c:Membrane.Bin.handle_tick/3`, unless the interval
8888
was previously set to `:no_interval`.
8989
9090
If the `interval` is `:no_interval`, the timer won't issue any ticks until
91-
another `t:timer_interval_t/0` action. Otherwise, the timer will issue ticks every
91+
another `t:timer_interval/0` action. Otherwise, the timer will issue ticks every
9292
new `interval`. The next tick after interval change is scheduled at
9393
`new_interval + previous_time`, where previous_time is the time of the latest
94-
tick or the time of returning `t:start_timer_t/0` action if no tick has been
94+
tick or the time of returning `t:start_timer/0` action if no tick has been
9595
sent yet. Note that if `current_time - previous_time > new_interval`, a burst
9696
of `div(current_time - previous_time, new_interval)` ticks is issued immediately.
9797
"""
98-
@type timer_interval_t ::
98+
@type timer_interval ::
9999
{:timer_interval,
100-
{timer_id :: any, interval :: Ratio.t() | Membrane.Time.non_neg_t() | :no_interval}}
100+
{timer_id :: any, interval :: Ratio.t() | Membrane.Time.non_neg() | :no_interval}}
101101

102102
@typedoc """
103-
Stops a timer started with `t:start_timer_t/0` action.
103+
Stops a timer started with `t:start_timer/0` action.
104104
105105
This action is atomic: stopping timer guarantees that no ticks will arrive from it.
106106
"""
107-
@type stop_timer_t :: {:stop_timer, timer_id :: any}
107+
@type stop_timer :: {:stop_timer, timer_id :: any}
108108

109109
@typedoc """
110110
Terminates bin with given reason.
@@ -120,7 +120,7 @@ defmodule Membrane.Bin.Action do
120120
terminates all the children with the reason `:shutdown`
121121
- If the reason is neither `:normal`, `:shutdown` nor `{:shutdown, term}`, an error is logged
122122
"""
123-
@type terminate_t :: {:terminate, reason :: :normal | :shutdown | {:shutdown, term} | term}
123+
@type terminate :: {:terminate, reason :: :normal | :shutdown | {:shutdown, term} | term}
124124

125125
@typedoc """
126126
Type describing actions that can be returned from bin callbacks.
@@ -129,14 +129,14 @@ defmodule Membrane.Bin.Action do
129129
other parts of framework.
130130
"""
131131
@type t ::
132-
setup_t
133-
| notify_child_t
134-
| notify_parent_t
135-
| spec_t
136-
| remove_children_t
137-
| remove_link_t
138-
| start_timer_t
139-
| timer_interval_t
140-
| stop_timer_t
141-
| terminate_t
132+
setup
133+
| notify_child
134+
| notify_parent
135+
| spec
136+
| remove_children
137+
| remove_link
138+
| start_timer
139+
| timer_interval
140+
| stop_timer
141+
| terminate
142142
end

lib/membrane/bin/callback_context.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ defmodule Membrane.Bin.CallbackContext do
1212
@type t :: %{
1313
:clock => Membrane.Clock.t(),
1414
:parent_clock => Membrane.Clock.t(),
15-
:pads => %{Membrane.Pad.ref_t() => Membrane.Bin.PadData.t()},
16-
:name => Membrane.Bin.name_t(),
17-
:children => %{Membrane.Child.name_t() => Membrane.ChildEntry.t()},
15+
:pads => %{Membrane.Pad.ref() => Membrane.Bin.PadData.t()},
16+
:name => Membrane.Bin.name(),
17+
:children => %{Membrane.Child.name() => Membrane.ChildEntry.t()},
1818
:playback => Membrane.Playback.t(),
1919
:resource_guard => Membrane.ResourceGuard.t(),
2020
:utility_supervisor => Membrane.UtilitySupervisor.t(),

0 commit comments

Comments
 (0)