5353-type ets_concurrency () :: none | read_only | write_only | read_and_write .
5454-export_type ([ets_concurrency / 0 ]).
5555
56- -spec start_link () -> {ok , pid ()}.
57- -spec create_ets_table (ets_concurrency ()) -> ets :tid ().
58- -spec create_ets_table (atom (), ets_concurrency ()) -> ets :tid ().
59- -spec delete_ets_table (atom () | ets :tid ()) -> ok .
60- -spec change_owner (atom () | ets :tid (), pid ()) -> ok .
56+ -spec start_link () -> {ok , pid ()}.
57+ -spec create_ets_table (ets_concurrency ()) -> ets :tid ().
58+ -spec create_ets_table (atom (), ets_concurrency ()) -> ets :tid ().
59+ -spec delete_ets_table (atom () | ets :tid ()) -> ok .
60+ -spec change_owner (atom () | ets :tid (), pid ()) -> ok .
6161
6262start_link () ->
6363 gen_fsm :start_link ({local , ? SERVER }, ? MODULE , {}, []).
@@ -76,7 +76,8 @@ delete_ets_table(Table_Id_Or_Name) ->
7676 ok .
7777
7878change_owner (Table_Id_Or_Name , New_Owner ) ->
79- gen_fsm :sync_send_event (? SERVER , {change_owner , Table_Id_Or_Name , New_Owner }).
79+ true = gen_fsm :sync_send_event (? SERVER , {change_owner , Table_Id_Or_Name , New_Owner }),
80+ ok .
8081
8182make_options (none ) -> make_base_options ([]);
8283make_options (read_only ) -> make_base_options ([{read_concurrency , true }]);
@@ -92,13 +93,14 @@ make_base_options(Concurrency_Options) ->
9293% %% gen_fsm callbacks
9394% %%===================================================================
9495
95- -type internal_state () :: # eef_state {}.
96- -type state_name () :: 'READY' .
97- -type create_ets_cmd () :: {create_ets_table , proplists :proplist ()}
98- | {create_ets_table , Name :: atom (), proplists :proplist ()}.
99- -type delete_ets_cmd () :: {delete_ets_table , ets :tid () | atom ()}.
100- -type stop_cmd () :: stop .
101- % % -type ready_cmds() :: create_ets_cmd() | delete_ets_cmd() | stop_cmd().
96+ -type internal_state () :: # eef_state {}.
97+ -type state_name () :: 'READY' .
98+ -type create_ets_cmd () :: {create_ets_table , proplists :proplist ()}
99+ | {create_ets_table , Name :: atom (), proplists :proplist ()}.
100+ -type delete_ets_cmd () :: {delete_ets_table , ets :tid () | atom ()}.
101+ -type change_owner_cmd () :: {change_owner , ets :tid () | atom (), pid ()}.
102+ -type stop_cmd () :: stop .
103+ % % -type ready_cmds() :: create_ets_cmd() | delete_ets_cmd() | change_owner_cmd() | stop_cmd().
102104
103105-spec init ({}) -> {ok , 'READY' , internal_state ()}.
104106-spec terminate (any (), state_name (), internal_state ()) -> ok .
@@ -112,9 +114,10 @@ code_change (_OldVsn, State_Name, #eef_state{} = State, _Extra) -> {ok, State_N
112114
113115% % The FSM has only the 'READY' state.
114116-type from () :: {pid (), reference ()}.
115- -spec 'READY' (create_ets_cmd (), from (), internal_state ()) -> ets :tid ();
116- (delete_ets_cmd (), from (), internal_state ()) -> true ;
117- (stop_cmd (), from (), internal_state ()) -> {stop , normal }.
117+ -spec 'READY' (create_ets_cmd (), from (), internal_state ()) -> ets :tid ();
118+ (delete_ets_cmd (), from (), internal_state ()) -> true ;
119+ (change_owner_cmd (), from (), internal_state ()) -> true ;
120+ (stop_cmd (), from (), internal_state ()) -> {stop , normal }.
118121
119122-define (READY (__Cmd ), 'READY' (__Cmd , _From , # eef_state {} = State )).
120123-define (REPLY (__Reply ), {reply , __Reply , 'READY' , State }).
0 commit comments