Skip to content

Commit 519a1ce

Browse files
committed
CRAN release 0.5.0
1 parent 509b0b1 commit 519a1ce

File tree

10 files changed

+37
-64
lines changed

10 files changed

+37
-64
lines changed

.github/workflows/test-coverage.yaml

Lines changed: 0 additions & 31 deletions
This file was deleted.

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.4.0.9000
4+
Version: 0.5.0
55
Description: R binding for NNG (Nanomsg Next Gen), a successor to ZeroMQ. NNG is
66
a socket library providing high-performance scalability protocols,
77
implementing a cross-platform standard for messaging and communications.

NEWS.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# nanonext 0.4.0.9000 (under development)
1+
# nanonext 0.5.0
2+
3+
*nanonext is now considered substantially feature-complete and API-stable*
24

35
#### New Features
46

R/nanonext-package.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
#'
1212
#' @section Usage notes:
1313
#'
14-
#' Call \code{\link{nano_init}} after package load to set global options.
15-
#' Using defaults will cause warnings to print immediately as they occur.
14+
#' Call \code{\link{nano_init}} after package load to set global options
15+
#' such as causing warnings to print immediately as they occur.
1616
#'
1717
#' \{nanonext\} offers 2 equivalent interfaces: an object-oriented interface,
1818
#' and a functional interface.

R/utils.R

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,9 @@ is_error_value <- function(x) inherits(x, "errorValue")
220220
#' generated, replacing the standard message. If non-null it is called
221221
#' irrespective of the value of option warn.}
222222
#'
223-
#' \item{warning.length} { - sets the truncation limit in bytes for error and warning
224-
#' messages. A non-negative integer, with allowed values 100...8170, default
225-
#' 1000.}
223+
#' \item{warning.length} { - sets the truncation limit in bytes for error
224+
#' and warning messages. A non-negative integer, with allowed values 100...8170,
225+
#' default 1000.}
226226
#'
227227
#' \item{nwarnings} { - the limit for the number of warnings kept when warn = 0,
228228
#' default 50. This will discard messages if called whilst they are being
@@ -234,9 +234,10 @@ is_error_value <- function(x) inherits(x, "errorValue")
234234
#'
235235
nano_init <- function(warn = c("immediate", "deferred", "error", "none")) {
236236

237-
warn <- match.arg2(warn, c("immediate", "deferred", "error", "none"))
238-
warn <- switch(warn, 1L, 0L, 2L, -1L)
239-
if (is.null(getOption("nanonext.original.warn"))) options(nanonext.original.warn = getOption("warn"))
237+
warn <- switch(match.arg2(warn, c("immediate", "deferred", "error", "none")),
238+
1L, 0L, 2L, -1L)
239+
if (is.null(getOption("nanonext.original.warn")))
240+
options(nanonext.original.warn = getOption("warn"))
240241
options(warn = warn)
241242
invisible(warn)
242243

README.Rmd

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ knitr::opts_chunk$set(
1919
[![CRAN status](https://www.r-pkg.org/badges/version/nanonext?color=112d4e)](https://CRAN.R-project.org/package=nanonext)
2020
[![nanonext status badge](https://shikokuchuo.r-universe.dev/badges/nanonext?color=3f72af)](https://shikokuchuo.r-universe.dev)
2121
[![R-CMD-check](https://github.com/shikokuchuo/nanonext/workflows/R-CMD-check/badge.svg)](https://github.com/shikokuchuo/nanonext/actions)
22-
[![Codecov test coverage](https://codecov.io/gh/shikokuchuo/nanonext/branch/main/graph/badge.svg)](https://app.codecov.io/gh/shikokuchuo/nanonext)
2322
<!-- badges: end -->
2423

2524
R binding for NNG (Nanomsg Next Gen), a successor to ZeroMQ. NNG is a socket library providing high-performance scalability protocols, implementing a cross-platform standard for messaging and communications. Serves as a concurrency framework for building distributed applications, utilising 'Aio' objects which automatically resolve upon completion of asynchronous operations.
@@ -42,7 +41,7 @@ Supported transports:
4241
- TCP (IPv4 or IPv6)
4342
- WebSocket
4443

45-
Web tools:
44+
Web utilities:
4645

4746
- ncurl - (async) http(s) client
4847
- stream - secure websockets client (and generic low-level socket interface)

README.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ status](https://www.r-pkg.org/badges/version/nanonext?color=112d4e)](https://CRA
1010
[![nanonext status
1111
badge](https://shikokuchuo.r-universe.dev/badges/nanonext?color=3f72af)](https://shikokuchuo.r-universe.dev)
1212
[![R-CMD-check](https://github.com/shikokuchuo/nanonext/workflows/R-CMD-check/badge.svg)](https://github.com/shikokuchuo/nanonext/actions)
13-
[![Codecov test
14-
coverage](https://codecov.io/gh/shikokuchuo/nanonext/branch/main/graph/badge.svg)](https://app.codecov.io/gh/shikokuchuo/nanonext)
1513
<!-- badges: end -->
1614

1715
R binding for NNG (Nanomsg Next Gen), a successor to ZeroMQ. NNG is a
@@ -44,7 +42,7 @@ Supported transports:
4442
- TCP (IPv4 or IPv6)
4543
- WebSocket
4644

47-
Web tools:
45+
Web utilities:
4846

4947
- ncurl - (async) http(s) client
5048
- stream - secure websockets client (and generic low-level socket
@@ -395,7 +393,7 @@ aio
395393
#> < recvAio >
396394
#> - $data for message data
397395
aio$data |> str()
398-
#> num [1:100000000] 0.983 0.386 1.337 0.243 -0.119 ...
396+
#> num [1:100000000] 0.762 0.482 1.227 2.048 -2.218 ...
399397
```
400398

401399
As `call_aio()` is blocking and will wait for completion, an alternative
@@ -552,11 +550,11 @@ ncurl("http://httpbin.org/headers")
552550
#> [1] 7b 0a 20 20 22 68 65 61 64 65 72 73 22 3a 20 7b 0a 20 20 20 20 22 48 6f 73
553551
#> [26] 74 22 3a 20 22 68 74 74 70 62 69 6e 2e 6f 72 67 22 2c 20 0a 20 20 20 20 22
554552
#> [51] 58 2d 41 6d 7a 6e 2d 54 72 61 63 65 2d 49 64 22 3a 20 22 52 6f 6f 74 3d 31
555-
#> [76] 2d 36 32 37 38 63 63 63 30 2d 37 66 66 34 37 37 33 31 31 35 32 66 39 61 32
556-
#> [101] 34 30 65 63 37 38 30 66 37 22 0a 20 20 7d 0a 7d 0a
553+
#> [76] 2d 36 32 37 39 66 66 64 31 2d 36 63 38 63 30 36 30 32 37 34 61 63 30 38 65
554+
#> [101] 66 37 32 32 35 30 66 65 63 22 0a 20 20 7d 0a 7d 0a
557555
#>
558556
#> $data
559-
#> [1] "{\n \"headers\": {\n \"Host\": \"httpbin.org\", \n \"X-Amzn-Trace-Id\": \"Root=1-6278ccc0-7ff47731152f9a240ec780f7\"\n }\n}\n"
557+
#> [1] "{\n \"headers\": {\n \"Host\": \"httpbin.org\", \n \"X-Amzn-Trace-Id\": \"Root=1-6279ffd1-6c8c060274ac08ef72250fec\"\n }\n}\n"
560558
```
561559

562560
For advanced use, supports additional HTTP methods such as POST or PUT.
@@ -572,7 +570,7 @@ res
572570
#> - $raw for raw message
573571

574572
call_aio(res)$data
575-
#> [1] "{\n \"args\": {}, \n \"data\": \"{\\\"key\\\": \\\"value\\\"}\", \n \"files\": {}, \n \"form\": {}, \n \"headers\": {\n \"Authorization\": \"Bearer APIKEY\", \n \"Content-Length\": \"16\", \n \"Content-Type\": \"application/json\", \n \"Host\": \"httpbin.org\", \n \"X-Amzn-Trace-Id\": \"Root=1-6278ccc0-476e7d46361255b56173915a\"\n }, \n \"json\": {\n \"key\": \"value\"\n }, \n \"origin\": \"79.173.189.204\", \n \"url\": \"http://httpbin.org/post\"\n}\n"
573+
#> [1] "{\n \"args\": {}, \n \"data\": \"{\\\"key\\\": \\\"value\\\"}\", \n \"files\": {}, \n \"form\": {}, \n \"headers\": {\n \"Authorization\": \"Bearer APIKEY\", \n \"Content-Length\": \"16\", \n \"Content-Type\": \"application/json\", \n \"Host\": \"httpbin.org\", \n \"X-Amzn-Trace-Id\": \"Root=1-6279ffd1-110ea4df1b50ecb96a19a80f\"\n }, \n \"json\": {\n \"key\": \"value\"\n }, \n \"origin\": \"78.145.225.121\", \n \"url\": \"http://httpbin.org/post\"\n}\n"
576574
```
577575

578576
In this respect, it may be used as a performant and lightweight method
@@ -602,10 +600,10 @@ s
602600
#> - textframes: TRUE
603601

604602
s |> recv(keep.raw = FALSE)
605-
#> [1] "{\"e\":\"kline\",\"E\":1652083907587,\"s\":\"BTCUSDT\",\"k\":{\"t\":1652083860000,\"T\":1652083919999,\"s\":\"BTCUSDT\",\"i\":\"1m\",\"f\":1352400783,\"L\":1352401304,\"o\":\"33509.32000000\",\"c\":\"33501.05000000\",\"h\":\"33509.33000000\",\"l\":\"33492.19000000\",\"v\":\"38.29280000\",\"n\":522,\"x\":false,\"q\":\"1282941.28760590\",\"V\":\"10.68340000\",\"Q\":\"357878.51734890\",\"B\":\"0\"}}"
603+
#> [1] "{\"e\":\"kline\",\"E\":1652162517227,\"s\":\"BTCUSDT\",\"k\":{\"t\":1652162460000,\"T\":1652162519999,\"s\":\"BTCUSDT\",\"i\":\"1m\",\"f\":1355281603,\"L\":1355283235,\"o\":\"31840.01000000\",\"c\":\"31821.53000000\",\"h\":\"31887.25000000\",\"l\":\"31821.53000000\",\"v\":\"104.62077000\",\"n\":1633,\"x\":false,\"q\":\"3331956.61656560\",\"V\":\"49.29040000\",\"Q\":\"1569718.18064700\",\"B\":\"0\"}}"
606604

607605
s |> recv(keep.raw = FALSE)
608-
#> [1] "{\"e\":\"kline\",\"E\":1652083909700,\"s\":\"BTCUSDT\",\"k\":{\"t\":1652083860000,\"T\":1652083919999,\"s\":\"BTCUSDT\",\"i\":\"1m\",\"f\":1352400783,\"L\":1352401310,\"o\":\"33509.32000000\",\"c\":\"33501.05000000\",\"h\":\"33509.33000000\",\"l\":\"33492.19000000\",\"v\":\"38.43526000\",\"n\":528,\"x\":false,\"q\":\"1287713.84719200\",\"V\":\"10.68371000\",\"Q\":\"357888.90267750\",\"B\":\"0\"}}"
606+
#> [1] "{\"e\":\"kline\",\"E\":1652162519242,\"s\":\"BTCUSDT\",\"k\":{\"t\":1652162460000,\"T\":1652162519999,\"s\":\"BTCUSDT\",\"i\":\"1m\",\"f\":1355281603,\"L\":1355283278,\"o\":\"31840.01000000\",\"c\":\"31820.01000000\",\"h\":\"31887.25000000\",\"l\":\"31820.00000000\",\"v\":\"107.18185000\",\"n\":1676,\"x\":false,\"q\":\"3413451.15905990\",\"V\":\"51.10822000\",\"Q\":\"1627561.59975630\",\"B\":\"0\"}}"
609607

610608
close(s)
611609
```

man/nano_init.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.

man/nanonext-package.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.

tests/tests.R

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ nanotest(identical(call_aio(msg), msg))
6767
nanotestn(tryCatch(msg$data, error = function(e) 0L))
6868
nanotest(identical(call_aio(n), n))
6969
nanotest(is_aio(n) == FALSE)
70-
sraio <- n$send_aio(as.raw(0L), mode = "r", timeout = 200)
71-
rraio <- n$recv_aio(mode = "r", timeout = 200)
72-
nanotestn(call_aio(rraio)$data)
70+
sraio <- n$send_aio(as.raw(0L), mode = "r", timeout = 500)
71+
rraio <- n$recv_aio(mode = "r", timeout = 500)
72+
nanotestwn(call_aio(rraio)$data)
7373
sraio <- n$send_aio(as.raw(1L), mode = "ra", timeout = 200)
7474
rraio <- n$recv_aio(mode = "ra", timeout = 200)
7575
sraio <- n$send_aio(as.raw(2L), mode = "raw", timeout = 200)
@@ -121,7 +121,7 @@ msg <- recv_aio(ctx1, mode = "ser", timeout = 400, keep.raw = FALSE)
121121
nanotest(is.logical(unresolved(msg)))
122122
nanotestn(call_aio(msg)$data)
123123
nanotest(unresolved(msg) == FALSE)
124-
nanotestwn(send(ctx, c(TRUE, FALSE, TRUE), block = 300))
124+
nanotestwn(send(ctx, c(TRUE, FALSE, TRUE), mode = "raw", block = 300))
125125
msg <- recv_aio(ctx1, mode = "l", timeout = 300)
126126
nanotestn(msg$raw)
127127
nanotestwn(request(ctx, c(1+3i, 4+2i), recv_mode = "complex", timeout = 300))
@@ -156,7 +156,7 @@ nanotest(close(surctx) == 0L)
156156
nanotest(close(surv) == 0L)
157157
nanotest(close(resp) == 0L)
158158

159-
nanotestwn(ncurl("http://www.cam.ac.uk/"))
159+
nanotestwn(ncurl("http://www.r-project.org/"))
160160
nanotestwn(ncurl("http://httpbin.org/post", convert = FALSE, method = "POST", headers = c(`Content-Type` = "text/plain"), data = "test"))
161161
nanotestwn(ncurl("http://httpbin.org/post", convert = FALSE, method = "POST", headers = list(`Content-Type` = "text/plain")))
162162
put1 <- ncurl("http://httpbin.org/put", async = TRUE, method = "PUT", headers = c(Authorization = "Bearer token"), data = "test")
@@ -176,8 +176,12 @@ nanotestn(tryCatch(.mirai_scm(), error = function(e) 0L))
176176
nanotest(inherits(bus <- socket(protocol = "bus"), "nanoSocket"))
177177
nanotest(inherits(push <- socket(protocol = "push"), "nanoSocket"))
178178
nanotest(inherits(pull <- socket(protocol = "pull"), "nanoSocket"))
179-
nanotest(identical(is_nano(bus), TRUE))
179+
nanotest(inherits(survey <- nano(protocol = "surveyor"), "nanoObject"))
180+
nanotest(inherits(respond <- nano(protocol = "respondent"), "nanoObject"))
181+
nanotest(is_nano(bus) == TRUE)
180182
nanotest(close(bus) == 0L)
181183
nanotest(close(push) == 0L)
182184
nanotest(close(pull) == 0L)
185+
nanotest(survey$close() == 0L)
186+
nanotest(respond$close() == 0L)
183187

0 commit comments

Comments
 (0)