Skip to content

Commit 624a53b

Browse files
committed
refactor: rename to 'get_primary_key_or_insert'
Signed-off-by: ekexium <[email protected]>
1 parent bdf020f commit 624a53b

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/transaction/buffer.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ impl InnerBuffer {
2727
self.entry_map.insert(key, entry);
2828
}
2929

30-
pub fn get_primary_key_or(&mut self, key: &Key) -> &Key {
30+
pub fn get_primary_key_or_insert(&mut self, key: &Key) -> &Key {
3131
self.primary_key.get_or_insert(key.clone())
3232
}
3333
}
@@ -50,8 +50,12 @@ impl Buffer {
5050
}
5151

5252
/// Get the primary key of the buffer, if not exists, use `key` as the primary key.
53-
pub async fn get_primary_key_or(&self, key: &Key) -> Key {
54-
self.inner.lock().await.get_primary_key_or(key).clone()
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()
5559
}
5660

5761
/// Get a value from the buffer.

src/transaction/transaction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ impl<PdC: PdClient> Transaction<PdC> {
674674
let pairs = plan.execute().await;
675675

676676
// primary key will be set here if needed
677-
self.buffer.get_primary_key_or(&first_key).await;
677+
self.buffer.get_primary_key_or_insert(&first_key).await;
678678

679679
self.start_auto_heartbeat().await;
680680

0 commit comments

Comments
 (0)