improving text for transactional write (#905)

Improving text for transactional write

Signed-off-by: Navin Shrinivas <karupal2002@gmail.com>
This commit is contained in:
P K Navin Shrinivas 2024-11-18 13:35:19 +05:30 committed by GitHub
parent 129b472a31
commit 54e0d96c76
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 44 additions and 0 deletions

View File

@ -21,3 +21,25 @@ del user1
failure requests (get, put, delete):
put user1 good
```
### Transaction for multiple writes
A transaction is an atomic If/Then/Else construct over the key-value store. It provides a primitive for grouping requests together in atomic blocks (i.e., then/else) whose execution is guarded (i.e., if) based on the contents of the key-value store. Transactions can be used for protecting keys from unintended concurrent updates, building compare-and-swap operations, and developing higher-level concurrency control. However, modifications to the same key multiple times within a single transaction are forbidden.
```shell
etcdctl --endpoints=$ENDPOINTS put user1 bad
etcdctl --endpoints=$ENDPOINTS txn --interactive
compares:
value("user1") = "bad"
success requests (get, put, del):
put user test
put user2 testing3
get user1
failure requests (get, put, del):
put user1 bad
```
{{< figure src="/img/transaction-multiple-writes.gif" >}}

View File

@ -21,3 +21,25 @@ del user1
failure requests (get, put, delete):
put user1 good
```
### Transaction for multiple writes
A transaction is an atomic If/Then/Else construct over the key-value store. It provides a primitive for grouping requests together in atomic blocks (i.e., then/else) whose execution is guarded (i.e., if) based on the contents of the key-value store. Transactions can be used for protecting keys from unintended concurrent updates, building compare-and-swap operations, and developing higher-level concurrency control. However, modifications to the same key multiple times within a single transaction are forbidden.
```shell
etcdctl --endpoints=$ENDPOINTS put user1 bad
etcdctl --endpoints=$ENDPOINTS txn --interactive
compares:
value("user1") = "bad"
success requests (get, put, del):
put user test
put user2 testing3
get user1
failure requests (get, put, del):
put user1 bad
```
{{< figure src="/img/transaction-multiple-writes.gif" >}}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 MiB