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 {
106106 /// the atomicity of CAS, write operations like [`put`](Client::put) or
107107 /// [`delete`](Client::delete) in atomic mode are more expensive. Some
108108 /// operations are not supported in the mode.
109- pub fn with_atomic ( & self ) -> Client {
109+ pub fn with_atomic_for_cas ( & self ) -> Client {
110110 Client {
111111 rpc : self . rpc . clone ( ) ,
112112 cf : self . cf . clone ( ) ,
@@ -533,12 +533,12 @@ impl Client {
533533 fn assert_non_atomic ( & self ) -> Result < ( ) > {
534534 ( !self . atomic )
535535 . then ( || ( ) )
536- . ok_or ( Error :: UnsupportedInAtomicMode )
536+ . ok_or ( Error :: UnsupportedMode )
537537 }
538538
539539 fn assert_atomic ( & self ) -> Result < ( ) > {
540540 self . atomic
541541 . then ( || ( ) )
542- . ok_or ( Error :: UnsupportedInNonAtomicMode )
542+ . ok_or ( Error :: UnsupportedMode )
543543 }
544544}
Original file line number Diff line number Diff line change @@ -760,7 +760,7 @@ async fn pessimistic_heartbeat() -> Result<()> {
760760#[ serial]
761761async fn raw_cas ( ) -> Result < ( ) > {
762762 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 ( ) ;
764764 let key = "key" . to_owned ( ) ;
765765 let value = "value" . to_owned ( ) ;
766766 let new_value = "new value" . to_owned ( ) ;
@@ -801,7 +801,7 @@ async fn raw_cas() -> Result<()> {
801801 // check unsupported operations
802802 assert ! ( matches!(
803803 client. batch_delete( vec![ key. clone( ) ] ) . await . err( ) . unwrap( ) ,
804- Error :: UnsupportedInAtomicMode
804+ Error :: UnsupportedMode
805805 ) ) ;
806806 let client = RawClient :: new ( pd_addrs ( ) ) . await ?;
807807 assert ! ( matches!(
@@ -810,7 +810,7 @@ async fn raw_cas() -> Result<()> {
810810 . await
811811 . err( )
812812 . unwrap( ) ,
813- Error :: UnsupportedInNonAtomicMode
813+ Error :: UnsupportedMode
814814 ) ) ;
815815
816816 Ok ( ( ) )
Original file line number Diff line number Diff line change @@ -28,12 +28,11 @@ pub enum Error {
2828 /// An operation requires a primary key, but the transaction was empty.
2929 #[ error( "transaction has no primary key" ) ]
3030 NoPrimaryKey ,
31+ /// For raw client, operation is not supported in atomic/non-atomic mode.
3132 #[ 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 "
3334 ) ]
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 ,
3736 /// Wraps a `std::io::Error`.
3837 #[ error( "IO error: {0}" ) ]
3938 Io ( #[ from] std:: io:: Error ) ,
You can’t perform that action at this time.
0 commit comments