Skip to content

Commit

Permalink
Document the etorrent_io_sup code.
Browse files Browse the repository at this point in the history
  • Loading branch information
jlouis committed Jan 13, 2011
1 parent a89afba commit e0533be
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions apps/etorrent/src/etorrent_io_sup.erl
@@ -1,14 +1,26 @@
%% @author Magnus Klaar <magnus.klaar@sgsstudentbostader.se>
%% @doc Supervise a set of file system processes
%% <p>This supervisor is responsible for overseeing the file system
%% processes for a single torrent.</p>
%% @end
-module(etorrent_io_sup).
-behaviour(supervisor).
-include("types.hrl").

-export([start_link/2]).
-export([init/1]).

%% @doc Initiate the supervisor.
%% <p>The arguments are the ID of the torrent and the file-path at
%% which the torrent file lives</p>
%% @end
-spec start_link(torrent_id(), file_path()) -> {'ok', pid()}.
start_link(TorrentID, TorrentFile) ->
supervisor:start_link(?MODULE, [TorrentID, TorrentFile]).

%% ----------------------------------------------------------------------

%% @private
init([TorrentID, TorrentFile]) ->
Workdir = etorrent_config:work_dir(),
FullPath = filename:join([Workdir, TorrentFile]),
Expand All @@ -18,6 +30,7 @@ init([TorrentID, TorrentFile]) ->
FileSup = file_server_sup_spec(TorrentID, Workdir, Files),
{ok, {{one_for_one, 1, 60}, [DirServer, FileSup]}}.

%% ----------------------------------------------------------------------
directory_server_spec(TorrentID, Torrent) ->
{{TorrentID, directory},
{etorrent_io, start_link, [TorrentID, Torrent]},
Expand Down

0 comments on commit e0533be

Please sign in to comment.