Skip to content

Commit 0accbf0

Browse files
committed
annotation updates
1 parent 5dc10b4 commit 0accbf0

File tree

5 files changed

+134
-17
lines changed

5 files changed

+134
-17
lines changed

meta/3rd/OpenResty/library/ngx.re.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ function re.opt(option, value) end
9191
---
9292
---@param subj string
9393
---@param regex string
94-
---@param opts ngx.re.options
94+
---@param opts? ngx.re.options
9595
---@param ctx? ngx.re.ctx
9696
---@param max? number
9797
---@param res? string[]

meta/3rd/OpenResty/library/ngx.ssl.lua

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function ssl.set_der_priv_key(der_priv_key) end
2222
--- This function can be called in any context.
2323
---
2424
---@param pem_priv_key string
25-
---@return string? priv_key
25+
---@return ffi.cdata*? priv_key
2626
---@return string? error
2727
function ssl.parse_pem_priv_key(pem_priv_key) end
2828

@@ -49,7 +49,7 @@ function ssl.get_tls1_version() end
4949
---
5050
--- Note that this set_cert function will run slightly faster, in terms of CPU cycles wasted, than the set_der_cert variant, since the first function uses opaque cdata pointers which do not require any additional conversion needed to be performed by the SSL library during the SSL handshake.
5151
---
52-
---@param cert_chain string
52+
---@param cert_chain ffi.cdata*
5353
---@return boolean ok
5454
---@return string? error
5555
function ssl.set_cert(cert_chain) end
@@ -63,7 +63,7 @@ ssl.TLS1_VERSION=769
6363
---
6464
--- Note that this set_priv_key function will run slightly faster, in terms of CPU cycles wasted, than the set_der_priv_key variant, since the first function uses opaque cdata pointers which do not require any additional conversion needed to be performed by the SSL library during the SSL handshake.
6565
---
66-
---@param priv_key string
66+
---@param priv_key ffi.cdata*
6767
---@return boolean ok
6868
---@return string? error
6969
function ssl.set_priv_key(priv_key) end
@@ -174,7 +174,8 @@ function ssl.raw_client_addr() end
174174
---
175175
--- This function can be called in any context.
176176
---
177-
---@return string? cert_chain
177+
---@param pem_cert_chain string
178+
---@return ffi.cdata*? cert_chain
178179
---@return string? error
179180
function ssl.parse_pem_cert(pem_cert_chain) end
180181

@@ -276,7 +277,7 @@ function ssl.cert_pem_to_der(pem_cert_chain) end
276277
---
277278
--- This function was first added in version 0.1.20.
278279
---
279-
---@param ca_certs? any # the CA certificate chain opaque pointer returned by the parse_pem_cert function for the current SSL connection. The list of certificates will be sent to clients. Also, they will be added to trusted store. If omitted, will not send any CA certificate to clients.
280+
---@param ca_certs? ffi.cdata* # the CA certificate chain opaque pointer returned by the parse_pem_cert function for the current SSL connection. The list of certificates will be sent to clients. Also, they will be added to trusted store. If omitted, will not send any CA certificate to clients.
280281
---@param depth? number verification depth in the client certificates chain. If omitted, will use the value specified by ssl_verify_depth.
281282
---@return boolean ok
282283
---@return string? error
Lines changed: 61 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,62 @@
11
---@meta
2-
resty_shell={}
3-
function resty_shell.run(cmd, stdin, timeout, max_size) end
4-
resty_shell.version=0.01
5-
return resty_shell
2+
3+
local shell = {
4+
version = 0.03,
5+
}
6+
7+
8+
--- Runs a shell command, `cmd`, with an optional stdin.
9+
---
10+
--- The `cmd` argument can either be a single string value (e.g. `"echo 'hello,
11+
--- world'"`) or an array-like Lua table (e.g. `{"echo", "hello, world"}`). The
12+
--- former is equivalent to `{"/bin/sh", "-c", "echo 'hello, world'"}`, but simpler
13+
--- and slightly faster.
14+
---
15+
--- When the `stdin` argument is `nil` or `""`, the stdin device will immediately
16+
--- be closed.
17+
---
18+
--- The `timeout` argument specifies the timeout threshold (in ms) for
19+
--- stderr/stdout reading timeout, stdin writing timeout, and process waiting
20+
--- timeout. The default is 10 seconds as per https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/pipe.md#set_timeouts
21+
---
22+
--- The `max_size` argument specifies the maximum size allowed for each output
23+
--- data stream of stdout and stderr. When exceeding the limit, the `run()`
24+
--- function will immediately stop reading any more data from the stream and return
25+
--- an error string in the `reason` return value: `"failed to read stdout: too much
26+
--- data"`.
27+
---
28+
--- Upon terminating successfully (with a zero exit status), `ok` will be `true`,
29+
--- `reason` will be `"exit"`, and `status` will hold the sub-process exit status.
30+
---
31+
--- Upon terminating abnormally (non-zero exit status), `ok` will be `false`,
32+
--- `reason` will be `"exit"`, and `status` will hold the sub-process exit status.
33+
---
34+
--- Upon exceeding a timeout threshold or any other unexpected error, `ok` will be
35+
--- `nil`, and `reason` will be a string describing the error.
36+
---
37+
--- When a timeout threshold is exceeded, the sub-process will be terminated as
38+
--- such:
39+
---
40+
--- 1. first, by receiving a `SIGTERM` signal from this library,
41+
--- 2. then, after 1ms, by receiving a `SIGKILL` signal from this library.
42+
---
43+
--- Note that child processes of the sub-process (if any) will not be terminated.
44+
--- You may need to terminate these processes yourself.
45+
---
46+
--- When the sub-process is terminated by a UNIX signal, the `reason` return value
47+
--- will be `"signal"` and the `status` return value will hold the signal number.
48+
---
49+
---@param cmd string|string[]
50+
---@param stdin? string
51+
---@param timeout? number
52+
---@param max_size? number
53+
---
54+
---@return boolean ok
55+
---@return string? stdout
56+
---@return string? stderr
57+
---@return string|'"exit"'|'"signal"' reason
58+
---@return number? status
59+
function shell.run(cmd, stdin, timeout, max_size) end
60+
61+
62+
return shell
Lines changed: 64 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,65 @@
11
---@meta
2-
resty_signal={}
3-
function resty_signal.kill(pid, sig) end
4-
function resty_signal.signum(name) end
5-
resty_signal.version=0.02
6-
return resty_signal
2+
3+
local signal = {
4+
version = 0.03,
5+
}
6+
7+
---@alias resty.signal.name
8+
---| '"HUP"'
9+
---| '"INT"'
10+
---| '"QUIT"'
11+
---| '"ILL"'
12+
---| '"TRAP"'
13+
---| '"ABRT"'
14+
---| '"BUS"'
15+
---| '"FPE"'
16+
---| '"KILL"'
17+
---| '"USR1"'
18+
---| '"SEGV"'
19+
---| '"USR2"'
20+
---| '"PIPE"'
21+
---| '"ALRM"'
22+
---| '"TERM"'
23+
---| '"CHLD"'
24+
---| '"CONT"'
25+
---| '"STOP"'
26+
---| '"TSTP"'
27+
---| '"TTIN"'
28+
---| '"TTOU"'
29+
---| '"URG"'
30+
---| '"XCPU"'
31+
---| '"XFSZ"'
32+
---| '"VTALRM"'
33+
---| '"PROF"'
34+
---| '"WINCH"'
35+
---| '"IO"'
36+
---| '"PWR"'
37+
---| '"EMT"'
38+
---| '"SYS"'
39+
---| '"INFO"'
40+
---| '"NONE"' # The special signal name NONE is also supported, which is mapped to zero (0).
41+
42+
43+
---
44+
-- Sends a signal with its name string or number value to the process of the specified pid.
45+
--
46+
-- All signal names accepted by signum are supported, like HUP, KILL, and TERM.
47+
--
48+
-- Signal numbers are also supported when specifying nonportable system-specific signals is desired.
49+
--
50+
---@param pid number
51+
---@param signal_name_or_num number|resty.signal.name
52+
---
53+
---@return boolean ok
54+
---@return string? error
55+
function signal.kill(pid, signal_name_or_num) end
56+
57+
---
58+
-- Maps the signal name specified to the system-specific signal number.
59+
-- Returns `nil` if the signal name is not known.
60+
--
61+
---@param name resty.signal.name
62+
---@return number|nil
63+
function signal.signum(name) end
64+
65+
return signal

meta/3rd/OpenResty/library/tablepool.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---@meta
2-
local tablepool={}
2+
local tablepool = {}
33

44
--- Releases the already used Lua table, `tb`, into the table pool named `pool_name`. If the specified table pool does not exist, create it right away.
55
---
@@ -13,7 +13,7 @@ local tablepool={}
1313
---
1414
---@param pool_name string
1515
---@param tb table
16-
---@param no_clear boolean
16+
---@param no_clear? boolean
1717
function tablepool.release(pool_name, tb, no_clear) end
1818

1919
--- Fetches a (free) Lua table from the table pool of the specified name `pool_name`.

0 commit comments

Comments
 (0)