pub trait PathResolver: Send + Sync {
// Required methods
fn resolve(
&self,
path: &Path
) -> Result<HashSet<ResolvedPath>, PathResolutionError>;
fn get_mount_path(
&self,
identifier: Uuid
) -> Result<Option<PathBuf>, PathResolutionError>;
}
Required Methods§
sourcefn resolve(
&self,
path: &Path
) -> Result<HashSet<ResolvedPath>, PathResolutionError>
fn resolve( &self, path: &Path ) -> Result<HashSet<ResolvedPath>, PathResolutionError>
Returns Storages of containers claiming paths that match the provided argument along with the part of a path that is inside the container.
Example: if a container claims path /a/b/
and PathResolver
receives request to resolve
path /a/b/c/d
then PathResolver
should return path /c/d
with Storage of that
container.
Storages from different containers are represented by different elements in a resulting sequence because the matching paths inside containers may be different. Additionally, method returns full paths of containers that starts with the provided one as an argument.
E.g. if container C1 claims path /a/
and container C2 claims path /a/b/
and container C3 claims
path /a/b/c/d
when PathResolver is asked about path /a/b/c
, then three-element vector is returned:
[ PathWithStorages { path: "/b/c/", storage: storage of C1}, PathWithStorages { path: "/c/", storage: storage of C2}, VirtualPath ( "/a/b/c/d" ), ]
sourcefn get_mount_path(
&self,
identifier: Uuid
) -> Result<Option<PathBuf>, PathResolutionError>
fn get_mount_path( &self, identifier: Uuid ) -> Result<Option<PathBuf>, PathResolutionError>
Returns optional path of a container with given uuid.