Seal ignored-workspace routing at Domain startup
This commit is contained in:
parent
b114e3514b
commit
1ad3b84db2
1 changed files with 720 additions and 285 deletions
|
|
@ -94,7 +94,7 @@ impl IgnoredWorkspace {
|
|||
pub fn open(
|
||||
workspace: &Path,
|
||||
isolated_state: &Path,
|
||||
global_excludes: Option<PathBuf>,
|
||||
global_excludes: Option<&Path>,
|
||||
) -> io::Result<Self> {
|
||||
let workspace = workspace.canonicalize()?;
|
||||
let isolated_state = isolated_state.canonicalize()?;
|
||||
|
|
@ -103,16 +103,16 @@ impl IgnoredWorkspace {
|
|||
}
|
||||
let host = BackingRoot::open(&workspace)?;
|
||||
let isolated = BackingRoot::open(&isolated_state)?;
|
||||
Self::from_roots(workspace, host, isolated, global_excludes)
|
||||
Self::from_roots(&workspace, host, isolated, global_excludes)
|
||||
}
|
||||
|
||||
/// # Errors
|
||||
/// Refuses aliased or non-directory authorities and unreadable Git policy inputs.
|
||||
pub fn from_authorities(
|
||||
workspace_label: PathBuf,
|
||||
workspace_label: &Path,
|
||||
workspace: File,
|
||||
isolated_state: File,
|
||||
global_excludes: Option<PathBuf>,
|
||||
global_excludes: Option<&Path>,
|
||||
) -> io::Result<Self> {
|
||||
let host = BackingRoot::from_file(workspace)?;
|
||||
let isolated = BackingRoot::from_file(isolated_state)?;
|
||||
|
|
@ -122,10 +122,10 @@ impl IgnoredWorkspace {
|
|||
/// # Errors
|
||||
/// Refuses aliased or non-directory authorities and unreadable Git policy inputs.
|
||||
pub fn from_authorities_with_policy(
|
||||
workspace_label: PathBuf,
|
||||
workspace_label: &Path,
|
||||
workspace: File,
|
||||
isolated_state: File,
|
||||
global_excludes: Option<PathBuf>,
|
||||
global_excludes: Option<&Path>,
|
||||
isolate_ignored: bool,
|
||||
) -> io::Result<Self> {
|
||||
let host = BackingRoot::from_file(workspace)?;
|
||||
|
|
@ -140,19 +140,19 @@ impl IgnoredWorkspace {
|
|||
}
|
||||
|
||||
fn from_roots(
|
||||
workspace_label: PathBuf,
|
||||
workspace_label: &Path,
|
||||
host: BackingRoot,
|
||||
isolated: BackingRoot,
|
||||
global_excludes: Option<PathBuf>,
|
||||
global_excludes: Option<&Path>,
|
||||
) -> io::Result<Self> {
|
||||
Self::from_roots_with_policy(workspace_label, host, isolated, global_excludes, true)
|
||||
}
|
||||
|
||||
fn from_roots_with_policy(
|
||||
workspace_label: PathBuf,
|
||||
workspace_label: &Path,
|
||||
host: BackingRoot,
|
||||
isolated: BackingRoot,
|
||||
global_excludes: Option<PathBuf>,
|
||||
global_excludes: Option<&Path>,
|
||||
isolate_ignored: bool,
|
||||
) -> io::Result<Self> {
|
||||
if host.identity()? == isolated.identity()? {
|
||||
|
|
@ -161,7 +161,10 @@ impl IgnoredWorkspace {
|
|||
crate::migration::initialize(&host, &isolated)?;
|
||||
let classifier_root = BackingRoot::from_file(host.duplicate()?)?;
|
||||
let classifier =
|
||||
GitClassifier::from_root(workspace_label, classifier_root, global_excludes)?;
|
||||
GitClassifier::from_root(workspace_label, &classifier_root, global_excludes)?;
|
||||
if isolate_ignored {
|
||||
crate::migration::admit_policy(workspace_label, &host, &isolated, &classifier)?;
|
||||
}
|
||||
Ok(Self {
|
||||
host,
|
||||
isolated,
|
||||
|
|
@ -183,7 +186,7 @@ impl IgnoredWorkspace {
|
|||
let filesystem = Self::open(
|
||||
&configuration.workspace,
|
||||
&configuration.isolated_state,
|
||||
configuration.global_excludes,
|
||||
configuration.global_excludes.as_deref(),
|
||||
)?;
|
||||
let config = mount_config(configuration.threads);
|
||||
fuser::mount2(filesystem, configuration.mountpoint, &config)
|
||||
|
|
@ -196,10 +199,10 @@ impl IgnoredWorkspace {
|
|||
ready: impl FnOnce() -> io::Result<()>,
|
||||
) -> io::Result<()> {
|
||||
let filesystem = Self::from_authorities_with_policy(
|
||||
configuration.workspace_label,
|
||||
&configuration.workspace_label,
|
||||
configuration.workspace,
|
||||
configuration.isolated_state,
|
||||
configuration.global_excludes,
|
||||
configuration.global_excludes.as_deref(),
|
||||
configuration.isolate_ignored,
|
||||
)?;
|
||||
let session = fuser::spawn_mount2(
|
||||
|
|
|
|||
Loading…
Reference in a new issue