mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 00:14:35 +03:00
revisionstore: drop dep on EdenApiBlocking
Summary: `EdenApiBlocking` was there to provide some convenience for non-async code to use edenapi. Now a lot of places actually use async Rust properly, and calling async Rust from non-async Rust is not a great practice. So let's plan for `EdenApiBlocking` removal. To unblock it, drop `EdenApiBlocking` usage in revisionstore. Reviewed By: yancouto Differential Revision: D31407282 fbshipit-source-id: 70a6e9468606176cf5cf119418547e694e229ec4
This commit is contained in:
parent
761083b02a
commit
7b4881a7a4
@ -23,7 +23,7 @@ pub struct BlockingResponse<T> {
|
||||
}
|
||||
|
||||
impl<T> BlockingResponse<T> {
|
||||
pub(crate) fn from_async<F>(fetch: F) -> Result<Self, EdenApiError>
|
||||
pub fn from_async<F>(fetch: F) -> Result<Self, EdenApiError>
|
||||
where
|
||||
F: Future<Output = Result<Response<T>, EdenApiError>>,
|
||||
{
|
||||
|
@ -10,7 +10,7 @@ use std::sync::Arc;
|
||||
|
||||
use async_trait::async_trait;
|
||||
|
||||
use edenapi::{BlockingResponse, EdenApi, EdenApiBlocking, EdenApiError, Response};
|
||||
use edenapi::{BlockingResponse, EdenApi, EdenApiError, Response};
|
||||
use edenapi_types::{EdenApiServerError, FileEntry, FileSpec, TreeAttributes, TreeEntry};
|
||||
use progress::{NullProgressFactory, ProgressFactory};
|
||||
use types::Key;
|
||||
@ -126,14 +126,14 @@ impl EdenApiFileStore {
|
||||
&self,
|
||||
keys: Vec<Key>,
|
||||
) -> Result<BlockingResponse<FileEntry>, EdenApiError> {
|
||||
self.client.files_blocking(self.repo.clone(), keys)
|
||||
BlockingResponse::from_async(self.client.files(self.repo.clone(), keys))
|
||||
}
|
||||
|
||||
pub fn files_attrs_blocking(
|
||||
&self,
|
||||
reqs: Vec<FileSpec>,
|
||||
) -> Result<BlockingResponse<FileEntry>, EdenApiError> {
|
||||
self.client.files_attrs_blocking(self.repo.clone(), reqs)
|
||||
BlockingResponse::from_async(self.client.files_attrs(self.repo.clone(), reqs))
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,8 +143,7 @@ impl EdenApiTreeStore {
|
||||
keys: Vec<Key>,
|
||||
attributes: Option<TreeAttributes>,
|
||||
) -> Result<BlockingResponse<Result<TreeEntry, EdenApiServerError>>, EdenApiError> {
|
||||
self.client
|
||||
.trees_blocking(self.repo.clone(), keys, attributes)
|
||||
BlockingResponse::from_async(self.client.trees(self.repo.clone(), keys, attributes))
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user