forked from benoitc/couchbeam
-
Notifications
You must be signed in to change notification settings - Fork 0
/
couchbeam_changes.html
146 lines (126 loc) · 7.69 KB
/
couchbeam_changes.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Module couchbeam_changes</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="EDoc">
</head>
<body bgcolor="white">
<div class="navbar"><a name="#navbar_top"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
<hr>
<h1>Module couchbeam_changes</h1>
<ul class="index"><li><a href="#index">Function Index</a></li><li><a href="#functions">Function Details</a></li></ul>
<h2><a name="index">Function Index</a></h2>
<table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#changes_loop-3">changes_loop/3</a></td><td></td></tr>
<tr><td valign="top"><a href="#continuous_acceptor-2">continuous_acceptor/2</a></td><td>(<em>Deprecated</em>.) initiate continuous loop.</td></tr>
<tr><td valign="top"><a href="#fetch-1">fetch/1</a></td><td>Equivalent to <a href="#fetch-2"><tt>fetch(Db, [])</tt></a>.
</td></tr>
<tr><td valign="top"><a href="#fetch-2">fetch/2</a></td><td>Collect Changes.</td></tr>
<tr><td valign="top"><a href="#parse_changes_options-1">parse_changes_options/1</a></td><td>parse changes options and return a changes_args record.</td></tr>
<tr><td valign="top"><a href="#stream-2">stream/2</a></td><td>Equivalent to <a href="#stream-3"><tt>stream(Db, Client, [])</tt></a>.
</td></tr>
<tr><td valign="top"><a href="#stream-3">stream/3</a></td><td>Stream changes to a pid.</td></tr>
<tr><td valign="top"><a href="#wait_for_change-1">wait_for_change/1</a></td><td>(<em>Deprecated</em>.) </td></tr>
</table>
<h2><a name="functions">Function Details</a></h2>
<h3 class="function"><a name="changes_loop-3">changes_loop/3</a></h3>
<div class="spec">
<p><tt>changes_loop(Args::<a href="#type-changes_args">changes_args()</a>, UserFun::function(), Params::{Url::string(), IbrowseOpts::list()}) -> ok</tt><br></p>
</div>
<h3 class="function"><a name="continuous_acceptor-2">continuous_acceptor/2</a></h3>
<div class="spec">
<p><tt>continuous_acceptor(Pid, PidRef) -> any()</tt></p>
</div><p><b>This function is deprecated:</b> this function have been deprecated and will be removed in
version 0.8</p>
<p>initiate continuous loop</p>
<h3 class="function"><a name="fetch-1">fetch/1</a></h3>
<div class="spec">
<p><tt>fetch(Db::<a href="#type-db">db()</a>) -> {ok, LastSeq::integer(), Rows::list()} | {error, LastSeq::integer(), Error::term()}</tt><br></p>
</div><p>Equivalent to <a href="#fetch-2"><tt>fetch(Db, [])</tt></a>.</p>
<h3 class="function"><a name="fetch-2">fetch/2</a></h3>
<div class="spec">
<p><tt>fetch(Db::<a href="#type-db">db()</a>, Options::<a href="#type-changes_options1">changes_options1()</a>) -> {ok, LastSeq::integer(), Rows::list()} | {error, LastSeq::integer(), Error::term()}</tt><br></p>
</div><p>Collect Changes. Could be used to make a blocking call to a
longpoll change feed
<p>Db : a db record</p>
<p><pre>ChangesOptions :: changes_options() [continuous | longpoll | normal
| include_docs | {since, integer()}
| {timeout, integer()}
| heartbeat | {heartbeat, integer()}
| {filter, string()} | {filter, string(), list({string(), string() | integer()}</pre>
<ul>
<li><code>longpoll | normal</code>: set the type of changes
feed to get</li>
<li><code>include_docs</code>: if you want to include the doc in the line of
change</li>
<li><code>{timeout, Timeout::integer()}</code>: timeout</li>
<li><code>heartbeat | {heartbeat, Heartbeat::integer()}</code>: set couchdb
to send a heartbeat to maintain connection open</li>
<li><code>{filter, FilterName} | {filter, FilterName, Args::list({key,
value})</code>: set the filter to use with optional arguments</li>
</ul></p>
<p>Resut: <code>{ok, LastSeq::integer(), Rows::list()}</code> or
<code>{error, LastSeq, Error}</code>. LastSeq is the last sequence of changes.</p></p>
<h3 class="function"><a name="parse_changes_options-1">parse_changes_options/1</a></h3>
<div class="spec">
<p><tt>parse_changes_options(Options::<a href="#type-changes_options">changes_options()</a>) -> <a href="#type-changes_args">changes_args()</a></tt><br></p>
</div><p>parse changes options and return a changes_args record</p>
<h3 class="function"><a name="stream-2">stream/2</a></h3>
<div class="spec">
<p><tt>stream(Db::<a href="#type-db">db()</a>, Client::pid()) -> {ok, StartRef::term(), ChangesPid::pid()} | {error, term()}</tt><br></p>
</div><p>Equivalent to <a href="#stream-3"><tt>stream(Db, Client, [])</tt></a>.</p>
<h3 class="function"><a name="stream-3">stream/3</a></h3>
<div class="spec">
<p><tt>stream(Db::<a href="#type-db">db()</a> | function(), Client::pid() | function(), Options::<a href="#type-changes_options">changes_options()</a>) -> {ok, StartRef::term(), ChangesPid::pid()} | {ok, ChangesPid::pid()} | {error, term()}</tt><br></p>
</div><p>Stream changes to a pid
<p>Db : a db record</p>
<p>Client : pid or callback where to send changes events where events are
The pid receive these events:
<dl>
<dt>{change, StartRef, {done, Lastseq::integer()}</dt>
<dd>Connection terminated or you got all changes</dd>
<dt>{change, StartRef, Row :: ejson_object()}</dt>
<dd>Line of change</dd>
<dt>{error, LastSeq::integer(), Msg::term()}</dt>
<dd>Got an error, connection is closed when an error
happend.</dd>
</dl>
LastSeq is the last sequence of changes.</p>
While the callbac could be like:
<pre>
fun({done, LastSeq}) ->
ok;
fun({done, LastSeq}) ->
ok;
fun({done, LastSeq}) ->
ok.</pre>
<p><pre>>ChangesOptions :: changes_options() [continuous | longpoll | normal
| include_docs | {since, integer()}
| {timeout, integer()}
| heartbeat | {heartbeat, integer()}
| {filter, string()} | {filter, string(), list({string(), string() | integer()}</pre>
<ul>
<li><code>continuous | longpoll | normal</code>: set the type of changes
feed to get</li>
<li><code>include_doc</code>: if you want to include the doc in the line of
change</li>
<li><code>{timeout, Timeout::integer()}</code>:: timeout</li>
<li><code>heartbeat | {heartbeat, Heartbeat::integer()}</code>: set couchdb
to send a heartbeat to maintain connection open</li>
<li><code>{filter, FilterName} | {filter, FilterName, Args::list({key,
value})</code>: set the filter to use with optional arguments</li>
</ul></p>
<p> Return {ok, StartRef, ChangesPid} or {error, Error}. Ref can be
used to disctint all changes from this pid. ChangesPid is the pid of
the changes loop process. Can be used to monitor it or kill it
when needed.</p></p>
<h3 class="function"><a name="wait_for_change-1">wait_for_change/1</a></h3>
<div class="spec">
<p><tt>wait_for_change(Reqid) -> any()</tt></p>
</div><p><b>This function is deprecated:</b> this function have been deprecated and will be removed in
version 0.8</p>
<hr>
<div class="navbar"><a name="#navbar_bottom"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
<p><i>Generated by EDoc, Jan 3 2012, 15:42:59.</i></p>
</body>
</html>