This is an automated email from the ASF dual-hosted git repository.
tustvold pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/master by this push:
new e5378be5c object_store/InMemory: Add `fork()` fn and deprecate
`clone()` fn (#4499)
e5378be5c is described below
commit e5378be5cfd0648814f71e6bfd639ff2531b435e
Author: Tobias Bieniek <[email protected]>
AuthorDate: Mon Jul 10 15:39:58 2023 +0200
object_store/InMemory: Add `fork()` fn and deprecate `clone()` fn (#4499)
---
object_store/src/memory.rs | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/object_store/src/memory.rs b/object_store/src/memory.rs
index 82d485997..98b3a15ee 100644
--- a/object_store/src/memory.rs
+++ b/object_store/src/memory.rs
@@ -287,14 +287,18 @@ impl InMemory {
Self::default()
}
- /// Creates a clone of the store
- pub async fn clone(&self) -> Self {
+ /// Creates a fork of the store, with the current content copied into the
+ /// new store.
+ pub fn fork(&self) -> Self {
let storage = self.storage.read();
- let storage = storage.clone();
+ let storage = Arc::new(RwLock::new(storage.clone()));
+ Self { storage }
+ }
- Self {
- storage: Arc::new(RwLock::new(storage)),
- }
+ /// Creates a clone of the store
+ #[deprecated(note = "Use fork() instead")]
+ pub async fn clone(&self) -> Self {
+ self.fork()
}
async fn entry(&self, location: &Path) -> Result<(Bytes, DateTime<Utc>)> {