mirror of https://github.com/tikv/website.git
				
				
				
			Apply suggestions from code review
Signed-off-by: pingyu <yuping@pingcap.com> Co-authored-by: Xiaoguang Sun <sunxiaoguang@users.noreply.github.com> Signed-off-by: pingyu <yuping@pingcap.com>
This commit is contained in:
		
							parent
							
								
									f476a97e61
								
							
						
					
					
						commit
						345a18ffa1
					
				| 
						 | 
				
			
			@ -16,7 +16,7 @@ The `txnkv` package provides a transactional API against TiKV cluster.
 | 
			
		|||
 | 
			
		||||
### Create Client
 | 
			
		||||
 | 
			
		||||
Information about a TiKV cluster can be found by the address of PD server. After starting a TiKV cluster successfully, we can use PD's address list to create a client to interact with it.
 | 
			
		||||
The topology of a TiKV cluster can be discovered by PD server. After starting a TiKV cluster successfully, we can use PD's address list to create a client to interact with it.
 | 
			
		||||
 | 
			
		||||
```go
 | 
			
		||||
import "github.com/tikv/client-go/v2/txnkv"
 | 
			
		||||
| 
						 | 
				
			
			@ -140,7 +140,7 @@ v, err := snapshot.Get(context.TODO(), []byte("foo"))
 | 
			
		|||
// ... handle Get result ...
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Snapshot can also be extracted from a existed transaction.
 | 
			
		||||
Snapshot can also be extracted from a existing transaction.
 | 
			
		||||
 | 
			
		||||
```go
 | 
			
		||||
snapshot := txn.GetSnapshot()
 | 
			
		||||
| 
						 | 
				
			
			@ -220,7 +220,7 @@ if err != nil {
 | 
			
		|||
 | 
			
		||||
### Batch Operations
 | 
			
		||||
 | 
			
		||||
`RawKV` also supports batch operations using batch. Note that since `RawKV` is not transaction guaranteed, we do not guarantee that all writes will succeed or fail at the same time when these keys are distributed across multiple regions.
 | 
			
		||||
`RawKV` also supports batch operations using batch. Note that since `RawKV` does not provide transaction semantic, we do not guarantee that all writes will succeed or fail at the same time when these keys are distributed across multiple regions.
 | 
			
		||||
 | 
			
		||||
```go
 | 
			
		||||
values, err := client.BatchGet(context.TODO(), [][]byte{[]byte("key1"), []byte("key2")})
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,8 +12,8 @@ TiKV offers two APIs that you can interact with:
 | 
			
		|||
 | 
			
		||||
| API           | Description                                                                      | Atomicity     | Usage scenarios                                                                      |
 | 
			
		||||
|:------------- |:-------------------------------------------------------------------------------- |:------------- |:------------------------------------------------------------------------------------ |
 | 
			
		||||
| Raw           | A lower-level key-value API to interact directly with individual key-value pairs | Single key    | Your application requires low latency and does not involve distributed transactions. |
 | 
			
		||||
| Transactional | A higher-level key-value API to provide ACID semantics.                          | Multiple keys | Your application requires distributed transactions.                                  |
 | 
			
		||||
| Raw           | A low-level key-value API to interact directly with individual key-value pairs | Single key    | Your application requires low latency and does not involve distributed transactions. |
 | 
			
		||||
| Transactional | A high-level key-value API to provide ACID semantics.                          | Multiple keys | Your application requires distributed transactions.                                  |
 | 
			
		||||
 | 
			
		||||
{{< warning >}}
 | 
			
		||||
It is **not supported** to use both the raw and transactional APIs on the same keyspace.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue