From a1c28b33d22fe3c72648a634fb41d5ec1e5ea141 Mon Sep 17 00:00:00 2001 From: Bilal2453 Date: Sat, 11 Jan 2025 01:26:06 +0300 Subject: [PATCH] fixes #6: update the packages to luvit/ org --- docs/coro-channel.md | 9 +++++---- docs/coro-fs.md | 44 +++++++++++++++++++++++------------------- docs/coro-http.md | 5 +++-- docs/coro-net.md | 7 ++++--- docs/coro-spawn.md | 11 ++++++----- docs/coro-split.md | 5 +++-- docs/coro-websocket.md | 9 +++++---- docs/coro-wrapper.md | 6 +++--- 8 files changed, 53 insertions(+), 43 deletions(-) diff --git a/docs/coro-channel.md b/docs/coro-channel.md index cd71950..eca603b 100644 --- a/docs/coro-channel.md +++ b/docs/coro-channel.md @@ -4,16 +4,17 @@ layout: doc # coro-channel -Documentation for the [coro-channel](https://github.com/luvit/lit/blob/master/deps/coro-channel.lua) module, version 3.0.3. +Documentation for the [coro-channel](https://github.com/luvit/lit/blob/master/deps/coro-channel.lua) library, version 3.0.3. -[coro-channel](https://github.com/luvit/lit/blob/master/deps/coro-channel.lua) is a wrapper module that wraps [stream handles](https://github.com/luvit/luv/blob/master/docs.md#uv_stream_t--stream-handle) (or any other handle that inherits stream) to provide a sync style read/write interface making use of Lua coroutines, and without blocking the event loop. +[coro-channel](https://github.com/luvit/lit/blob/master/deps/coro-channel.lua) is a wrapper library that wraps [stream handles](https://github.com/luvit/luv/blob/master/docs.md#uv_stream_t--stream-handle) (or any other handle that inherits stream) to provide a sync style read/write interface making use of Lua coroutines, and without blocking the event loop. ### Installation ```sh -lit install creationix/coro-channel +lit install luvit/coro-channel ``` -[On Lit search.](https://luvit.io/lit.html#coro-channel) + +[On Lit search.](https://luvit.io/lit.html#author:luvit%20coro-channel) ---- diff --git a/docs/coro-fs.md b/docs/coro-fs.md index 87fab58..8eedd07 100644 --- a/docs/coro-fs.md +++ b/docs/coro-fs.md @@ -4,7 +4,7 @@ layout: doc # coro-fs -Documentation for the module [coro-fs](https://github.com/luvit/lit/blob/master/deps/coro-fs.lua), version 2.2.4. +Documentation for the [coro-fs](https://github.com/luvit/lit/blob/master/deps/coro-fs.lua) library, version 2.2.4. [coro-fs](https://github.com/luvit/lit/blob/master/deps/coro-fs.lua) is a library for asynchronous non-blocking filesystem operations that keeps the synchronous code style, making use of Lua coroutines. @@ -12,30 +12,34 @@ Luvit's built-in `fs` module already has asynchronous non-blocking operations (t This allows you to perform all the FS operations Luvit built-in `fs` has, but with a synchronous code style making use of Lua coroutines. -Note: By choosing to do asynchronous FS, you are making a tradeoff. -First off, Luvit (and coro-fs) uses Libuv for filesystem IO, while the synchronous blocking calls in the Luvit `fs` API (e.x. `fs.writeFileSync`) will block a thread, they *still* allow other I/O operations to happen, and the event loop can still tick just fine, this is because Libuv has a threadpool which all I/O happens in (by default 4 threads and can be changed with the `UV_THREADPOOL_SIZE` environment variable), one of those threads is blocked instead. So you can aboslutely be doing 4 blocking reads/writes (by default) before you actually run into issues where you need asynchronous FS. For example, if you are running a web server where you read a file and send it back, it is possible that you could receive 4 connections at the same time, they all concurrently read some file and send the responses back without interrupting each other. -The tradeoff you make by using asynchronous FS is performance, synchronous I/O is much faster but it blocks a thread in the threadpool, while asynchronous I/O is much slower but won't block any threads. Unless you are running a very busy server, I can't imagine you need asynchronous FS! - -Another Note: Luvit built-in async fs *ALREADY* has coroutine support which achieve a similar purpose to this module: -```lua -local fs = require('fs') -local co = coroutine.running() -local contents = fs.readFile('./my_file.txt', co) -print("The file contains: ", contents) -``` -vs -```lua -local coro_fs = require('coro-fs') -local contents = coro_fs.readFile('./my_file.txt') -print("The file contains: ", contents) -``` +> Note: By choosing to do asynchronous FS, you are making a tradeoff. +> First off, Luvit (and coro-fs) uses Libuv for filesystem IO, while the synchronous blocking calls in the Luvit `fs` API (e.x. `fs.writeFileSync`) will block a thread, they *still* allow other I/O operations to happen, and the event loop can still tick just fine, this is because Libuv has a threadpool which all I/O happens in (by default 4 threads and can be changed with the `UV_THREADPOOL_SIZE` environment variable), so one of those threads is blocked instead of the main thread. +> +> In other words you may execute up to 4 blocking reads/writes (by default) concurrently before you actually run into issues where you need asynchronous FS. For example, if you are running a web server where you read a file and send it back, it is possible that you could receive 4 connections at the same time, they all concurrently read some file and send the responses back without interrupting each other. +> +> The tradeoff you make by using asynchronous FS is performance, synchronous I/O is much faster but it blocks a thread in the threadpool, while asynchronous I/O is much slower but won't block any threads. Unless you are running a very busy server, I can't imagine you need asynchronous FS! + +> Note: Luvit built-in async fs *ALREADY* has coroutine support which achieve a similar purpose to this module: +> ```lua +> local fs = require('fs') +> local co = coroutine.running() +> local contents = fs.readFile('./> my_file.txt', co) +> print("The file contains: ", contents) +> ``` +> vs +> ```lua +> local coro_fs = require('coro-fs') +> local contents = coro_fs.readFile('./my_file.txt') +> print("The file contains: ", contents) +> ``` ### Installation ```sh -lit install creationix/coro-fs +lit install luvit/coro-fs ``` -[On Lit search.](https://luvit.io/lit.html#coro-fs) + +[On Lit search.](https://luvit.io/lit.html#author:luvit%20coro-fs) ---- diff --git a/docs/coro-http.md b/docs/coro-http.md index c3b7fa5..7e062a0 100644 --- a/docs/coro-http.md +++ b/docs/coro-http.md @@ -17,9 +17,10 @@ Many thanks for [@trumedian](https://github.com/truemedian) for helping out with ### Installation ```sh -lit install creationix/coro-http +lit install luvit/coro-http ``` -[On Lit search.](https://luvit.io/lit.html#coro-http) + +[On Lit search.](https://luvit.io/lit.html#author:luvit%20coro-http) ---- diff --git a/docs/coro-net.md b/docs/coro-net.md index f926a92..3e3aac3 100644 --- a/docs/coro-net.md +++ b/docs/coro-net.md @@ -4,16 +4,17 @@ layout: doc # coro-net -Documentation for the module [coro-net](https://github.com/luvit/lit/blob/master/deps/coro-net.lua), version 3.2.1. +Documentation for the [coro-net](https://github.com/luvit/lit/blob/master/deps/coro-net.lua) library, version 3.2.1. [coro-net](https://github.com/luvit/lit/blob/master/deps/coro-net.lua) is a library for handling TCP and generally pipes, with an optional secure-layer support using a synchronous style interface. ### Installation ```sh -lit install creationix/coro-net +lit install luvit/coro-net ``` -[On Lit search.](https://luvit.io/lit.html#coro-net) + +[On Lit search.](https://luvit.io/lit.html#author:luvit%20coro-net) ---- diff --git a/docs/coro-spawn.md b/docs/coro-spawn.md index 219b0ee..ec926c5 100644 --- a/docs/coro-spawn.md +++ b/docs/coro-spawn.md @@ -4,18 +4,19 @@ layout: doc # coro-spawn -Documentation for the [coro-spawn](https://github.com/luvit/lit/blob/master/deps/coro-spawn.lua) module, version 3.0.3. +Documentation for the [coro-spawn](https://github.com/luvit/lit/blob/master/deps/coro-spawn.lua) library, version 3.0.3. -[coro-spawn](https://github.com/luvit/lit/blob/master/deps/coro-spawn.lua) is single-function module that provides spawning child-processes with a synchronous interface making use of Lua coroutines. +[coro-spawn](https://github.com/luvit/lit/blob/master/deps/coro-spawn.lua) is single-function library that provides spawning child-processes with a synchronous interface making use of Lua coroutines. -Throughout the documentation, we will refer to the function return of this module as `spawn`. And it is obtained by calling `require("coro-spawn")`. +Throughout the documentation, we will refer to the function return of this library as `spawn`. It is accessed by calling `require("coro-spawn")`. ### Installation ```sh -lit install creationix/coro-spawn +lit install luvit/coro-spawn ``` -[On Lit search.](https://luvit.io/lit.html#coro-spawn) + +[On Lit search.](https://luvit.io/lit.html#author:luvit%20coro-spawn) ---- diff --git a/docs/coro-split.md b/docs/coro-split.md index 83667e7..1f70638 100644 --- a/docs/coro-split.md +++ b/docs/coro-split.md @@ -4,17 +4,18 @@ layout: doc # coro-split -Documentation for the [coro-split](https://github.com/luvit/lit/blob/master/deps/coro-split.lua) module, version 2.0.2. +Documentation for the [coro-split](https://github.com/luvit/lit/blob/master/deps/coro-split.lua) library, version 2.0.2. [coro-split](https://github.com/luvit/lit/blob/master/deps/coro-split.lua) is single-function module that takes multiple functions as input, wraps each of them in a coroutine and runs it, and yields until all of the provided tasks are completed. -Throughout the documentation, we will refer to the function return of this module as `split`. And it is obtained by calling `require("coro-split")`. +Throughout the documentation, we will refer to the function return of this module as `split`. It is accessed by calling `require("coro-split")`. ### Installation ```sh lit install creationix/coro-split ``` + [On Lit search.](https://luvit.io/lit.html#coro-split) ---- diff --git a/docs/coro-websocket.md b/docs/coro-websocket.md index a0c7c5a..621c351 100644 --- a/docs/coro-websocket.md +++ b/docs/coro-websocket.md @@ -4,16 +4,17 @@ layout: doc # coro-websocket -Documentation for the module [coro-websocket](https://github.com/luvit/lit/blob/master/deps/coro-websocket.lua), version 3.1.0. +Documentation for the [coro-websocket](https://github.com/luvit/lit/blob/master/deps/coro-websocket.lua) library, version 3.1.0. -[coro-websocket](https://github.com/luvit/lit/blob/master/deps/coro-websocket.lua) is a library that implements the WebSocket WS(s) protocol with a synchronous style interface making use of Lua coroutines. +[coro-websocket](https://github.com/luvit/lit/blob/master/deps/coro-websocket.lua) is a library that implements the [WebSocket](https://en.wikipedia.org/wiki/WebSocket) WS(s) protocol with a synchronous style interface making use of Lua coroutines. ### Installation ```sh -lit install creationix/coro-websocket +lit install luvit/coro-websocket ``` -[On Lit search.](https://luvit.io/lit.html#coro-websocket) + +[On Lit search.](https://luvit.io/lit.html#author:luvit%20coro-websocket) ---- diff --git a/docs/coro-wrapper.md b/docs/coro-wrapper.md index 2e171ea..01b24a0 100644 --- a/docs/coro-wrapper.md +++ b/docs/coro-wrapper.md @@ -4,7 +4,7 @@ layout: doc # coro-wrapper -Documentation for the [coro-wrapper](https://github.com/luvit/lit/blob/master/deps/coro-wrapper.lua) module, version 3.1.0. +Documentation for the [coro-wrapper](https://github.com/luvit/lit/blob/master/deps/coro-wrapper.lua) library, version 3.1.0. [coro-wrapper](https://github.com/luvit/lit/blob/master/deps/coro-wrapper.lua) is an adapter module for applying decoders/encoders/merger adapters to [coro-channel](https://bilal2453.github.io/coro-docs/docs/coro-channel.html) readers and writers. @@ -14,9 +14,9 @@ The rest of the adapters have a similar concept. ### Installation ```sh -lit install creationix/coro-wrapper +lit install luvit/coro-wrapper ``` -[On Lit search.](https://luvit.io/lit.html#coro-wrapper) +[On Lit search.](https://luvit.io/lit.html#author:luvit%20coro-wrapper) ----