Possible new architecture for resolving WebDAV paths #67
Labels
code quality
Nonfunctional improvements to the codebase
under consideration
Dev has not yet decided whether or how to implement
WIP design document for a new code architecture
Rename
DandiDav
toDav
Give
Dav
aregister(name: &Component, handler: Box<dyn DavHandler>, description: &str) -> Result<(), DuplicateNameError>
method for registering a handler for a WebDAV hierarchy to serve under/{name}/
description
is used as the "Type" value for the hierarchy in the root HTML viewhandler
could instead be an enum using enum dispatch.Add a
DavHandler
trait with the following methods:get_resource(&self, path: Vec<Component>) -> Result<DavResource, DavError>
get_resource_with_children(&self, path: Vec<Component>) -> Result<DavResourceWithChildren, DavError>
Note that
path
may be empty (i.e., when a client requests/{name}/
), and soPurePath
cannot be used here.Note that these methods will be
async
, which may have implications for boxability of trait objects; cf. https://blog.rust-lang.org/2023/12/21/async-fn-rpit-in-traits.html.Add a
DandiDav
struct implementingDavHandler
for serving resources under/dandisets/
; move all code specific to/dandisets/
here/dandisets/
, currently implemented by the currentDandiDav
type viaDavPath
Add a
ZarrMan
struct implementingDavHandler
for serving resources under/zarrs/
Idea: The internal implementations of the
DavHandler
types could traverse their hierarchies as follows:Locations in a handler's hierarchy are represented by an enum with variants for different depths & similar (cf.
DavPath
andzarrman::ReqPath
)The handler instantiates a location enum with the root variant and then applies each component in
path
in turn by calling aninto_child(self, name: Component) -> Result<Self, DavError>
methodErr
if it can be easily determined (sans IO) that the path so far is invalid/does not existDetails for the final location are then retrieved based on the location enum's final state
Whose responsibility is it to prepend the
/{name}/
component to hrefs in responses?DavHandler
s don't prepend it, what would thepath
s of their root collections be?None
?DavResource[WithChildren]
aprepend_path(&mut self, path: &PureDirPath)
method for calling byDav
after delegating to a handler?name(&self) -> &'static str
a method ofDavHandler
, and make it theDavHandler
s' responsibility to prepend the nameThe text was updated successfully, but these errors were encountered: