Skip to content

Commit a50f576

Browse files
committed
update docs rc2
1 parent 960bd91 commit a50f576

26 files changed

+160
-104
lines changed

R/aio.R

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
# nanonext - Core Functions - Aio Functions ------------------------------------
22

3-
#' Call the Result of an Asynchronous AIO Operation
3+
#' Call the Value of an Asynchronous AIO Operation
44
#'
5-
#' Retrieve the result of an asynchronous AIO operation, waiting for the AIO
5+
#' Retrieve the value of an asynchronous AIO operation, waiting for the AIO
66
#' operation to complete if still in progress.
77
#'
88
#' @param aio An Aio (object of class 'sendAio' or 'recvAio').
99
#'
1010
#' @return The passed Aio object (invisibly).
1111
#'
12-
#' @details For a 'recvAio', the received raw vector will be attached in \code{$raw}
12+
#' @details For a 'recvAio', the received raw vector may be retrieved at \code{$raw}
1313
#' (unless 'keep.raw' was set to FALSE when receiving), and the converted R
14-
#' object in \code{$data}.
14+
#' object at \code{$data}.
1515
#'
16-
#' For a 'sendAio', the send result will be attached to the Aio in \code{$result}.
17-
#' This will be zero on success.
16+
#' For a 'sendAio', the send result may be retrieved at \code{$result}. This
17+
#' will be zero on success, or else an integer error code.
1818
#'
19-
#' To access the values directly, use for example on a sendAio 'x':
20-
#' \code{call_aio(x)$result}.
19+
#' To access the values directly, use for example on a 'recvAio' \code{x}:
20+
#' \code{call_aio(x)$data}.
2121
#'
22-
#' For a 'recvAio', in case of an error in unserialisation or data conversion,
23-
#' the received raw vector will be stored in \code{$data} to allow for the
24-
#' data to be recovered.
22+
#' For a 'recvAio', in case of an error in unserialisation or data conversion
23+
#' (for example if the incorrect mode was specified), the received raw vector
24+
#' will be stored at \code{$data} to allow for the data to be recovered.
2525
#'
26-
#' Once the result has been successfully retrieved, the Aio is deallocated
27-
#' and only the result is stored in the Aio object.
26+
#' Once the value has been successfully retrieved, the Aio is deallocated
27+
#' and only the value is stored in the Aio object.
2828
#'
2929
#' @section Alternatively:
3030
#'
3131
#' Aio values may be accessed directly at \code{$result} for a 'sendAio',
3232
#' and \code{$raw} or \code{$data} for a 'recvAio'. If the Aio operation is
3333
#' yet to complete, an 'unresolved' logical NA will be returned. Once
34-
#' completed, the resolved value will be returned instead.
34+
#' complete, the resolved value will be returned instead.
3535
#'
3636
#' \code{\link{unresolved}} may also be used, which returns TRUE only if an
3737
#' Aio or Aio value has yet to resolve and FALSE otherwise. This is suitable

R/context.R

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ context <- function(socket) {
5858
#' @inheritParams send
5959
#' @inheritParams send_aio
6060
#'
61-
#' @return Raw vector of sent data, or zero (invisibly) if 'echo' is set to FALSE.
61+
#' @return Raw vector of sent data, or (invisibly) an integer exit code (zero on
62+
#' success) if 'echo' is set to FALSE.
6263
#'
6364
#' @details Will block if the send is in progress and has not yet completed -
6465
#' certain protocol / transport combinations may limit the number of messages
@@ -104,14 +105,20 @@ send_ctx <- function(context, data, mode = c("serial", "raw"), timeout, echo = T
104105
#' @inheritParams send_aio
105106
#'
106107
#' @return Named list of 2 elements: 'raw' containing the received raw vector
107-
#' and 'data' containing the converted R object, or else the converted R
108-
#' object if 'keep.raw' is set to FALSE.
108+
#' and 'data' containing the converted object, or else the converted object
109+
#' if 'keep.raw' is set to FALSE.
109110
#'
110111
#' @details Will block while awaiting the receive operation to complete.
111112
#' Set a timeout to ensure that the function returns under all scenarios.
112113
#'
113-
#' In case of an error in unserialisation or data conversion, the function
114-
#' will still return the received raw vector to allow the data to be recovered.
114+
#' In case of an error, an integer 'errorValue' is returned (to be
115+
#' distiguishable from an integer message value). This can be verified using
116+
#' \code{\link{is_error_value}}.
117+
#'
118+
#' If the raw data was successfully received but an error occurred in
119+
#' unserialisation or data conversion (for example if the incorrect mode was
120+
#' specified), the received raw vector will always be returned to allow for
121+
#' the data to be recovered.
115122
#'
116123
#' @examples
117124
#' req <- socket("req", listen = "inproc://nanonext")
@@ -177,17 +184,17 @@ recv_ctx <- function(context,
177184
#' that the requestor has become unavailable since sending the request).
178185
#' @param ... additional arguments passed to the function specified by 'execute'.
179186
#'
180-
#' @return Zero (invisibly) on success.
187+
#' @return Invisibly, an integer exit code (zero on success).
181188
#'
182189
#' @details Receive will block while awaiting a message to arrive and is usually
183190
#' the desired behaviour. Set a timeout to allow the function to return
184191
#' if no data is forthcoming.
185192
#'
186193
#' In the event of an error in either processing the messages or in evaluation
187194
#' of the function with respect to the data, a nul byte \code{00} (or serialized
188-
#' nul byte) will be sent in reply to the client to signal an error. This makes
189-
#' it easy to distigush an error from a NULL return value.
190-
#' \code{\link{is_nul_byte}} can be used to test for a nul byte.
195+
#' nul byte) will be sent in reply to the client to signal an error. This is
196+
#' to be distinguishable from a possible return value. \code{\link{is_nul_byte}}
197+
#' can be used to test for a nul byte.
191198
#'
192199
#' @examples
193200
#' req <- socket("req", listen = "tcp://127.0.0.1:6546")
@@ -251,7 +258,7 @@ reply <- function(context,
251258
#' @param timeout in ms. If unspecified, a socket-specific default timeout will
252259
#' be used. Note that this applies to receiving the result.
253260
#'
254-
#' @return A recv Aio (object of class 'recvAio').
261+
#' @return A 'recvAio' (object of class 'recvAio').
255262
#'
256263
#' @details Sending the request and receiving the result are both performed async,
257264
#' hence the function will return immediately with a 'recvAio' object. Access

R/listdial.R

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
#' you wish to set configuration options on the dialer as it is not
1313
#' generally possible to change these once started.
1414
#'
15-
#' @return Zero (invisibly) on success. A new Dialer (object of class 'nanoDialer'
16-
#' and 'nano') is created and bound to the Socket.
15+
#' @return Invisibly, an integer exit code (zero on success). A new Dialer
16+
#' (object of class 'nanoDialer' and 'nano') is created and bound to the
17+
#' Socket or nano object if successful.
1718
#'
1819
#' @details To view all Dialers bound to a socket use \code{$dialer} on the
1920
#' socket, which returns a list of Dialer objects. To access any individual
@@ -136,8 +137,9 @@ dial <- function(socket,
136137
#' if you wish to set configuration options on the listener as it is not
137138
#' generally possible to change these once started.
138139
#'
139-
#' @return Zero (invisibly) on success. A new Listener (object of class
140-
#' 'nanoListener' and 'nano') is created and bound to the Socket or nano object.
140+
#' @return Invisibly, an integer exit code (zero on success). A new Listener
141+
#' (object of class 'nanoListener' and 'nano') is created and bound to the
142+
#' Socket or nano object if successful.
141143
#'
142144
#' @details To view all Listeners bound to a socket use \code{$listener} on the
143145
#' socket, which returns a list of Listener objects. To access any individual

R/methods.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#' action will be taken.
1414
#' @param ... not used.
1515
#'
16-
#' @return Zero (invisibly) on success.
16+
#' @return Invisibly, an integer exit code (zero on success).
1717
#'
1818
#' @name start
1919
#' @rdname start
@@ -61,7 +61,7 @@ start.nanoDialer <- function(x, async = TRUE, ...) {
6161
#' @param con a Socket, Context, Dialer or Listener.
6262
#' @param ... not used.
6363
#'
64-
#' @return Zero (invisibly) on success.
64+
#' @return Invisibly, an integer exit code (zero on success).
6565
#'
6666
#' @details Closing an object explicitly frees its resources. An object can also
6767
#' be removed directly in which case its resources are freed when the object

R/opts.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#' See \link{opts}.
1212
#' @param value value of option.
1313
#'
14-
#' @return Zero (invisibly) on success.
14+
#' @return Invisibly, an integer exit code (zero on success).
1515
#'
1616
#' @details Note: once a dialer or listener has started, it is not generally
1717
#' possible to change its configuration. Hence create the dialer or listener

R/sendrecv.R

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
#' sent data. Set to FALSE for performance-critical applications where zero
1818
#' will be returned (invisibly) instead.
1919
#'
20-
#' @return Raw vector of sent data, or zero (invisibly) if 'echo' is set to FALSE.
20+
#' @return Raw vector of sent data, or (invisibly) an integer exit code (zero on
21+
#' success) if 'echo' is set to FALSE.
2122
#'
2223
#' @examples
2324
#' pub <- socket("pub", dial = "inproc://nanonext")
@@ -56,12 +57,15 @@ send <- function(socket,
5657
#' @param timeout in ms. If unspecified, a socket-specific default timeout will
5758
#' be used.
5859
#'
59-
#' @return A send Aio (object of class 'sendAio').
60+
#' @return A 'sendAio' (object of class 'sendAio').
6061
#'
61-
#' @details Async send is always non-blocking and returns immediately.
62+
#' @details Async send is always non-blocking and returns a 'sendAio'
63+
#' immediately.
6264
#'
63-
#' The send result is available at \code{$result}, which will return an
64-
#' 'unresolved' logical NA if the async operation is yet to complete.
65+
#' For a 'sendAio', the send result is available at \code{$result}. An
66+
#' 'unresolved' logical NA is returned if the async operation is yet to
67+
#' complete, The resolved value will be zero on success, or else an integer
68+
#' error code.
6569
#'
6670
#' To wait for and check the result of the send operation, use
6771
#' \code{\link{call_aio}} on the returned 'sendAio' object.
@@ -124,12 +128,17 @@ send_aio <- function(socket, data, mode = c("serial", "raw"), timeout) {
124128
#' the converted data only.
125129
#'
126130
#' @return Named list of 2 elements: 'raw' containing the received raw vector
127-
#' and 'data' containing the converted R object, or else the converted R
128-
#' object if 'keep.raw' is set to FALSE.
131+
#' and 'data' containing the converted object, or else the converted object
132+
#' if 'keep.raw' is set to FALSE.
129133
#'
130-
#' @details In case of an error in unserialisation or data conversion, the
131-
#' function will still return the received raw vector to allow the data to
132-
#' be recovered.
134+
#' @details In case of an error, an integer 'errorValue' is returned (to be
135+
#' distiguishable from an integer message value). This can be verified using
136+
#' \code{\link{is_error_value}}.
137+
#'
138+
#' If the raw data was successfully received but an error occurred in
139+
#' unserialisation or data conversion (for example if the incorrect mode was
140+
#' specified), the received raw vector will always be returned to allow for
141+
#' the data to be recovered.
133142
#'
134143
#' @examples
135144
#' s1 <- socket("bus", listen = "inproc://nanonext")
@@ -179,19 +188,29 @@ recv <- function(socket,
179188
#' @inheritParams recv
180189
#' @inheritParams send_aio
181190
#'
182-
#' @return A recv Aio (object of class 'recvAio').
191+
#' @return A 'recvAio' (object of class 'recvAio').
183192
#'
184-
#' @details Async receive is always non-blocking and returns immediately.
193+
#' @details Async receive is always non-blocking and returns a 'recvAio'
194+
#' immediately.
185195
#'
186-
#' The received message is available at \code{$data}, and the raw message at
187-
#' \code{$raw} (if kept). An 'unresolved' logical NA will be returned if the
188-
#' async operation is yet to complete.
196+
#' For a 'recvAio', the received message is available at \code{$data}, and
197+
#' the raw message at \code{$raw} (if kept). An 'unresolved' logical NA is
198+
#' returned if the async operation is yet to complete.
189199
#'
190200
#' To wait for the async operation to complete and retrieve the received
191201
#' message, use \code{\link{call_aio}} on the returned 'recvAio' object.
192202
#'
193203
#' Alternatively, to stop the async operation, use \code{\link{stop_aio}}.
194204
#'
205+
#' In case of an error, an integer 'errorValue' is returned (to be
206+
#' distiguishable from an integer message value). This can be verified using
207+
#' \code{\link{is_error_value}}.
208+
#'
209+
#' If the raw data was successfully received but an error occurred in
210+
#' unserialisation or data conversion (for example if the incorrect mode was
211+
#' specified), the received raw vector will be stored at \code{$data} to
212+
#' allow for the data to be recovered.
213+
#'
195214
#' @examples
196215
#' s1 <- socket("pair", listen = "inproc://nanonext")
197216
#' s2 <- socket("pair", dial = "inproc://nanonext")

R/socket.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ socket <- function(protocol = c("pair", "bus", "push", "pull", "req", "rep",
8989
#' @param topic [default NULL] a topic (given as a character string). The default
9090
#' NULL subscribes to all topics.
9191
#'
92-
#' @return Zero (invisibly) on success.
92+
#' @return Invisibly, an integer exit code (zero on success).
9393
#'
9494
#' @details To use pub/sub the publisher must:
9595
#' \itemize{
@@ -140,7 +140,7 @@ subscribe <- function(socket, topic = NULL) {
140140
#' @param topic [default NULL] a topic (given as a character string). The default
141141
#' NULL unsubscribes from all topics (if all topics were previously subscribed).
142142
#'
143-
#' @return Zero (invisibly) on success.
143+
#' @return Invisibly, an integer exit code (zero on success).
144144
#'
145145
#' @details Note that if the topic was not previously subscribed to then an
146146
#' 'entry not found' error will result.
@@ -195,7 +195,7 @@ unsubscribe <- function(socket, topic = NULL) {
195195
#' @param socket a Socket or Context using the surveyor protocol.
196196
#' @param time the survey timeout in ms.
197197
#'
198-
#' @return Zero (invisibly) on success.
198+
#' @return Invisibly, an integer exit code (zero on success).
199199
#'
200200
#' @details After using this function, to start a new survey, the surveyor must:
201201
#' \itemize{

R/utils.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ is_error_value <- function(x) inherits(x, "errorValue")
108108
#' socket open etc. to stdout.}
109109
#' }
110110
#'
111-
#' @return Invisible NULL, or if 'level' is not specified, the integer code of
112-
#' the logging level. A confirmation is printed to the console (stdout) if
113-
#' the logging level has changed.
111+
#' @return Invisible NULL. A confirmation is printed to the console (stdout) if
112+
#' the logging level has changed. If the function is called with no arguments,
113+
#' the integer code of the logging level is returned instead.
114114
#'
115115
#' @details The environment variable 'NANONEXT_LOG' is checked automatically on
116116
#' package load and then cached for optimal performance. It is also checked

man/call_aio.Rd

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/close.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)