-
Notifications
You must be signed in to change notification settings - Fork 67
[nrf toup] simplify Key/Value Get function #577
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
[nrf toup] simplify Key/Value Get function #577
Conversation
0b32254 to
831b1e2
Compare
| ReadEntry entry{ value, value_size, 0, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND }; | ||
| settings_load_subtree_direct(fullKey, LoadEntryCallback, &entry); | ||
| // Found requested key. | ||
| const ssize_t bytesRead = settings_load_one(fullKey, value, value_size); |
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.
If value_size < kEmptyValueSize, this function will fail even though it should be possible to get empty value even with value_size == 0.
048b54b to
7293889
Compare
|
should be merged after this one nrfconnect/sdk-zephyr#2615 |
eab34c5 to
0f562e4
Compare
| char fullKey[SETTINGS_MAX_NAME_LEN + 1]; | ||
| ReturnErrorOnFailure(MakeFullKey(fullKey, key)); | ||
|
|
||
| printk("Riadh Put %s size %u\n", fullKey, value_size); |
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.
Debugging log leftover
| if (len > 0) | ||
| { | ||
| *val_len = len; | ||
| return true;; |
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.
| return true;; | |
| return true; |
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.
Fixed
| { | ||
| ssize_t bytesRead = settings_load_one(fullkey, dest_buf, dest_size); | ||
|
|
||
| printk("Riadh loading key %s bytesRead %u\n", fullkey, bytesRead); |
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.
Debugging log leftover
| *read_bytes_size = entry.readSize; | ||
| *read_bytes_size = readSize; | ||
| } | ||
| printk("Riadh result : %" CHIP_ERROR_FORMAT "\n", result.Format()); |
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.
Debug log leftover
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.
Sorry for that, all debug logs leftover fixed
3db67c8 to
195ea4c
Compare
195ea4c to
9757f61
Compare
|
@rghaddab you were missing the sdk-nrf PR link in a PR description to run the unit tests on your sdk-zephyr changes. Damian has added it for you, but you have to force push/re-run failing test to make it green. |
9757f61 to
e965680
Compare
|
@rghaddab I've analyzed the logs from unit tests. Actually it shows the failure related to your change. But unfortunately the log was truncated, so I had to download the package and analyze it locally. Here are the failures: First And second |
e965680 to
a8f01b1
Compare
a8f01b1 to
02ae23e
Compare
Use settings_load_one function to load one key/value settings entry instead of settings_load_subtree_direct. This will avoid loading all the keys for some storage backends. Simplify as well the Delete function by using settings_get_val_len() function. Signed-off-by: Riadh Ghaddab <[email protected]>
To maintain backward compatibility, keep the support for the legacy ZMS backend for Settings. Signed-off-by: Riadh Ghaddab <[email protected]>
02ae23e to
5aae50c
Compare
use settings_load_one function to load one key/value settings entry instead of settings_load_subtree_direct.
This will avoid loading all the keys for some storage backends. Simplify as well the Delete function by skipping loading the value before deleting it.
NCS PR: nrfconnect/sdk-nrf/pull/20691