feat(tvix/store): add ObjectStoreDirectoryService
Change-Id: I1636012be2e8ee3ae64f7bc62fd28bfe0cb2bca5 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11668 Autosubmit: yuka <yuka@yuka.dev> Reviewed-by: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
This commit is contained in:
parent
b080870fd9
commit
6aa1d2c4a8
8 changed files with 332 additions and 11 deletions
|
|
@ -2,7 +2,10 @@ use url::Url;
|
|||
|
||||
use crate::{proto::directory_service_client::DirectoryServiceClient, Error};
|
||||
|
||||
use super::{DirectoryService, GRPCDirectoryService, MemoryDirectoryService, SledDirectoryService};
|
||||
use super::{
|
||||
DirectoryService, GRPCDirectoryService, MemoryDirectoryService, ObjectStoreDirectoryService,
|
||||
SledDirectoryService,
|
||||
};
|
||||
|
||||
/// Constructs a new instance of a [DirectoryService] from an URI.
|
||||
///
|
||||
|
|
@ -63,6 +66,18 @@ pub async fn from_addr(uri: &str) -> Result<Box<dyn DirectoryService>, crate::Er
|
|||
let client = DirectoryServiceClient::new(crate::tonic::channel_from_url(&url).await?);
|
||||
Box::new(GRPCDirectoryService::from_client(client))
|
||||
}
|
||||
scheme if scheme.starts_with("objectstore+") => {
|
||||
// We need to convert the URL to string, strip the prefix there, and then
|
||||
// parse it back as url, as Url::set_scheme() rejects some of the transitions we want to do.
|
||||
let trimmed_url = {
|
||||
let s = url.to_string();
|
||||
Url::parse(s.strip_prefix("objectstore+").unwrap()).unwrap()
|
||||
};
|
||||
Box::new(
|
||||
ObjectStoreDirectoryService::parse_url(&trimmed_url)
|
||||
.map_err(|e| Error::StorageError(e.to_string()))?,
|
||||
)
|
||||
}
|
||||
#[cfg(feature = "cloud")]
|
||||
"bigtable" => {
|
||||
use super::bigtable::BigtableParameters;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue