-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add dynamic estimation of remaining credential space #92
Conversation
31aa18f
to
4faae1b
Compare
14422f1
to
2aef53a
Compare
2aef53a
to
4f8e8a4
Compare
This depends on trussed-dev/trussed-staging#27 |
>= self | ||
.config | ||
.max_resident_credential_count | ||
.unwrap_or(MAX_RESIDENT_CREDENTIALS_GUESSTIMATE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we now always apply a hard limit, it would make sense to make the max_resident_credential_count
configuration required and remove the guesstimate constant. This would also make the code easier to read.
fe94e0e
to
741348f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Suggestions that can also be implemented in separate PRs:
- require
max_resident_credential_count
config - add test case that reaches the credential limit
- add test case with low remaining space
The estimation is pretty rough and in most cases pessimistic. It reserves multiple blocks of margin to prevent filling up the device.
With the default configuration of the usbip runner, it estimates the value to be around 40, and I could generate more than 60.
For now, this PR removes the hard-coded limitation when generating credentials.
This makes credential generation faster, but at the same time this could prove to be an issue when listing credential (even the USBIP version is pretty slow to list all credentials).