Skip to content

Commit

Permalink
Use to_address to get repository address
Browse files Browse the repository at this point in the history
Leverage the fact that Config contains the tag address.

Signed-off-by: J Robert Ray <jrray@jrray.org>
  • Loading branch information
jrray committed Dec 12, 2023
1 parent e4857e3 commit 0b9f2c9
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions crates/spfs/src/storage/fs/repository.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,17 +325,15 @@ impl LocalRepository for OpenFsRepository {
impl OpenFsRepository {
/// The address of this repository that can be used to re-open it
pub fn address(&self) -> url::Url {
let mut url = url::Url::from_directory_path(self.root()).unwrap();
// Assuming we want runtimes to respect the prevailing tag namespace,
// this needs to be included in the address produced here, since
// spfs-enter's --runtime-storage argument comes from here.
if let Some(tag_namespace) = self.tag_namespace.as_ref() {
url.set_query(Some(&format!(
"tag_namespace={}",
tag_namespace.to_string_lossy()
)))
};
url
Config {
path: self.root(),
params: Params {
create: false,
lazy: false,
tag_namespace: self.tag_namespace.clone(),
},
}
.to_address().expect("repository address is valid")
}

/// The filesystem root path of this repository
Expand Down

0 comments on commit 0b9f2c9

Please sign in to comment.