1 %%%-------------------------------------------------------------------
2 %%% File : etorrent_fs_pool_sup.erl
3 %%% Author : Jesper Louis Andersen <>
4 %%% Description : Supervise a set of file system processes.
6 %%% Created : 21 Aug 2007 by Jesper Louis Andersen <>
7 %%%-------------------------------------------------------------------
8 -module(etorrent_fs_pool_sup
).
10 -behaviour(supervisor
).
13 -export([start_link
/0, add_file_process
/3]).
15 %% Supervisor callbacks
18 -define(SERVER
, ?MODULE
).
20 %%====================================================================
22 %%====================================================================
23 %%--------------------------------------------------------------------
24 %% Function: start_link() -> {ok,Pid} | ignore | {error,Error}
25 %% Description: Starts the supervisor
26 %%--------------------------------------------------------------------
28 supervisor:start_link(?MODULE
, []).
30 %%--------------------------------------------------------------------
31 %% Function: add_file_process/2
32 %% Description: Add a new process for maintaining a file.
33 %%--------------------------------------------------------------------
34 add_file_process(Pid
, TorrentId
, Path
) ->
35 supervisor:start_child(Pid
, [Path
, TorrentId
]).
37 %%====================================================================
38 %% Supervisor callbacks
39 %%====================================================================
41 FSProcesses
= {'FSPROCESS',
42 {etorrent_fs_process
, start_link
, []},
43 transient
, 2000, worker
, [etorrent_fs_process
]},
44 {ok
, {{simple_one_for_one
, 1, 60}, [FSProcesses
]}}.
46 %%====================================================================
48 %%====================================================================