-
Notifications
You must be signed in to change notification settings - Fork 869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
object_store: Implement ObjectStore
for Arc
#4502
Conversation
object_store/src/lib.rs
Outdated
@@ -527,7 +527,10 @@ pub trait ObjectStore: std::fmt::Display + Send + Sync + Debug + 'static { | |||
} | |||
|
|||
#[async_trait] | |||
impl ObjectStore for Box<dyn ObjectStore> { | |||
impl<T> ObjectStore for T |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think of using a macro instead of a generic. As Rust lacks specialization support blanket implementations such as this have an annoying habit of causing annoying conflicts down the line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that would avoid the potential conflicts with the tradeoff of not working for custom object store wrapper implementations. Let me know which way you prefer :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I would prefer the macro approach, less chance of unintended consequences
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done 👍
This can be removed once apache/arrow-rs#4502 is released.
This can be removed once apache/arrow-rs#4502 is released.
This can be removed once apache/arrow-rs#4502 is released.
Which issue does this PR close?
Addresses #4497 (comment)
Rationale for this change
In some situations it can be useful to have multiple instances of e.g. the
InMemory
store, sharing the same backing data. This can be achieved by putting the store in anArc
, but until now theObjectStore
trait was only implemented for theBox
struct.What changes are included in this PR?
This PR changes the
ObjectStore for Box
implementation to be generic over anything that implementsAsRef<dyn ObjectStore>
which coversBox
andArc
, and potentially any user-implemented wrappers.Are there any user-facing changes?
This could potentially be a breaking change for users that have an
ObjectStore
implementation on a custom struct which also implementsAsRef
since the compiler might now see two conflicting implementations./cc @tustvold