Skip to content

Commit 21442a9

Browse files
committed
Getting started: net.box - restructure
1 parent 16bd4cc commit 21442a9

File tree

2 files changed

+37
-47
lines changed

2 files changed

+37
-47
lines changed

doc/code_snippets/snippets/connectors/instances.enabled/net_box/myapp.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function net_box_session()
2-
local net_box = require('net.box')
3-
local conn = net_box.connect('sampleuser:[email protected]:3301')
2+
net_box = require('net.box')
3+
conn = net_box.connect('sampleuser:[email protected]:3301')
44
conn:ping()
55

66
conn.space.bands:insert { 1, 'Roxette', 1986 }

doc/how-to/getting_started_net_box.rst

+35-45
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,45 @@ In this tutorial, the application layout is prepared manually:
5959

6060
.. literalinclude:: /code_snippets/snippets/connectors/instances.enabled/net_box/config.yaml
6161
:language: yaml
62+
:end-at: iproto
6263
:dedent:
6364

64-
* ``myapp.lua`` contains ``net.box`` requests used to interact with a :ref:`sample database <getting_started_net_box_sample_db>`. These requests are explained below in the :ref:`getting_started_net_box_developing_app` section.
6565

6666

67+
.. _getting_started_net_box_interactive:
6768

68-
.. _getting_started_net_box_developing_app:
69+
Making net.box requests interactively
70+
-------------------------------------
6971

70-
Developing the application
71-
--------------------------
72+
To try out ``net.box`` requests in the interactive console, you need to start sample applications:
73+
74+
1. Start the :ref:`sample_db <getting_started_net_box_sample_db>` application using ``tt start``:
75+
76+
.. code-block:: console
77+
78+
$ tt start sample_db
79+
80+
2. Start the :ref:`net_box <getting_started_net_box_creating-app>` application:
81+
82+
.. code-block:: console
83+
84+
$ tt start net_box
85+
86+
3. Connect to ``net_box:instance001`` using ``tt connect``:
87+
88+
.. code-block:: console
89+
90+
$ tt connect net_box:instance001
91+
• Connecting to the instance...
92+
• Connected to net_box:instance001
93+
94+
net_box:instance001>
95+
96+
In the instance's console, you can create a ``net.box`` connection and try out data operations.
97+
98+
99+
100+
.. _getting_started_net_box_creating_connection:
72101

73102
Creating a net.box connection
74103
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -225,45 +254,6 @@ The ``connection:close()`` method can be used to close the connection when it is
225254
:end-before: end
226255
:dedent:
227256

257+
.. NOTE::
228258

229-
230-
.. _getting_started_net_box_interactive:
231-
232-
Making net.box requests interactively
233-
-------------------------------------
234-
235-
To try out ``net.box`` requests in the interactive console, you need to start sample applications:
236-
237-
1. Start the :ref:`sample_db <getting_started_net_box_sample_db>` application using ``tt start``:
238-
239-
.. code-block:: console
240-
241-
$ tt start sample_db
242-
243-
2. Start the :ref:`net_box <getting_started_net_box_creating-app>` application:
244-
245-
.. code-block:: console
246-
247-
$ tt start net_box
248-
249-
3. Connect to ``net_box:instance001`` using ``tt connect``:
250-
251-
.. code-block:: console
252-
253-
$ tt connect net_box:instance001
254-
• Connecting to the instance...
255-
• Connected to net_box:instance001
256-
257-
net_box:instance001>
258-
259-
In the instance's console, you can create a ``net.box`` connection and try out data operations described in :ref:`getting_started_net_box_developing_app`:
260-
261-
.. code-block:: console
262-
263-
net_box:instance001> net_box = require('net.box')
264-
---
265-
...
266-
267-
net_box:instance001> conn = net_box.connect('sampleuser:[email protected]:3301')
268-
---
269-
...
259+
You can find the example with all the requests above on GitHub: `net_box <https://github.com/tarantool/doc/tree/latest/doc/code_snippets/snippets/connectors/instances.enabled/net_box>`_.

0 commit comments

Comments
 (0)