refactor(tvix): use composition & registry for from_addr
Change-Id: I3c94ecb5958294b5973c6fcdf5ee9c0d37fa54ad Reviewed-on: https://cl.tvl.fyi/c/depot/+/11976 Reviewed-by: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Autosubmit: yuka <yuka@yuka.dev>
This commit is contained in:
parent
79317be214
commit
168e4fda59
18 changed files with 316 additions and 229 deletions
|
|
@ -91,6 +91,17 @@ impl DirectoryService for MemoryDirectoryService {
|
|||
#[serde(deny_unknown_fields)]
|
||||
pub struct MemoryDirectoryServiceConfig {}
|
||||
|
||||
impl TryFrom<url::Url> for MemoryDirectoryServiceConfig {
|
||||
type Error = Box<dyn std::error::Error + Send + Sync>;
|
||||
fn try_from(url: url::Url) -> Result<Self, Self::Error> {
|
||||
// memory doesn't support host or path in the URL.
|
||||
if url.has_host() || !url.path().is_empty() {
|
||||
return Err(Error::StorageError("invalid url".to_string()).into());
|
||||
}
|
||||
Ok(MemoryDirectoryServiceConfig {})
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl ServiceBuilder for MemoryDirectoryServiceConfig {
|
||||
type Output = dyn DirectoryService;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue