Releases: moonbitlang/async
v0.18.1
-
refactor API of
@fs.openand other helpers that invoke it:- a new
enumCreateMode, passed via the flagcreate_modeis introduced.CreateModeprovides five different modes controlling behavior of new file creation and truncation of existing file. - a new optional parameter
permissionis introduced for@fs.open,@fs.mkdiretc., to determine the Unix permission of create file/directory, if any.permissionis optional and has a sane default value for each function - the
create? : Intandtruncate? : Boolparameters are deprecated, in favor ofcreate_mode+permission
In addition to style change, there are the following notable differences:
- exclusive new file creation (raise error if file already exists) is now supported
- permission of new file/directory is now optional
- a new
-
add global signal handling support via a new package
moonbitlang/async/signal. When a program usingmoonbitlang/asyncreceivesSIGINT/SIGTERM/SIGHUP(Unix) orCTRL_C_EVENT/CTRL_BREAK_EVENT/CTRL_CLOSE_EVENT(Windows), the default behavior now becomes cancelling the whole async program gracefully, usingmoonbitlang/async's native cancellation mechanism. The set of signals that triggers this global cancellation behavior can be configured via@signal.set_global_cancellation_signals -
the certificate of the peer in a TLS connection can now be retrieved via
@tls.Tls::get_peer_certificate. The returned certificate is in DER format. This is useful for tls-server-endpoint style channel binding in SASL -
add
@fs.renamefor asynchronously rename files and directories -
on Windows, the TLS server implementation for testing no longer needs to load certificate into the system certificate store. Instead, it can now load certificate from local file directly. If you have previously added the certificate in
test_keysto your system certificate store on Windows for testingmoonbitlang/async, the certificate can now be removed viacertutil -delstore -user My <cert-id>, where<cert-id>can be found viacertutil -store -user My
v0.18.0
- add a new package
moonbitlang/async/raw_fd, which provides a type@raw_fd.RawFdfor integrating a raw file descriptor intomoonbitlang/asyncand performing asynchronous IO on it - [breaking] cookies are now stored separately in
@http.Response, as an array of@http.Cookie, a structured type representing cookies. For client, they should no longer readSet-Cookiefrom headers. For server, cookies should now be supplied via thecookiesfield of@http.Responseinstead of manually passingSet-Cookieheaders. This solves the previous problem where multipleSet-Cookieheaders are handled incorrectly - [breaking]
@websocket.from_http_clientnow raise a new error constructorWebSocketError::HandshakeRejected, which contains the server response header
v0.17.1
- introduce
moonbitlang/async/gzip, which provides gzip encoding/decoding in the form of@io.Writer/@io.Readertransformer - the HTTP client can now automatically request gzip compression and perform gzip decompression for response body, if
Accept-Encodingis not explicitly set Content-Lengthcan now be manually set in theextra_headersparameter for various HTTP API. IfContent-Lengthis manually set, the body can still be sent incrementally, but its final length must equal the value ofContent-Length- the HTTP client now accepts a
verify? : Bool = trueparameter. If set tofalse, HTTPS certificate validation will be skipped. This flag should be used for testing only, as skipping certificate validation destroy the safety guarantee of HTTPS - adapt latest MoonBit version (v0.9.0)
v0.17.0
- [breaking] the signature of
@async.TaskGroup::spawn_loophas changed. The callback function should no longer returnIterResult, because it is deprecated onmoonbitlang/core. Instead, the callback function must now returnUnit. To break away fromspawn_loop, users can raise a special error type@async.BreakFromSpawnLoopinstead - [breaking]
@socket.TcpServer::new,@socket.UdpServer::newand@http.Server::neware nowasync - The following types can now be constructed via struct constructor syntax, saving
::new:@async.Queue(aka@aqueue.Queue),@async.Semaphore(aka@semaphore.Semaphore) and@async.Cond(aka@cond_var.Cond)@socket.{TcpServer,UdpServer,UdpClient}@http.Server
- the local address of
@socket.{Tcp,TcpServer,UdpClient,UdpServer}and@http.Servercan now be retrieved via struct field.addrdirectly. The getter methods.addr()are deprecated in favor of the field - adapt latest MoonBit version (v0.8.4)
- various bug fix
v0.16.8
- introduce a new time
@async.Timerfor more sophisticated timer operations, such as multiple waiters and timer renewal. The latter is especially useful for setting up an idle timeout mechanism. See #313 and the API doc for more details. You can also find a simple example atexamples/idle_timeout - add
.fd()method to@socket.{Tcp,TcpServer,UdpClient,UdpServer}, allowing users to manually bind platform specific socket API missing frommoonbitlang/async/socket - remove some deprecated API
v0.16.7
- add HTTP client support for JavaScript backend using
fetchAPI. All HTTP client API inmoonbitlang/async/httpare available (except HTTP proxy support) - add
@js_async.ReadableStreamsupport for integration with WebAPIReadableStream. Two scenarios are supported:- reading from a
ReadableStreamfrom the JS side - create an anonymous pipe whose read end is a JS
ReadableStream, this allows passing data to foreign JS code via theReadableStreaminterface
- reading from a
- the HTTP client is now compatible with close-delimited response (i.e. no
Content-LengthnorTransfer-Encodingset, response is delimited by connection closure) - various bug fix
v0.16.6
v0.16.5
@async.Queuenow supportBlocking/DiscardOldest/DiscardLatestqueues with zero buffer size. For blocking queues, zero buffer size means that data transfer can only happen if a reader and a writer is present at the same time- add advisory file locking support via
@fs.File::{lock, try_lock, unlock} - add a new API
@fs.tmpdirfor creating temporary directory
v0.16.4
v0.16.3
- add
@process.spawn(group, cmd, args, ..), which spawn a process inside the task groupgroup, and return a handle@process.Processthat can be used to retrieve the PID of the process or wait for the process. The child process follows structured concurrency rules:- unless
no_wait=truethe task group wait for the child process - when the task group is about to terminate, the child process will be cancelled if it is still running
with_task_groupwill only return after the child process actually terminates
- unless
@process.run,@process.spawnand@process.spawn_orphannow acceptsStringViewandArrayViewas arguments- cancelling a task via
@async.Task::spawnwill no longer fail the whole task group, even if the task is spawned withallow_failure=false(the default) - calling
@async.TaskGroup::{spawn,spawn_bg}during the cleanup phrase ofwith_task_group(i.e. the group is about to terminate, all remaining child tasks are cancelled, but there are still child tasks running) will no longer crash the program. However, the spawned child task will be cancelled immediately. Callingspawn/spawn_bginside group defer or afterwith_task_groupreturns will still crash the program, though - Child process spawned by
@process.run/@process.spawnwill now be killed automatically when the main process is killed on Windows - add more examples to
examples, and add a brief introduction to most examples - adapt latest MoonBit version and fix bugs