@@ -28,10 +28,10 @@ Limitations
28
28
29
29
Read views have the following limitations:
30
30
31
- - Only the :ref: `memtx <engines-memtx >` engine is supported.
32
- - Only TREE and HASH :ref: `indexes <index-types >` are supported.
33
- - Pagination (the :ref: `after <box_index-select >` option) is supported only for TREE indexes.
34
31
32
+ - Only the :ref: `memtx <engines-memtx >` engine is supported.
33
+ - Only :ref: `TREE <indexes-tree >`, :ref: `HASH <indexes-hash >` and :ref: `functional <box_space-index_func >`
34
+ indexes are supported.
35
35
36
36
.. _working_with_read_views :
37
37
@@ -104,8 +104,39 @@ Similarly, you can retrieve data by the specific index.
104
104
- [3, 'Ace of Base', 1987]
105
105
...
106
106
107
+ Pagination is supported in read views in the same ways as in ``select `` requests
108
+ to spaces: using the ``fetch_pos `` and ``after `` arguments. To get the cursor position
109
+ after executing a request on a read view, set ``fetch_pos `` to ``true ``:
107
110
108
- ADD example with fech_pos and after
111
+ .. code-block :: tarantoolsession
112
+
113
+ tarantool> result, position = read_view1.space.bands:select({}, { limit = 3, fetch_pos = true })
114
+ ---
115
+ ...
116
+
117
+ tarantool> result
118
+ ---
119
+ - - [1, 'Roxette', 1986]
120
+ - [2, 'Scorpions', 1965]
121
+ - [3, 'Ace of Base', 1987]
122
+ ...
123
+
124
+ tarantool> position
125
+ ---
126
+ - kQM
127
+ ...
128
+
129
+ Then, pass this position in the ``after `` parameter of a request to get the
130
+ next data chunk:
131
+
132
+ .. code-block :: tarantoolsession
133
+
134
+ tarantool> read_view1.space.bands:select({}, { limit = 3, after = position })
135
+ ---
136
+ - - [4, 'The Beatles', 1960]
137
+ - [5, 'Pink Floyd', 1965]
138
+ - [6, 'The Rolling Stones', 1962]
139
+ ...
109
140
110
141
.. _closing_read_view :
111
142
@@ -133,7 +164,6 @@ On an attempt to use it, an error is raised.
133
164
Example
134
165
-------
135
166
136
-
137
167
A Tarantool session below demonstrates how to open a read view,
138
168
get data from this view, and close it.
139
169
To repeat these steps, you need to bootstrap a Tarantool instance
@@ -194,11 +224,9 @@ as described in :ref:`Using data operations <box_space-operations-detailed-examp
194
224
---
195
225
...
196
226
197
-
198
- ??? ADD example with fetch_pos and after
199
227
.. toctree ::
200
228
:maxdepth: 2
201
229
:hidden:
202
230
203
231
read_views/lua_api
204
- read_views/c_api
232
+ read_views/c_api
0 commit comments