-
Notifications
You must be signed in to change notification settings - Fork 3k
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
KVStore & derived classes: design docs, implementation & configuration #8667
KVStore & derived classes: design docs, implementation & configuration #8667
Conversation
1cc4d60
to
9d8debf
Compare
This PR will be updated with small changes while reviewed. We already reviewed internally and therefore I will approve it |
Can you run astyle on new added files here? #8591 is addressing storage files in the current codebase, so only new files in this PR should have style fix and we should be good for storage files |
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.
Initial screen review to provide early feedback
* | ||
* @param partition partition configuration struct. | ||
*/ | ||
void deinit_partition(kv_map_entry_t * partition); |
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 !defined(DOXYGEN_ONLY)
for private/protected members/methods in new files? so doxygen is not generated for our public docs (see #8670)
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.
Done.
@@ -0,0 +1,388 @@ | |||
# Storage configuration |
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.
design docs - were they reviewed by docs team or we request it now here? Let us know, we will add docs reviewers
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.
We had an internal review, but not by the docs team. Please add them.
return &fss; | ||
} | ||
|
||
FileSystem *_get_filesystem_default(BlockDevice *bd, const char *mount) |
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.
_get_filesystem_default
vs _get_fileSystemStore
- we follow the former (no camelcase for function names). Similar in other functions in this file, like _calculate_blocksize_match_TDBStore
-> _calculate_blocksize_match_tbdstore
. or I even noticed _storage_config_TDB_EXTERNAL
, please consolidate
(this might be normal in the storage files?)
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.
The following cannot be changed cause the calling function will build the correct function name using configuration macro:
_get_filesystem_FAT
_get_filesystem_LITTLE
_get_blockdevice_FLASHIAP
_get_blockdevice_SPIF
_get_blockdevice_QSPIF
_get_blockdevice_DATAFLASH
_get_blockdevice_SD
_storage_config_TDB_INTERNAL
_storage_config_TDB_EXTERNAL
_storage_config_TDB_EXTERNAL_NO_RBP
_storage_config_FILESYSTEM
_storage_config_FILESYSTEM_NO_RBP
the rest I have changed to lower case.
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.
That one I have missed but noticed some string macros. How does this work (this function_MACRO) here?
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.
Yes, by design the mbed_lib.json value of default is in lower case.
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.
Done.
9d8debf
to
ff6688a
Compare
Done. |
ff6688a
to
4d646c2
Compare
@AnotherButler There is new API (doxygen) and new design documents here, please review |
0abfad5
to
d414914
Compare
d414914
to
e9948d7
Compare
Added dependency on #8703 (as without it, TDBStore performance is bad). |
4fc3aee
to
769c0e3
Compare
* @brief As a singleton, return the single instance of the class. | ||
* This class is a singleton for the following reasons: | ||
* - Ease of use, so you don't have to coordinate instantiations. | ||
* - Lazy instantiation of internal data, (which we can't achieve with simple static classes). |
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.
Query: Is "lazy instantiation" a common term I haven't heard of, or should we rephrase this?
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.
It's a common term.
|
||
### Sequential writes | ||
|
||
All writes occur sequentially on the physical storage as records, superseding the previous ones for the same key. Each data record is written right after the last written one. If a key is updated, a new record with this key is written, overriding the previous value of this key. If a key is deleted, a new record with a "deleted" flag is added. |
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.
A lot of this document is in passive voice, and I'm not sure what's doing the action. What's writing data records? What's updating keys? What's deleting keys? Is it you, the user? Please clarify.
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.
Thanks. Rephrased these lines.
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.
Your changes look good. I came across a couple design docs I missed in my first round of edits, so I'm finishing those up, and then I'll be finished.
f13ed2b
to
645f219
Compare
^^ @OPpuolitaival Please review the latest test results and help us restarted (make it reported here) |
Restarted the CI |
f0f8462
to
f26c277
Compare
Test run: SUCCESSSummary: 4 of 4 test jobs passed |
@ARMmbed/mbed-os-test @davidsaada CI reports 3 failues (check test failed status), tehre are timeouts, like targets did not even start (and only for kvstore tests) Exporters timeouted, we will restart now |
Looks like exporter again time outed for IAR. @mbed-os-test Please review |
I run locally |
0xc0170 those failures are sporadic, but all appear in our kvstore general test, so we think there's something to it and investigate it now. |
I restarted tests to confirm there is an issue with EV_COG devices |
Confirmed the failures, latest CI test run (13h ago)
|
The problem we have with this test is related to targets that do not support storage because they do not have any component enabled for block devices. We will continue the investigation tomorrow. |
f26c277
to
89cde0d
Compare
Pushed an update that may work. It's a long shot which I can't tell whether will work for sure, as I wasn't able to reproduce the problem on ARCH_PRO and have no EV_COG_AD3029LZ to check the fix with on any raas node. |
Implement the following: KVStore base class TDBStore class FileSystemStore class SecureStore class Global APIs Configuration framework Design documentation
89cde0d
to
e073fb6
Compare
CI triggered |
Looks like it passed testing (the latest update fixed the issue). |
Test run: SUCCESSSummary: 4 of 4 test jobs passed |
@@ -3504,7 +3504,7 @@ | |||
} | |||
}, | |||
"DISCO_L475VG_IOT01A": { | |||
"components_add": ["QSPIF"], | |||
"components_add": ["QSPIF", "FLASHIAP"], |
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.
Hi
Did you check this new component with this DISCO_L475 target ?
I got all components-storage-blockdevice-component_flashiap-tests FAIL with 5.11.0 release... :-(
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.
Please create also a new issue for this
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 about that. We have tested the block device with the general_test under feature/storage/TESTS/blockdevice and it uses get default instance and calculate the correct address and size. The component test fails because the base address and size are not set in the COMPONENT_FLASHIAP mbed_lib target overwrites. I run this with start address set to 0x801A800 and the size to 0xE5800 and it works. @jeromecoutant do you like me to add those to the mbed_lib.json permanently or you have some other numbers you prefer?
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.
Second thought that we will change the current implementation of the test and if no parameters will be provided in mbed_lib.app the test will calculate the start address and the size by itself as the get default instance does. Take a look at PR #9268
Description
This PR implements KVStore, the new Key Value based storage framework. It includes the following:
Derived classes:
Global APIs - A set of APIs to access all KVStore classes in a C style manner.
Configuration framework - Means to generate configurations for the above, covering most of the typical applications.
Device Key adaptations.
Design documents for all of the above.
Implemented by @yossi2le, @offirko, @theamirocohen & myself, supervised by @dannybenor.
Pull request type