1%%% -*- erlang -*- 2%%% 3%%% This file is part of couchbeam released under the MIT license. 4%%% See the NOTICE for more information. 5 6-module(couchbeam_changes_sup). 7 8 -behaviour(supervisor). 9 10%% API. 11-export([start_link/0]). 12 13%% supervisor. 14-export([init/1]). 15 16-define(SUPERVISOR, ?MODULE). 17 18%% API. 19 20-spec start_link() -> {ok, pid()}. 21start_link() -> 22 supervisor:start_link({local, ?SUPERVISOR}, ?MODULE, []). 23 24%% supervisor. 25 26init([]) -> 27 28 %% start table to keep async streams ref 29 ets:new(couchbeam_changes_streams, [set, public, named_table]), 30 31 %% define a stream spec 32 Stream = {couchbeam_changes_stream, 33 {couchbeam_changes_stream, start_link, []}, 34 temporary, infinity, worker, [couchbeam_changes_stream]}, 35 36 {ok, {{simple_one_for_one, 10, 3600}, [Stream]}}. 37