File tree Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -27,8 +27,9 @@ impl InnerBuffer {
27
27
self . entry_map . insert ( key, entry) ;
28
28
}
29
29
30
- pub fn get_primary_key_or_insert ( & mut self , key : & Key ) -> & Key {
31
- self . primary_key . get_or_insert ( key. clone ( ) )
30
+ /// Set the primary key if it is not set
31
+ pub fn primary_key_or ( & mut self , key : & Key ) {
32
+ self . primary_key . get_or_insert ( key. clone ( ) ) ;
32
33
}
33
34
}
34
35
@@ -49,13 +50,9 @@ impl Buffer {
49
50
self . inner . lock ( ) . await . primary_key . clone ( )
50
51
}
51
52
52
- /// Get the primary key of the buffer, if not exists, use `key` as the primary key.
53
- pub async fn get_primary_key_or_insert ( & self , key : & Key ) -> Key {
54
- self . inner
55
- . lock ( )
56
- . await
57
- . get_primary_key_or_insert ( key)
58
- . clone ( )
53
+ /// Set the primary key if it is not set
54
+ pub async fn primary_key_or ( & self , key : & Key ) {
55
+ self . inner . lock ( ) . await . primary_key_or ( key) ;
59
56
}
60
57
61
58
/// Get a value from the buffer.
Original file line number Diff line number Diff line change @@ -674,7 +674,7 @@ impl<PdC: PdClient> Transaction<PdC> {
674
674
let pairs = plan. execute ( ) . await ;
675
675
676
676
// primary key will be set here if needed
677
- self . buffer . get_primary_key_or_insert ( & first_key) . await ;
677
+ self . buffer . primary_key_or ( & first_key) . await ;
678
678
679
679
self . start_auto_heartbeat ( ) . await ;
680
680
You can’t perform that action at this time.
0 commit comments