40
40
next_position :: non_neg_integer (),
41
41
finished :: boolean ()}).
42
42
43
+ -type state () :: # state {}.
44
+
43
45
% % Sleep interval when waiting for more data.
44
46
-define (INTERVAL , 300 ).
45
47
@@ -65,7 +67,7 @@ next(Continuation) ->
65
67
% %%===================================================================
66
68
67
69
% % @private
68
- -spec init ([term ()]) -> {ok , # state {} }.
70
+ -spec init ([term ()]) -> {ok , state () }.
69
71
init ([Unique , Function ]) ->
70
72
% % Generate an ets table to store results.
71
73
Tid = ets :new (Unique , []),
@@ -85,8 +87,8 @@ init([Unique, Function]) ->
85
87
finished = false }}.
86
88
87
89
% % @private
88
- -spec handle_call (term (), {pid (), term ()}, # state {} ) ->
89
- {reply , term (), # state {} }.
90
+ -spec handle_call (term (), {pid (), term ()}, state () ) ->
91
+ {reply , term (), state () }.
90
92
handle_call (iterator , _From , # state {tid = Tid }= State ) ->
91
93
{[Match ], Continuation } = ets :select (Tid , [{{'$1' , '$2' }, [], ['$2' ]}], 1 ),
92
94
{reply , {ok , {Match , Continuation }}, State };
@@ -97,12 +99,12 @@ handle_call(_Msg, _From, State) ->
97
99
{reply , ok , State }.
98
100
99
101
% % @private
100
- -spec handle_cast (term (), # state {}) -> {noreply , # state {} }.
102
+ -spec handle_cast (term (), state ()) -> {noreply , state () }.
101
103
handle_cast (_Msg , State ) ->
102
104
{noreply , State }.
103
105
104
106
% % @private
105
- -spec handle_info (term (), # state {}) -> {noreply , # state {} }.
107
+ -spec handle_info (term (), state ()) -> {noreply , state () }.
106
108
handle_info ({retry , From , Continuation }, # state {finished = Finished }= State ) ->
107
109
read (From , Finished , Continuation ),
108
110
{noreply , State };
@@ -122,12 +124,12 @@ handle_info(_Msg, State) ->
122
124
{noreply , State }.
123
125
124
126
% % @private
125
- -spec terminate (term (), # state {} ) -> term ().
127
+ -spec terminate (term (), state () ) -> term ().
126
128
terminate (_Reason , _State ) ->
127
129
ok .
128
130
129
131
% % @private
130
- -spec code_change (term () | {down , term ()}, # state {} , term ()) -> {ok , # state {} }.
132
+ -spec code_change (term () | {down , term ()}, state () , term ()) -> {ok , state () }.
131
133
code_change (_OldVsn , State , _Extra ) ->
132
134
{ok , State }.
133
135
0 commit comments