Document `from_fd` net.box module function
Nobody has claimed this yet.
- Dominant language
- CSS
- Stars
- 15
- Forks
- 49
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 3
Description
Product: Tarantool
Since: 3.0
Root document: https://www.tarantool.io/en/doc/latest/reference/reference_lua/net_box/
SME: @ locker
Details
The function takes a file descriptor number (fd) as its first argument
and a table of connection options as its second, optional argument. It
creates and returns a new connection object.
The fd should point to a socket and be switched to the non-blocking
mode, but this isn't enforced. If the fd is invalid, the connection may
not work as expected.
The functions take the same options as connect.
The function takes the ownership of the fd, i.e. the fd must not be used
or closed after this function successfully returns.
Example:
The code below connects to a Tarantool instance at port 3301 using
the socket module, then wraps the socket fd in a net.box
connection object.
local net = require('net.box')
local socket = require('socket')
-- Connect a socket then wrap it in a net.box connection object.
local s = socket.tcp_connect('localhost', 3301)
assert(s ~= nil)
local conn = net.from_fd(s:fd(), {fetch_schema = false})
s:detach()
conn:call('box.schema.user.info')
conn:close()
Requested by @locker in https://github.com/tarantool/tarantool/commit/ae441c995e25c965a969ac1381487fc23c1f0643.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Update the net.box reference page linked as the root document, locating the module-function section and the existing connect documentation. Document from_fd's arguments, non-blocking fd requirement, option handling, ownership, and the provided socket example; done when the function is covered consistently in the reference page.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100