Module Tjr_path_resolution
Path resolution; don't open - comp_ is alised to string
module String_util : sig ... end
module Intf : sig ... end
Main types; don't open - comp_ is aliased to string
include Intf.Public
type ('fid, 'did, 'sid) resolved_comp
=
|
RC_file of 'fid
|
RC_dir of 'did
|
RC_sym of 'sid * string
|
RC_missing
fid - file id; did - dir id; sid - symlink id
type ('fid, 'did, 'sid, 't) fs_ops
=
{
root : 'did;
resolve_comp : 'did -> comp_ -> (('fid, 'did, 'sid) resolved_comp, 't) Tjr_monad.m;
}
Operations we require from the underlying filesystem; essentially we need to be able to look up a component in a directory
type follow_last_symlink
=[
|
`Always
|
`If_trailing_slash
|
`Never
]
During path resolution, we need control over whether the last component should be followed if it is a symlink
type ('fid, 'did, 'sid) simplified_result'
=
|
File of 'fid
|
Dir of 'did
|
Sym of 'sid * string
|
Missing
The result of path resolution (simplified to reduce complexity). A "successful" resolution gives one of the following
type ('fid, 'did, 'sid) simplified_result
=
{
parent_id : 'did;
comp : comp_;
result : ('fid, 'did, 'sid) simplified_result';
trailing_slash : bool;
}
We also need additional information about the resolved result, such as the containing directory, the last path component, and whether there was a trailing slash on the path
type ('fid, 'did) resolved_err
=[
|
`File_followed_by_slash_etc of 'did Intf.state * comp_ * 'fid
|
`Missing_slash_etc of comp_ * 'did * string
]
type ('fid, 'did, 'sid) resolved_path_or_err
= (('fid, 'did, 'sid) simplified_result, ('fid, 'did) resolved_err) Stdlib.result
module Path_resolution : sig ... end
Path resolution algorithm
type ('fid, 'did, 'sid, 't) resolve_t
= follow_last_symlink:follow_last_symlink -> cwd:'did -> comp_ -> (('fid, 'did, 'sid) resolved_path_or_err, 't) Tjr_monad.m
Core type of the resolve function
follow_last_symlink:follow_last_symlink -> cwd:'did -> comp_ -> ( ('fid,'did,'sid)resolved_path_or_err, 't) m
val resolve : monad_ops:'t Tjr_monad.monad_ops -> fs_ops:('fid, 'did, 'sid, 't) fs_ops -> ('fid, 'did, 'sid, 't) resolve_t
The resolve function provided by this library, parameterized by the monad and the underlying filesystem operations
monad_ops:'t monad_ops -> fs_ops:('fid, 'did, 'sid, 't) fs_ops -> ('fid,'did,'sid,'t)resolve_t