Skip to content

Commit 7bcda06

Browse files
authored
Merge pull request #29 from shikokuchuo/dev
Implements event-driven promises capability through the aio callback mechanism
2 parents 0883c80 + e8226fb commit 7bcda06

15 files changed

+151
-147
lines changed

DESCRIPTION

+6-2
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.13.6.9000
4+
Version: 0.13.6.9002
55
Description: R binding for NNG (Nanomsg Next Gen), a successor to ZeroMQ. NNG is
66
a socket library implementing 'Scalability Protocols', a reliable,
77
high-performance standard for common communications patterns including
@@ -26,10 +26,14 @@ License: GPL (>= 3)
2626
BugReports: https://github.com/shikokuchuo/nanonext/issues
2727
URL: https://shikokuchuo.net/nanonext/, https://github.com/shikokuchuo/nanonext/
2828
Encoding: UTF-8
29-
SystemRequirements: 'libnng' >= 1.5 and 'libmbedtls' >= 2.5, or 'cmake' to
29+
SystemRequirements: 'libnng' >= 1.6 and 'libmbedtls' >= 2.5, or 'cmake' to
3030
compile NNG and/or Mbed TLS included in package sources
3131
Depends:
3232
R (>= 3.5)
33+
Imports:
34+
later
35+
LinkingTo:
36+
later
3337
Suggests:
3438
knitr,
3539
markdown

NAMESPACE

+2
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export(recv_aio)
7575
export(recv_aio_signal)
7676
export(reply)
7777
export(request)
78+
export(request2)
7879
export(request_signal)
7980
export(send)
8081
export(send_aio)
@@ -96,6 +97,7 @@ export(until_)
9697
export(wait)
9798
export(wait_)
9899
export(write_cert)
100+
importFrom(later,later)
99101
importFrom(stats,start)
100102
importFrom(tools,md5sum)
101103
importFrom(utils,.DollarNames)

NEWS.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1-
# nanonext 0.13.6 (development)
1+
# nanonext 0.13.6.9002 (development)
2+
3+
#### New Features
4+
5+
* Integrates with the `later` package to provide the foundation for truly event-driven (non-polling) promises (thanks @jcheng5 for the initial prototype in #28), where side-effects are enacted asynchronously upon aio completion.
6+
* Adds `request2()` for creating a request that may be turned into an event-driven promise.
7+
8+
#### Updates
9+
10+
* Updates minimum 'libnng' version requirement to v1.6.0 (if a suitable system-installed version is not found, the bundled version is compiled from source).
211

312
# nanonext 0.13.6
413

R/context.R

+18
Original file line numberDiff line numberDiff line change
@@ -269,3 +269,21 @@ request_signal <- function(context,
269269
"integer", "logical", "numeric", "raw", "string"),
270270
timeout = NULL)
271271
data <- .Call(rnng_request_signal, context, data, cv, send_mode, recv_mode, timeout, environment())
272+
273+
#' Request2 (RPC Client for Req/Rep Protocol)
274+
#'
275+
#' \strong{request2} is the next generation request function that optionally
276+
#' takes a condition variable for signalling, and supports event-driven
277+
#' promises.
278+
#'
279+
#' @rdname request
280+
#' @export
281+
#'
282+
request2 <- function(context,
283+
data,
284+
cv = NULL,
285+
send_mode = c("serial", "raw", "next"),
286+
recv_mode = c("serial", "character", "complex", "double",
287+
"integer", "logical", "numeric", "raw", "string"),
288+
timeout = NULL)
289+
data <- .Call(rnng_request_promise, context, data, cv, send_mode, recv_mode, timeout, environment())

R/nanonext-package.R

+1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
#' @author Charlie Gao \email{charlie.gao@@shikokuchuo.net}
9393
#' (\href{https://orcid.org/0000-0002-0750-061X}{ORCID})
9494
#'
95+
#' @importFrom later later
9596
#' @importFrom stats start
9697
#' @importFrom tools md5sum
9798
#' @importFrom utils .DollarNames

README.Rmd

+2-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ vignette("nanonext", package = "nanonext")
149149

150150
#### Linux / Mac / Solaris
151151

152-
Installation from source requires 'libnng' >= v1.5.0 and 'libmbedtls' >= 2.5.0 (suitable installations are automatically detected), or else 'cmake' to compile 'libnng' v1.7.3 and 'libmbedtls' v3.6.0 LTS included within the package sources.
152+
Installation from source requires 'libnng' >= v1.6.0 and 'libmbedtls' >= 2.5.0 (suitable installations are automatically detected), or else 'cmake' to compile 'libnng' v1.7.3 and 'libmbedtls' v3.6.0 LTS included within the package sources.
153153

154154
**It is recommended for optimal performance and stability to let the package automatically compile bundled versions of 'libmbedtls' and 'libnng' during installation.** To ensure the libraries are compiled from source even if system installations are present, set the `NANONEXT_LIBS` environment variable prior to installation e.g. by `Sys.setenv(NANONEXT_LIBS = 1)`.
155155

@@ -169,6 +169,7 @@ We would like to acknowledge in particular:
169169

170170
- [Garrett D'Amore](https://github.com/gdamore), author of the NNG library, for generous advice and for implementing a feature request specifically for a more efficient 'aio' implementation in `nanonext`.
171171
- The [R Consortium](https://www.r-consortium.org/) for funding the development of the secure TLS capabilities in the package, and [Henrik Bengtsson](https://github.com/HenrikBengtsson) and [Will Landau](https://github.com/wlandau/)'s roles in making this possible.
172+
- [Joe Cheng](https://github.com/jcheng5/) for prototyping the integration of `nanonext` with `later` to support the next generation of completely event-driven promises in `mirai`.
172173
- [R Core](https://www.r-project.org/contributors.html) for various auxiliary functions for serialisation and raw / character conversion, which have been adopted by the package.
173174
- [Luke Tierney](https://github.com/ltierney/) and [Mike Cheng](https://github.com/coolbutuseless) for meticulous documentation of the R serialization mechanism, which led to the package's own implementation of a low-level interface to R serialization.
174175
- [Jeroen Ooms](https://github.com/jeroen) - for his 'Anticonf (tm)' configure script, on which our original 'configure' was based, although much modified since.

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ vignette("nanonext", package = "nanonext")
178178

179179
#### Linux / Mac / Solaris
180180

181-
Installation from source requires ‘libnng’ \>= v1.5.0 and ‘libmbedtls’
181+
Installation from source requires ‘libnng’ \>= v1.6.0 and ‘libmbedtls’
182182
\>= 2.5.0 (suitable installations are automatically detected), or else
183183
‘cmake’ to compile ‘libnng’ v1.7.3 and ‘libmbedtls’ v3.6.0 LTS included
184184
within the package sources.
@@ -221,6 +221,9 @@ We would like to acknowledge in particular:
221221
development of the secure TLS capabilities in the package, and [Henrik
222222
Bengtsson](https://github.com/HenrikBengtsson) and [Will
223223
Landau](https://github.com/wlandau/)’s roles in making this possible.
224+
- [Joe Cheng](https://github.com/jcheng5/) for prototyping the
225+
integration of `nanonext` with `later` to support the next generation
226+
of completely event-driven promises in `mirai`.
224227
- [R Core](https://www.r-project.org/contributors.html) for various
225228
auxiliary functions for serialisation and raw / character conversion,
226229
which have been adopted by the package.

configure

+2-2
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ fi
128128

129129
echo "#include <nng/nng.h>
130130
int main() {
131-
#if NNG_MAJOR_VERSION < 1 || NNG_MAJOR_VERSION == 1 && NNG_MINOR_VERSION < 5
131+
#if NNG_MAJOR_VERSION < 1 || NNG_MAJOR_VERSION == 1 && NNG_MINOR_VERSION < 6
132132
*(void *) 0 = 0;
133133
#endif
134134
}" | ${CC} ${NNG_CFLAGS} -xc - -o /dev/null > /dev/null 2>&1
@@ -140,7 +140,7 @@ fi
140140

141141
if [ $? -ne 0 ]
142142
then
143-
echo "No existing 'libnng' >= 1.5 found"
143+
echo "No existing 'libnng' >= 1.6 found"
144144
echo "Detecting 'cmake'..."
145145
which cmake
146146
if [ $? -ne 0 ]

man/request.Rd

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)