Skip to content

Commit 92b1c21

Browse files
committed
revert unresolvedValue to NA
1 parent f605644 commit 92b1c21

File tree

13 files changed

+49
-38
lines changed

13 files changed

+49
-38
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: nanonext
22
Type: Package
33
Title: NNG (Nanomsg Next Gen) Lightweight Messaging Library
4-
Version: 0.9.2.9037
4+
Version: 0.9.2.9038
55
Description: R binding for NNG (Nanomsg Next Gen), a successor to ZeroMQ. NNG is
66
a socket library providing high-performance scalability protocols, a
77
cross-platform standard for messaging and communications. Serves as a

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ S3method(print,ncurlSession)
3232
S3method(print,recvAio)
3333
S3method(print,sendAio)
3434
S3method(print,tlsConfig)
35+
S3method(print,unresolvedValue)
3536
S3method(start,nanoDialer)
3637
S3method(start,nanoListener)
3738
export("opt<-")

NEWS.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# nanonext 0.9.2.9037 (development)
1+
# nanonext 0.9.2.9038 (development)
22

33
#### New Features
44

@@ -24,7 +24,6 @@
2424
+ Permits sending of NULL, in which case an empty vector of the corresponding mode is received.
2525
+ Character vectors containing empty characters in the middle are now received correctly.
2626
+ For character vectors, respects original encoding and no longer performs automatic conversion to UTF8.
27-
* The unresolved value for an Aio is now the symbol ` unresolvedValue ` rather than a classed logical NA. Continue to use `unresolved()` to check for resolution.
2827
* Base64 and SHA hash functions now use big-endian representation for serialization (where this is performed) to ensure consistency across all systems (fixes #14, a regression in nanonext 0.9.2).
2928
* Package installation now succeeds in certain environments where 'cmake' failed to make 'libmbedtls' detectable after building (thanks @kendonB #13).
3029
* Source bundles for 'libmbedtls' and 'libnng' slimmed down for smaller package and installed sizes.

R/aio.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
#' @details Async send is always non-blocking and returns a 'sendAio'
3232
#' immediately.
3333
#'
34-
#' For a 'sendAio', the send result is available at \code{$result}. The
35-
#' symbol ' unresolvedValue ' is returned if the async operation is yet to
36-
#' complete, The resolved value will be zero on success, or else an integer
34+
#' For a 'sendAio', the send result is available at \code{$result}. An
35+
#' 'unresolved' logical NA is returned if the async operation is yet to
36+
#' complete. The resolved value will be zero on success, or else an integer
3737
#' error code.
3838
#'
3939
#' To wait for and check the result of the send operation, use
@@ -70,8 +70,8 @@ send_aio <- function(con, data, mode = c("serial", "raw"), timeout = NULL)
7070
#' @details Async receive is always non-blocking and returns a 'recvAio'
7171
#' immediately.
7272
#'
73-
#' For a 'recvAio', the received message is available at \code{$data}. The
74-
#' symbol ' unresolvedValue ' is returned if the async operation is yet to
73+
#' For a 'recvAio', the received message is available at \code{$data}. An
74+
#' 'unresolved' logical NA is returned if the async operation is yet to
7575
#' complete.
7676
#'
7777
#' To wait for the async operation to complete and retrieve the received
@@ -190,8 +190,8 @@ recv_aio_signal <- function(con,
190190
#'
191191
#' Aio values may be accessed directly at \code{$result} for a 'sendAio',
192192
#' and \code{$data} for a 'recvAio'. If the Aio operation is yet to complete,
193-
#' the symbol ' unresolvedValue ' will be returned. Once complete, the
194-
#' resolved value will be returned instead.
193+
#' an 'unresolved' logical NA will be returned. Once complete, the resolved
194+
#' value will be returned instead.
195195
#'
196196
#' \code{\link{unresolved}} may also be used, which returns TRUE only if an
197197
#' Aio or Aio value has yet to resolve and FALSE otherwise. This is suitable

R/nano.R

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,15 @@ print.ncurlSession <- function(x, ...) {
366366

367367
}
368368

369+
#' @export
370+
#'
371+
print.unresolvedValue <- function(x, ...) {
372+
373+
cat("'unresolved' logi NA\n", file = stdout())
374+
invisible(x)
375+
376+
}
377+
369378
#' @export
370379
#'
371380
print.errorValue <- function(x, ...) {

README.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ aio$data |> str()
311311
312312
```
313313

314-
As `call_aio()` is blocking and will wait for completion, an alternative is to query `aio$data` directly. This will return the symbol ` unresolvedValue ` if the calculation is yet to complete.
314+
As `call_aio()` is blocking and will wait for completion, an alternative is to query `aio$data` directly. This will return an 'unresolved' logical NA value if the calculation is yet to complete.
315315

316316
In this example the calculation is returned, but other operations may reside entirely on the server side, for example writing data to disk.
317317

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ msg
250250
#> < recvAio >
251251
#> - $data for message data
252252
msg$data
253-
#> ` unresolvedValue `
253+
#> 'unresolved' logi NA
254254
```
255255

256256
For a ‘sendAio’ object, the result is stored at `$result`.
@@ -364,12 +364,12 @@ aio
364364
#> < recvAio >
365365
#> - $data for message data
366366
aio$data |> str()
367-
#> num [1:100000000] -0.39 1.224 -0.678 0.643 -1.483 ...
367+
#> num [1:100000000] 0.09 -1.688 -0.754 2.307 -1.046 ...
368368
```
369369

370370
As `call_aio()` is blocking and will wait for completion, an alternative
371-
is to query `aio$data` directly. This will return the symbol
372-
`unresolvedValue` if the calculation is yet to complete.
371+
is to query `aio$data` directly. This will return an ‘unresolved’
372+
logical NA value if the calculation is yet to complete.
373373

374374
In this example the calculation is returned, but other operations may
375375
reside entirely on the server side, for example writing data to disk.
@@ -531,7 +531,7 @@ throughout, or alternatively ‘localhost’, but not a mixture of the two.
531531
cert <- write_cert(cn = "127.0.0.1")
532532
str(cert)
533533
#> List of 2
534-
#> $ server: chr [1:2] "-----BEGIN CERTIFICATE-----\nMIIFFTCCAv2gAwIBAgIBATANBgkqhkiG9w0BAQsFADAiMRIwEAYDVQQDDAkxMjcu\nMC4wLjExDDAKBgNV"| __truncated__ "-----BEGIN RSA PRIVATE KEY-----\nMIIJKQIBAAKCAgEAngOhZcV1iIp7n1wKrRAvMcvtitlU7Z9tCkcxZyzWvSG9Zofp\nlN0kmKXDcwvg"| __truncated__
534+
#> $ server: chr [1:2] "-----BEGIN CERTIFICATE-----\nMIIFFTCCAv2gAwIBAgIBATANBgkqhkiG9w0BAQsFADAiMRIwEAYDVQQDDAkxMjcu\nMC4wLjExDDAKBgNV"| __truncated__ "-----BEGIN RSA PRIVATE KEY-----\nMIIJKQIBAAKCAgEAlQhHQ/iwBIyKoHW/gjQqVvwPRENOdGOyt68nboQ0fTaUqe5O\nj6xNjZlqNtwz"| __truncated__
535535
#> $ client: chr [1:2] "-----BEGIN CERTIFICATE-----\nMIIFFTCCAv2gAwIBAgIBATANBgkqhkiG9w0BAQsFADAiMRIwEAYDVQQDDAkxMjcu\nMC4wLjExDDAKBgNV"| __truncated__ ""
536536

537537
ser <- tls_config(server = cert$server)
@@ -660,7 +660,7 @@ res2 |> recv()
660660
aio1$data
661661
#> [1] "res1"
662662
aio2$data
663-
#> ` unresolvedValue `
663+
#> 'unresolved' logi NA
664664

665665
# after the survey expires, the second resolves into a timeout error
666666
msleep(500)
@@ -700,7 +700,7 @@ ncurl("https://postman-echo.com/get")
700700
#> NULL
701701
#>
702702
#> $data
703-
#> [1] "{\n \"args\": {},\n \"headers\": {\n \"x-forwarded-proto\": \"https\",\n \"x-forwarded-port\": \"443\",\n \"host\": \"postman-echo.com\",\n \"x-amzn-trace-id\": \"Root=1-64e7a4e1-525161d526a354dc6198c9ea\"\n },\n \"url\": \"https://postman-echo.com/get\"\n}"
703+
#> [1] "{\n \"args\": {},\n \"headers\": {\n \"x-forwarded-proto\": \"https\",\n \"x-forwarded-port\": \"443\",\n \"host\": \"postman-echo.com\",\n \"x-amzn-trace-id\": \"Root=1-64e9dbb0-242f5ff34eeaea7e173df056\"\n },\n \"url\": \"https://postman-echo.com/get\"\n}"
704704
```
705705

706706
For advanced use, supports additional HTTP methods such as POST or PUT.
@@ -719,10 +719,10 @@ res
719719

720720
call_aio(res)$headers
721721
#> $date
722-
#> [1] "Thu, 24 Aug 2023 18:43:46 GMT"
722+
#> [1] "Sat, 26 Aug 2023 11:02:09 GMT"
723723

724724
res$data
725-
#> [1] "{\n \"args\": {},\n \"data\": {\n \"key\": \"value\"\n },\n \"files\": {},\n \"form\": {},\n \"headers\": {\n \"x-forwarded-proto\": \"https\",\n \"x-forwarded-port\": \"443\",\n \"host\": \"postman-echo.com\",\n \"x-amzn-trace-id\": \"Root=1-64e7a4e1-071343d80b56ce291519f146\",\n \"content-length\": \"16\",\n \"content-type\": \"application/json\",\n \"authorization\": \"Bearer APIKEY\"\n },\n \"json\": {\n \"key\": \"value\"\n },\n \"url\": \"https://postman-echo.com/post\"\n}"
725+
#> [1] "{\n \"args\": {},\n \"data\": {\n \"key\": \"value\"\n },\n \"files\": {},\n \"form\": {},\n \"headers\": {\n \"x-forwarded-proto\": \"https\",\n \"x-forwarded-port\": \"443\",\n \"host\": \"postman-echo.com\",\n \"x-amzn-trace-id\": \"Root=1-64e9dbb1-79ac77fb6ced5ec43dbcf33d\",\n \"content-length\": \"16\",\n \"content-type\": \"application/json\",\n \"authorization\": \"Bearer APIKEY\"\n },\n \"json\": {\n \"key\": \"value\"\n },\n \"url\": \"https://postman-echo.com/post\"\n}"
726726
```
727727

728728
In this respect, it may be used as a performant and lightweight method
@@ -753,7 +753,7 @@ transact(sess)
753753
#>
754754
#> $headers
755755
#> $headers$Date
756-
#> [1] "Thu, 24 Aug 2023 18:43:46 GMT"
756+
#> [1] "Sat, 26 Aug 2023 11:02:09 GMT"
757757
#>
758758
#> $headers$`Content-Type`
759759
#> [1] "application/json; charset=utf-8"
@@ -766,8 +766,8 @@ transact(sess)
766766
#> [76] 77 61 72 64 65 64 2d 70 6f 72 74 22 3a 20 22 34 34 33 22 2c 0a 20 20 20 20
767767
#> [101] 22 68 6f 73 74 22 3a 20 22 70 6f 73 74 6d 61 6e 2d 65 63 68 6f 2e 63 6f 6d
768768
#> [126] 22 2c 0a 20 20 20 20 22 78 2d 61 6d 7a 6e 2d 74 72 61 63 65 2d 69 64 22 3a
769-
#> [151] 20 22 52 6f 6f 74 3d 31 2d 36 34 65 37 61 34 65 32 2d 35 61 64 63 64 30 61
770-
#> [176] 30 36 64 30 34 38 64 30 39 31 65 63 30 38 35 37 38 22 2c 0a 20 20 20 20 22
769+
#> [151] 20 22 52 6f 6f 74 3d 31 2d 36 34 65 39 64 62 62 31 2d 35 64 64 64 39 36 31
770+
#> [176] 38 37 39 35 30 65 37 62 66 32 32 32 32 34 38 32 64 22 2c 0a 20 20 20 20 22
771771
#> [201] 63 6f 6e 74 65 6e 74 2d 74 79 70 65 22 3a 20 22 61 70 70 6c 69 63 61 74 69
772772
#> [226] 6f 6e 2f 6a 73 6f 6e 22 2c 0a 20 20 20 20 22 61 75 74 68 6f 72 69 7a 61 74
773773
#> [251] 69 6f 6e 22 3a 20 22 42 65 61 72 65 72 20 41 50 49 4b 45 59 22 0a 20 20 7d

man/call_aio.Rd

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

man/recv_aio.Rd

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

man/send_aio.Rd

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

0 commit comments

Comments
 (0)