Debian Codegraph @

R/docs.R

raw
1 # nanonext - Documentation -----------------------------------------------------
2
3 #' Protocols (Documentation)
4 #'
5 #' @description Protocols implemented by \pkg{nanonext}.
6 #'
7 #' For an authoritative guide please refer to the online documentation for the
8 #' NNG library at <https://nng.nanomsg.org/man/>.
9 #'
10 #' @section Bus (mesh networks):
11 #'
12 #' **\[protocol, bus\]** The bus protocol is useful for routing applications or
13 #' for building mesh networks where every peer is connected to every other peer.
14 #'
15 #' In this protocol, each message sent by a node is sent to every one of its
16 #' directly-connected peers. This protocol may be used to send and receive
17 #' messages. Sending messages will attempt to deliver to each directly connected
18 #' peer. Indirectly-connected peers will not receive messages. When using this
19 #' protocol to build mesh networks, it is therefore important that a
20 #' fully-connected mesh network be constructed.
21 #'
22 #' All message delivery in this pattern is best-effort, which means that peers
23 #' may not receive messages. Furthermore, delivery may occur to some, all, or
24 #' none of the directly connected peers (messages are not delivered when peer
25 #' nodes are unable to receive). Hence, send operations will never block;
26 #' instead if the message cannot be delivered for any reason it is discarded.
27 #'
28 #' @section Pair (two-way radio):
29 #'
30 #' **\[protocol, pair\]** This is NNG's pair v0. The pair protocol implements a
31 #' peer-to-peer pattern, where relationships between peers are one-to-one. Only
32 #' one peer may be connected to another peer at a time, but both may send and
33 #' receive messages freely.
34 #'
35 #' Normally, this pattern will block when attempting to send a message if no
36 #' peer is able to receive the message.
37 #'
38 #' @section Poly (one-to-one of many):
39 #'
40 #' **\[protocol, poly\]** This is NNG's pair v1 polyamorous mode. It allows a
41 #' socket to communicate with multiple directly-connected peers.
42 #'
43 #' If no remote peer is specified by the sender, then the protocol willselect
44 #' any available connected peer.
45 #'
46 #' If the peer on the given pipe is not able to receive (or the pipe is no
47 #' longer available, such as if the peer has disconnected), then the message
48 #' will be discarded with no notification to the sender.
49 #'
50 #' @section Push/Pull (one-way pipeline):
51 #'
52 #' In the pipeline pattern, pushers distribute messages to pullers, hence useful
53 #' for solving producer/consumer problems.
54 #'
55 #' If multiple peers are connected, the pattern attempts to distribute fairly.
56 #' Each message sent by a pusher will be sent to one of its peer pullers, chosen
57 #' in a round-robin fashion. This property makes this pattern useful in
58 #' load-balancing scenarios.
59 #'
60 #' **\[protocol, push\]** The push protocol is one half of a pipeline pattern.
61 #' The other side is the pull protocol.
62 #'
63 #' **\[protocol, pull\]** The pull protocol is one half of a pipeline pattern.
64 #' The other half is the push protocol.
65 #'
66 #' @section Publisher/Subscriber (topics & broadcast):
67 #'
68 #' In a publisher/subscriber pattern, a publisher sends data, which is broadcast
69 #' to all subscribers. The subscriber only see the data to which they have
70 #' subscribed.
71 #'
72 #' **\[protocol, pub\]** The pub protocol is one half of a publisher/subscriber
73 #' pattern. This protocol may be used to send messages, but is unable to receive
74 #' them.
75 #'
76 #' **\[protocol, sub\]** The sub protocol is one half of a publisher/subscriber
77 #' pattern. This protocol may be used to receive messages, but is unable to send
78 #' them.
79 #'
80 #' @section Request/Reply (RPC):
81 #'
82 #' In a request/reply pattern, a requester sends a message to one replier, who
83 #' is expected to reply with a single answer. This is used for synchronous
84 #' communications, for example remote procedure calls (RPCs).
85 #'
86 #' The request is resent automatically if no reply arrives, until a reply is
87 #' received or the request times out.
88 #'
89 #' **\[protocol, req\]** The req protocol is one half of a request/reply
90 #' pattern. This socket may be used to send messages (requests), and then to
91 #' receive replies. Generally a reply can only be received after sending a
92 #' request.
93 #'
94 #' **\[protocol, rep\]** The rep protocol is one half of a request/reply
95 #' pattern. This socket may be used to receive messages (requests), and then to
96 #' send replies. Generally a reply can only be sent after receiving a request.
97 #'
98 #' @section Surveyor/Respondent (voting & service discovery):
99 #'
100 #' In a survey pattern, a surveyor sends a survey, which is broadcast to all
101 #' peer respondents. The respondents then have a chance to reply (but are not
102 #' obliged). The survey itself is a timed event, so that responses received
103 #' after the survey has finished are discarded.
104 #'
105 #' **\[protocol, surveyor\]** The surveyor protocol is one half of a survey
106 #' pattern. This protocol may be used to send messages (surveys), and then to
107 #' receive replies. A reply can only be received after sending a survey. A
108 #' surveyor can normally expect to receive at most one reply from each responder
109 #' (messages may be duplicated in some topologies, so there is no guarantee of
110 #' this).
111 #'
112 #' **\[protocol, respondent\]** The respondent protocol is one half of a survey
113 #' pattern. This protocol may be used to receive messages, and then to send
114 #' replies. A reply can only be sent after receiving a survey, and generally the
115 #' reply will be sent to the surveyor from which the last survey was received.
116 #'
117 #' @name protocols
118 #'
119 NULL
120
121 #' Transports (Documentation)
122 #'
123 #' @description Transports supported by \pkg{nanonext}.
124 #'
125 #' For an authoritative guide please refer to the online documentation for the
126 #' NNG library at <https://nng.nanomsg.org/man/>.
127 #'
128 #' @section Inproc:
129 #'
130 #' The inproc transport provides communication support between sockets within
131 #' the same process. This may be used as an alternative to slower transports
132 #' when data must be moved within the same process. This transport tries hard to
133 #' avoid copying data, and thus is very light-weight.
134 #'
135 #' **\[URI, inproc://\]** This transport uses URIs using the scheme inproc://,
136 #' followed by an arbitrary string of text, terminated by a NUL byte.
137 #' inproc://nanonext is a valid example URL.
138 #'
139 #' \itemize{
140 #' \item Multiple URIs can be used within the same application, and they will
141 #' not interfere with one another.
142 #'
143 #' \item Two applications may also use the same URI without interfering with
144 #' each other, and they will be unable to communicate with each other using
145 #' that URI.
146 #' }
147 #'
148 #' @section IPC:
149 #'
150 #' The IPC transport provides communication support between sockets within
151 #' different processes on the same host. For POSIX platforms, this is
152 #' implemented using UNIX domain sockets. For Windows, this is implemented using
153 #' Windows Named Pipes. Other platforms may have different implementation
154 #' strategies.
155 #'
156 #' *Traditional Names*
157 #'
158 #' **\[URI, ipc://\]** This transport uses URIs using the scheme ipc://,
159 #' followed by a path name in the file system where the socket or named pipe
160 #' should be created.
161 #'
162 #' \itemize{
163 #' \item On POSIX platforms, the path is taken literally, and is relative to
164 #' the current directory, unless it begins with /, in which case it is
165 #' relative to the root directory. For example, ipc://nanonext refers to the
166 #' name nanonext in the current directory, whereas ipc:///tmp/nanonext refers
167 #' to nanonext located in /tmp.
168 #' \item On Windows, all names are prefixed by \\.\ pipe\ and do not reside in
169 #' the normal file system - the required prefix is added automatically by NNG,
170 #' so a URL of the form ipc://nanonext is fine.
171 #' }
172 #'
173 #' *UNIX Aliases*
174 #'
175 #' **\[URI, unix://\]** The unix:// scheme is an alias for ipc:// and can be
176 #' used inter-changeably, but only on POSIX systems. The purpose of this scheme
177 #' is to support a future transport making use of AF_UNIX on Windows systems, at
178 #' which time it will be necessary to discriminate between the Named Pipes and
179 #' the AF_UNIX based transports.
180 #'
181 #' *Abstract Names*
182 #'
183 #' **\[URI, abstract://\]** On Linux, this transport also can support abstract
184 #' sockets. Abstract sockets use a URI-encoded name after the scheme, which
185 #' allows arbitrary values to be conveyed in the path, including embedded NUL
186 #' bytes. abstract://nanonext is a valid example URL.
187 #'
188 #' \itemize{
189 #' \item Abstract sockets do not have any representation in the file system,
190 #' and are automatically freed by the system when no longer in use. Abstract
191 #' sockets ignore socket permissions, but it is still possible to determine
192 #' the credentials of the peer.
193 #' }
194 #'
195 #' @section TCP/IP:
196 #'
197 #' The TCP transport provides communication support between sockets across a
198 #' TCP/IP network. Both IPv4 and IPv6 are supported when supported by the
199 #' underlying platform.
200 #'
201 #' **\[URI, tcp://\]** This transport uses URIs using the scheme tcp://,
202 #' followed by an IP address or hostname, followed by a colon and finally a TCP
203 #' port number. For example, to contact port 80 on the localhost either of the
204 #' following URIs could be used: tcp://127.0.0.1:80 or tcp://localhost:80.
205 #'
206 #' \itemize{
207 #' \item A URI may be restricted to IPv6 using the scheme tcp6://, and may be
208 #' restricted to IPv4 using the scheme tcp4://
209 #'
210 #' \item Note: Specifying tcp6:// may not prevent IPv4 hosts from being used
211 #' with IPv4-in-IPv6 addresses, particularly when using a wildcard hostname
212 #' with listeners. The details of this varies across operating systems.
213 #'
214 #' \item Note: both tcp6:// and tcp4:// are specific to NNG, and might not be
215 #' understood by other implementations.
216 #'
217 #' \item It is recommended to use either numeric IP addresses, or names that
218 #' are specific to either IPv4 or IPv6 to prevent confusion and surprises.
219 #'
220 #' \item When specifying IPv6 addresses, the address must be enclosed in
221 #' square brackets (\[\]) to avoid confusion with the final colon separating
222 #' the port. For example, the same port 80 on the IPv6 loopback address (::1)
223 #' would be specified as tcp://\[::1\]:80.
224 #'
225 #' \item The special value of 0 (INADDR_ANY) can be used for a listener to
226 #' indicate that it should listen on all interfaces on the host. A shorthand
227 #' for this form is to either omit the address, or specify the asterisk (*)
228 #' character. For example, the following three URIs are all equivalent, and
229 #' could be used to listen to port 9999 on the host: (1) tcp://0.0.0.0:9999
230 #' (2) tcp://*:9999 (3) tcp://:9999
231 #' }
232 #'
233 #' @section TLS:
234 #'
235 #' The TLS transport provides communication support between peers across a
236 #' TCP/IP network using TLS v1.2 on top of TCP. Both IPv4 and IPv6 are supported
237 #' when supported by the underlying platform.
238 #'
239 #' **\[URI, tls+tcp://\]** This transport uses URIs using the scheme tls+tcp://,
240 #' followed by an IP address or hostname, followed by a colon and finally a TCP
241 #' port number. For example, to contact port 4433 on the localhost either of the
242 #' following URIs could be used: tls+tcp://127.0.0.1:4433 or
243 #' tls+tcp://localhost:4433.
244 #' \itemize{
245 #' \item A URI may be restricted to IPv6 using the scheme tls+tcp6://, or IPv4
246 #' using the scheme tls+tcp4://.
247 #' }
248 #'
249 #' @section WebSocket:
250 #'
251 #' The ws and wss transport provides communication support between peers across
252 #' a TCP/IP network using WebSockets. Both IPv4 and IPv6 are supported when
253 #' supported by the underlying platform.
254 #'
255 #' **\[URI, ws://\]** This transport uses URIs using the scheme ws://, followed
256 #' by an IP address or hostname, optionally followed by a colon and a TCP port
257 #' number, optionally followed by a path. (If no port number is specified then
258 #' port 80 is assumed. If no path is specified then a path of / is assumed.) For
259 #' example, the URI ws://localhost/app/pubsub would use port 80 on localhost,
260 #' with the path /app/pubsub.
261 #'
262 #' **\[URI, wss://\]** Secure WebSockets use the scheme wss://, and the default
263 #' TCP port number of 443. Otherwise the format is the same as for regular
264 #' WebSockets.
265 #'
266 #' \itemize{
267 #' \item A URI may be restricted to IPv6 using the scheme ws6:// or wss6://,
268 #' or IPv4 using the scheme ws4:// or wss4://.
269 #'
270 #' \item When specifying IPv6 addresses, the address must be enclosed in
271 #' square brackets (\[\]) to avoid confusion with the final colon separating
272 #' the port. For example, the same path and port on the IPv6 loopback address
273 #' (::1) would be specified as ws://\[::1\]/app/pubsub.
274 #'
275 #' \item Note: The value specified as the host, if any, will also be used in
276 #' the Host: HTTP header during HTTP negotiation.
277 #'
278 #' \item To listen to all ports on the system, the host name may be elided
279 #' from the URL on the listener. This will wind up listening to all interfaces
280 #' on the system, with possible caveats for IPv4 and IPv6 depending on what
281 #' the underlying system supports. (On most modern systems it will map to the
282 #' special IPv6 address ::, and both IPv4 and IPv6 connections will be
283 #' permitted, with IPv4 addresses mapped to IPv6 addresses.)
284 #'
285 #' \item This transport makes use of shared HTTP server instances, permitting
286 #' multiple sockets or listeners to be configured with the same hostname and
287 #' port. When creating a new listener, it is registered with an existing HTTP
288 #' server instance if one can be found. Note that the matching algorithm is
289 #' somewhat simple, using only a string based hostname or IP address and port
290 #' to match. Therefore it is recommended to use only IP addresses or the empty
291 #' string as the hostname in listener URLs.
292 #'
293 #' \item All sharing of server instances is only typically possible within the
294 #' same process.
295 #'
296 #' \item The server may also be used by other things (for example to serve
297 #' static content), in the same process.
298 #' }
299 #'
300 #' @name transports
301 #'
302 NULL