-
Notifications
You must be signed in to change notification settings - Fork 380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New method Client.Extensions to list server extensions #385
Conversation
7fd9393
to
e5939e8
Compare
It would seem that we could just provide a Is there really a use case for needing the whole map of extensions? |
I don't have a direct use case, but I implemented what I felt was the most general and convenient option. I suppose an SFTP debugging tool might require a loop over the extensions. I know it's O(n), but for a typical SFTP server n will be < 10 and just storing the extensions on the Client struct takes O(n) time and space already. Again, I don't have a use case for the general option, so I can implement Extension (maybe HasExtension?) instead. |
I think if someone is going to be using this, it’s likely going to be testing for a specific extension, like you have in the tests looking for This sort of thing could easily end up in a hot loop, and so, we should try to make it as efficient as possible for the purpose we’re actually looking to use. Thus a
The setup might very well be If someone were going to use this |
e5939e8
to
6269895
Compare
Ok, replaced by an (inlineable) HasExtension function. It has two return values, because the draft spec allows the extension data to have zero length. I put the bool first because I considered it the primary return value (matching the Has* name). Do you agree with that, or should the order match that of a map lookup? |
6269895
to
265b816
Compare
Great, thanks. 😄 |
New method Client.Extensions to list server extensions
This allows clients to check for extensions such as posix-rename without having to try an operation that depends on them.