|
| 1 | + |
| 2 | +msgid "Streams and interactive transactions" |
| 3 | +msgstr "Стримы и интерактивные транзакции" |
| 4 | + |
| 5 | +msgid "Overview" |
| 6 | +msgstr "Общие сведения" |
| 7 | + |
| 8 | +msgid "" |
| 9 | +"Since :tarantool-release:`2.10.0-beta1`, iproto implements streams and " |
| 10 | +"interactive transactions." |
| 11 | +msgstr "" |
| 12 | +"Начиная с версии :tarantool-release:`2.10.0-beta1`, в iproto реализованы " |
| 13 | +"стримы и интерактивные транзакции." |
| 14 | + |
| 15 | +msgid "Stream" |
| 16 | +msgstr "Стрим" |
| 17 | + |
| 18 | +msgid "" |
| 19 | +"A stream supports multiplexing several transactions over one connection. All" |
| 20 | +" requests in the stream are executed strictly sequentially, which allows the" |
| 21 | +" implementation of :term:`interactive transactions <interactive " |
| 22 | +"transaction>`." |
| 23 | +msgstr "" |
| 24 | +"Стрим поддерживает мультиплексирование нескольких транзакций в рамках одного" |
| 25 | +" соединения. Все запросы в стриме выполняются строго последовательно, что " |
| 26 | +"позволяет проводить :term:`интерактивные транзакции <interactive " |
| 27 | +"transaction>`." |
| 28 | + |
| 29 | +msgid "" |
| 30 | +"Unlike a thread associated with multitasking and execution within a program," |
| 31 | +" a stream transfers data via the protocol between a client and a server." |
| 32 | +msgstr "" |
| 33 | +"Стрим передает данные по протоколу между клиентом и сервером. Это понятие не" |
| 34 | +" связано с потоками выполнения, реализующими многозадачность внутри " |
| 35 | +"программ." |
| 36 | + |
| 37 | +msgid "Interactive transaction" |
| 38 | +msgstr "Интерактивная транзакция" |
| 39 | + |
| 40 | +msgid "" |
| 41 | +"An interactive transaction is a transaction that does not need to be sent in" |
| 42 | +" a single request. The ``begin``, ``commit``, and other TX statements can be" |
| 43 | +" sent and executed in different requests." |
| 44 | +msgstr "" |
| 45 | +"Интерактивной называется транзакция, которую не обязательно отправлять " |
| 46 | +"целиком в рамках одного запроса. ``begin``, ``commit`` и другие TX-" |
| 47 | +"инструкции могут быть отправлены и выполнены в разных запросах." |
| 48 | + |
| 49 | +msgid "New features" |
| 50 | +msgstr "Новые функциональные возможности" |
| 51 | + |
| 52 | +msgid "" |
| 53 | +"The primary purpose of :term:`streams <stream>` is to execute transactions " |
| 54 | +"via iproto. Every stream has its own identifier, which is unique within the " |
| 55 | +"connection. All requests with the same non-zero stream ID belong to the same" |
| 56 | +" stream. All requests in the stream are processed synchronously. The next " |
| 57 | +"request will not start executing until the previous one is completed. If a " |
| 58 | +"request's stream ID is ``0``, it does not belong to any stream and is " |
| 59 | +"processed in the old way." |
| 60 | +msgstr "" |
| 61 | +"Основное предназначение :term:`стрима <stream>` --- выполнение транзакций " |
| 62 | +"внутри потока iproto. У каждого стрима есть идентификатор, уникальный в " |
| 63 | +"рамках соединения. Все запросы с одинаковым ненулевым идентификатором стрима" |
| 64 | +" относятся к одному стриму. Запросы в стриме выполняются синхронно. " |
| 65 | +"Следующий запрос не начинает выполняться, пока не завершится предыдущий. " |
| 66 | +"Если идентификатор стрима запроса равен ``0``, то этот запрос не привязан к " |
| 67 | +"какому-либо стриму и обрабатывается обычным способом." |
| 68 | + |
| 69 | +msgid "" |
| 70 | +"In :doc:`net.box </reference/reference_lua/net_box>`, a stream is an object " |
| 71 | +"above the connection that has the same methods but allows executing requests" |
| 72 | +" sequentially. The ID is generated on the client side automatically. If a " |
| 73 | +"user writes their own connector and wants to use streams, they must transmit" |
| 74 | +" the ``stream_id`` over the iproto protocol." |
| 75 | +msgstr "" |
| 76 | +"В :doc:`net.box </reference/reference_lua/net_box>` стрим представляет собой" |
| 77 | +" объект над соединением, который имеет те же методы, но позволяет выполнять " |
| 78 | +"запросы последовательно. Идентификатор генерируется автоматически на стороне" |
| 79 | +" клиента. Пользователь может также создать собственный коннектор с " |
| 80 | +"поддержкой стримов. Используя стримы с пользовательским коннектором, " |
| 81 | +"необходимо передавать ``stream_id`` через протокол iproto." |
| 82 | + |
| 83 | +msgid "Interaction between streams and transactions" |
| 84 | +msgstr "Взаимодействие между стримами и транзакциями" |
| 85 | + |
| 86 | +msgid "" |
| 87 | +"As each stream can start a transaction, several transactions can be " |
| 88 | +"multiplexed over one connection. There are multiple ways to begin, commit, " |
| 89 | +"and roll back a transaction. One can do that using the appropriate stream " |
| 90 | +"methods---``call``, ``eval``, or ``execute``---with the SQL transaction " |
| 91 | +"syntax. Users can mix these methods. For example, one might start a " |
| 92 | +"transaction using ``stream:begin()`` and commit it with " |
| 93 | +"``stream:call('box.commit')`` or ``stream:execute('COMMIT')``. All the " |
| 94 | +"requests between ``stream:begin()`` and ``stream:commit()`` are executed " |
| 95 | +"within the same transaction. If any request fails during the transaction, it" |
| 96 | +" will not affect the other requests in the transaction. If a disconnect " |
| 97 | +"occurs while there is an active transaction in the stream, that transaction " |
| 98 | +"will be rolled back if it hasn't been committed before the connection " |
| 99 | +"failure." |
| 100 | +msgstr "" |
| 101 | +"Поскольку каждый стрим может запустить транзакцию, одно соединение способно " |
| 102 | +"мультиплексировать несколько транзакций. Начать транзакцию, сделать ее " |
| 103 | +"коммит и отменить ее можно, используя с синтаксисом SQL-транзакций методы " |
| 104 | +"стрима: ``call``, ``eval``, ``execute``. Пользователь может комбинировать " |
| 105 | +"эти методы. Например, можно начать транзакцию с помощью ``stream:begin()``, " |
| 106 | +"а коммит провести, используя ``stream:call('box.commit')`` или " |
| 107 | +"``stream:execute('COMMIT')``. Все запросы между ``stream:begin()`` и " |
| 108 | +"``stream:commit()`` выполняются в рамках одной транзакции. Если один запрос " |
| 109 | +"во время транзакции завершится ошибкой, на остальные запросы это не " |
| 110 | +"повлияет. Если во время активной транзакции в стриме произойдет сбой " |
| 111 | +"подключения, эта транзакция будет отменена, если она не прошла коммит до " |
| 112 | +"сбоя." |
| 113 | + |
| 114 | +msgid "Example:" |
| 115 | +msgstr "Пример:" |
| 116 | + |
| 117 | +msgid "" |
| 118 | +"local conn = net_box.connect(remote_server_addr)\n" |
| 119 | +"local conn_space = conn.space.test\n" |
| 120 | +"local stream = conn:new_stream()\n" |
| 121 | +"local stream_space = stream.space.test\n" |
| 122 | +"\n" |
| 123 | +"-- Begin transaction over an iproto stream:\n" |
| 124 | +"stream:begin()\n" |
| 125 | +"space:replace({1})\n" |
| 126 | +"\n" |
| 127 | +"-- Empty select, the transaction was not committed.\n" |
| 128 | +"-- You can't see it from the requests that do not belong to the\n" |
| 129 | +"-- transaction.\n" |
| 130 | +"\n" |
| 131 | +"-- Select returns the previously inserted tuple,\n" |
| 132 | +"-- because this select belongs to the transaction:\n" |
| 133 | +"conn_space:select{}\n" |
| 134 | +"stream_space:select({})\n" |
| 135 | +"\n" |
| 136 | +"-- Commit transaction:\n" |
| 137 | +"stream:commit()\n" |
| 138 | +"\n" |
| 139 | +"-- Now this select also returns the tuple, because the transaction has been committed:\n" |
| 140 | +"conn_space:select{}" |
| 141 | +msgstr "" |
| 142 | +"local conn = net_box.connect(remote_server_addr)\n" |
| 143 | +"local conn_space = conn.space.test\n" |
| 144 | +"local stream = conn:new_stream()\n" |
| 145 | +"local stream_space = stream.space.test\n" |
| 146 | +"\n" |
| 147 | +"-- Начать транзакцию через поток iproto:\n" |
| 148 | +"stream:begin()\n" |
| 149 | +"space:replace({1})\n" |
| 150 | +"\n" |
| 151 | +"-- Пустой select, коммит транзакции не выполнен.\n" |
| 152 | +"-- Ее нельзя увидеть из запросов, не относящихся\n" |
| 153 | +"-- к транзакции.\n" |
| 154 | +"\n" |
| 155 | +"-- Метод select возвращает ранее вставленный кортеж,\n" |
| 156 | +"-- так как этот кортеж относится к транзакции:\n" |
| 157 | +"conn_space:select{}\n" |
| 158 | +"stream_space:select({})\n" |
| 159 | +"\n" |
| 160 | +"-- Коммит транзакции:\n" |
| 161 | +"stream:commit()\n" |
| 162 | +"\n" |
| 163 | +"-- Теперь и этот select возвращает кортеж, так как транзакция прошла коммит:\n" |
| 164 | +"conn_space:select{}" |
0 commit comments