-
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
Restructure KVStore to one library per store type #13908
Conversation
@LDong-Arm, thank you for your changes. |
@hugueskamba @rajkan01 Please review the layout here |
da4cace
to
eb520c2
Compare
Pull request has been modified.
@0xc0170 @hugueskamba I've tested my change with
To make it work, I needed to fix the declaration of |
PR ARMmbed#13908 replaces the umbrella library for all KVStore from "kvstore_global_api" to "kvstore". Now "kvstore_global_api" still exists but is restricted to the global API part only. By adding "kvstore" as a dependency of "kvstore_global_api", existing bare metal projects (e.g. mbed-bootloader) that use the latter library name to pull in the KVStore prototype class will continue to work.
ce59f29
to
a80fb9f
Compare
Pull request has been modified.
PR ARMmbed#13908 replaces the umbrella library for all KVStore from "kvstore_global_api" to "kvstore". Now "kvstore_global_api" still exists but is restricted to the global API part only. By adding "kvstore" as a dependency of "kvstore_global_api", existing bare metal projects (e.g. mbed-bootloader) that use the latter library name to pull in the KVStore prototype class will continue to work.
a80fb9f
to
479b704
Compare
Rebased, tested everything locally and they still work. |
Oh wait didn't know #13917 isn't merged yet. The CMake part depends on that PR... |
Its in. I'll mark this as priority high so we do not forget about this one for the upcoming release. |
Again we need ARMmbed/mbed-os-example-kvstore#65 otherwise CI will fail... |
CI started |
Jenkins CI Test : ✔️ SUCCESSBuild Number: 6 | 🔒 Jenkins CI Job | 🌐 Logs & ArtifactsCLICK for Detailed Summary
|
Summary of changes
Fixes: #13657
Mutually depends on: ARMmbed/mbed-os-example-kvstore#60
In #13307 we combined multiple
KVStore
types (TDBStore
,FileSystemStore
) and the global API into one library,kv-global-api
. This is inconvenient for users of bare metal: if they only want one store type, they need to add dependencies for other unused types and the global API to"requires"
. This becomes cumbersome asFileSystem
has many dependencies.This PR restructures KVStore to follow the same logic of BlockDevice: declare the interface at the top level, and treat each type/implementation as a "sub-" library. Users only need to enable the interface + the type they need. So each of the following is a library (containing
mbed_lib.json
):KVStore
interfaceTDBStore : KVStore
classFileSystemStore : KVStore
classSecureStore : KVStore
classkvstore_global_api
functions andKVMap
which is a helper class for the global APIGreentea and unit tests have also been moved into subdirectories of corresponding KVStore types.
Note: The CMake support for KVStore has not been componentised yet - compilation with CMake still brings in all the unused types and dependencies, because everything is under one(Update: required CMake changed included in this PR)mbed-storage-kvstore
target. Hopefully the CMake team will later componentise each type of KVStore intombed-storage-kvstore-<type>
. similar to what they've already done forBlockDevice
s. @0xc0170Impact of changes
Users can enable one type of
KVStore
(e.g.TDBStore
) without having to bring in dependencies for unused types of KVStore.Migration actions required
For a bare metal application, add
"kvstore"
and the type of KVStore to use (e.g."tdbstore"
) to"requires"
inmbed_app.json
. Note that theKVStore
interface library is"kvstore"
, not"kv-global-api"
which now contains only the global API.To use CMake (full profile and bare metal profile): Add the TDBStore sub-component you need (e.g.
mbed-storage-tdbstore
) and dependencies (e.g. TDBStore requiresmbed-storage-blockdevice
) to your app'sCMakeLists.txt
.Documentation
Pull request type
Test results
Note: For the CMake support, I tested the "feature-cmake" branch of mbed-os-example-blinky-baremetal, with
TDBStore store(BlockDevice::get_default_instance());
(and headers) added tomain.cpp
and the following dependencies added to the app'sCMakeLists.txt
:mbed-storage-kvstore
,mbed-storage-blockdevice
,mbed-storage
(for the default block device).Reviewers
@ARMmbed/mbed-os-core @evedon @boraozgen