1#[cfg(any(test, feature = "memory-backend"))]
5use super::InMemoryStore;
6use super::{AnyStore, FsStore, ObjectStore, Result};
7use crate::object::{Blob, ContentHash, State, StateId, Tree};
8
9#[cfg(feature = "async-source")]
10pub use crate::object::AsyncObjectSource;
11pub use crate::object::ObjectSource;
12
13macro_rules! impl_object_source {
14 ($store:ty) => {
15 impl ObjectSource for $store {
16 #[inline]
17 fn get_tree(&self, hash: &ContentHash) -> Result<Option<Tree>> {
18 ObjectStore::get_tree(self, hash)
19 }
20
21 #[inline]
22 fn get_state(&self, id: &StateId) -> Result<Option<State>> {
23 ObjectStore::get_state(self, id)
24 }
25
26 #[inline]
27 fn get_blob(&self, hash: &ContentHash) -> Result<Option<Blob>> {
28 ObjectStore::get_blob(self, hash)
29 }
30
31 #[inline]
32 fn get_blob_bytes(&self, hash: &ContentHash) -> Result<Option<bytes::Bytes>> {
33 ObjectStore::get_blob_bytes(self, hash)
34 }
35 }
36 };
37}
38
39impl_object_source!(AnyStore);
40impl_object_source!(FsStore);
41#[cfg(any(test, feature = "memory-backend"))]
42impl_object_source!(InMemoryStore);