Site commands implementation. - #571
Conversation
|
Hi @hannesdejager - happy to discuss any concerns the team may have to progress this PR 🙂 |
|
Thanks, Martin! This is a really useful addition, and the implementation is nicely extensible. Also your project looks cool, integrating with Kafka. I may make a couple of small adjustments post merge to align the new API with the existing builder conventions. In particular, I’d like configuration problems—such as duplicate or invalid SITE command names and incompatible builder ordering—to be reported through ServerBuilder::build() rather than by panicking. I may also tighten command-name validation and clarify that custom SITE handlers run after authentication. These are API-hardening refinements; the overall design and implementation of your contribution will remain unchanged. Thanks again for contributing this! Lastly, do you really need |
|
Actually I was wondering if registration of sub-commands should perhaps just override. |
Good catch. I don't need it.
Yes. I think there are more circumstances where re-registering This throws light on the existing special case of |
|
@martin-cowie we probably need a crate of core site command implementations that libunftp can optionally use that uses your new machinery so that we dogfood amongst other things. I want to give it some thought. perhaps you also want to share some of yours in a public crate? we have conventions going like “unftp-sbe-” names for storage backends, maybe we can have “unftp-sbe-site-” for such crates. |
Thinking this over, re-usable
A non-exhaustive survey of two popular FTP clients and one popular FTP server reveals this set of
*: Other OS filesystems may have useful metadata features that can be usefully surfaced. When the storage backend is not a filesystem, such |
Enclosed is the implementation of site commands for libunftp.
The
ServerBuilderstructure gets a newsite_commandmethod to pass a subcommand and a SiteCommandHandler implementor. As a side-effect enumReplyandReplyCodehave become part of the SiteCommandHandler API, and are now fully documented.The existing
site md5subcommand remains untouched.All changes are tested with 100% coverage.
I developed this for an ongoing project: https://github.com/martin-cowie/ftp-kafka