File tree Expand file tree Collapse file tree 3 files changed +9
-10
lines changed Expand file tree Collapse file tree 3 files changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -106,7 +106,7 @@ impl Client {
106
106
/// the atomicity of CAS, write operations like [`put`](Client::put) or
107
107
/// [`delete`](Client::delete) in atomic mode are more expensive. Some
108
108
/// operations are not supported in the mode.
109
- pub fn with_atomic ( & self ) -> Client {
109
+ pub fn with_atomic_for_cas ( & self ) -> Client {
110
110
Client {
111
111
rpc : self . rpc . clone ( ) ,
112
112
cf : self . cf . clone ( ) ,
@@ -533,12 +533,12 @@ impl Client {
533
533
fn assert_non_atomic ( & self ) -> Result < ( ) > {
534
534
( !self . atomic )
535
535
. then ( || ( ) )
536
- . ok_or ( Error :: UnsupportedInAtomicMode )
536
+ . ok_or ( Error :: UnsupportedMode )
537
537
}
538
538
539
539
fn assert_atomic ( & self ) -> Result < ( ) > {
540
540
self . atomic
541
541
. then ( || ( ) )
542
- . ok_or ( Error :: UnsupportedInNonAtomicMode )
542
+ . ok_or ( Error :: UnsupportedMode )
543
543
}
544
544
}
Original file line number Diff line number Diff line change @@ -760,7 +760,7 @@ async fn pessimistic_heartbeat() -> Result<()> {
760
760
#[ serial]
761
761
async fn raw_cas ( ) -> Result < ( ) > {
762
762
clear_tikv ( ) . await ;
763
- let client = RawClient :: new ( pd_addrs ( ) ) . await ?. with_atomic ( ) ;
763
+ let client = RawClient :: new ( pd_addrs ( ) ) . await ?. with_atomic_for_cas ( ) ;
764
764
let key = "key" . to_owned ( ) ;
765
765
let value = "value" . to_owned ( ) ;
766
766
let new_value = "new value" . to_owned ( ) ;
@@ -801,7 +801,7 @@ async fn raw_cas() -> Result<()> {
801
801
// check unsupported operations
802
802
assert ! ( matches!(
803
803
client. batch_delete( vec![ key. clone( ) ] ) . await . err( ) . unwrap( ) ,
804
- Error :: UnsupportedInAtomicMode
804
+ Error :: UnsupportedMode
805
805
) ) ;
806
806
let client = RawClient :: new ( pd_addrs ( ) ) . await ?;
807
807
assert ! ( matches!(
@@ -810,7 +810,7 @@ async fn raw_cas() -> Result<()> {
810
810
. await
811
811
. err( )
812
812
. unwrap( ) ,
813
- Error :: UnsupportedInNonAtomicMode
813
+ Error :: UnsupportedMode
814
814
) ) ;
815
815
816
816
Ok ( ( ) )
Original file line number Diff line number Diff line change @@ -28,12 +28,11 @@ pub enum Error {
28
28
/// An operation requires a primary key, but the transaction was empty.
29
29
#[ error( "transaction has no primary key" ) ]
30
30
NoPrimaryKey ,
31
+ /// For raw client, operation is not supported in atomic/non-atomic mode.
31
32
#[ error(
32
- "The operation does is not supported in raw-atomic mode, please consider using an atomic client "
33
+ "The operation is not supported in current mode, please consider using RawClient with or without atomic mode "
33
34
) ]
34
- UnsupportedInAtomicMode ,
35
- #[ error( "The operation is only supported in raw-atomic mode, please consider using a non-atomic raw client" ) ]
36
- UnsupportedInNonAtomicMode ,
35
+ UnsupportedMode ,
37
36
/// Wraps a `std::io::Error`.
38
37
#[ error( "IO error: {0}" ) ]
39
38
Io ( #[ from] std:: io:: Error ) ,
You can’t perform that action at this time.
0 commit comments