-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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 storage to the example ACL implementation #14253
Add storage to the example ACL implementation #14253
Conversation
It uses a persistent storage delegate to store the data as a TLV-formatted blob. Platforms or applications that want content-aware storage can either implement a persistent storage delegate that reads the TLV-formatted blob or implement the AccessControl::Delegate interface.
* Don't specify buffer sizes for writers. * Use form of Next that includes both tag and type. * Don't wrap subjects and targets in an unnecessary structure layer.
PR #14253: Size comparison from 0902641 to fd85837 Increases above 0.2%:
Increases (3 builds for linux, mbed, p6)
Full report (31 builds for cyw30739, efr32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
|
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.
Give me a couple hours and I'll pull it again and run it to verify it's working on Linux.
OK I ran it on Linux and used REPL to make this ACL and it seemed to read back OK when running second time.
|
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.
Approve with the note that I don't like the serialize/deserialize code here, this is just to get something saving at all so when we turn ACL on, we don't lose access every time we restart. The plan is to move persistence out of this module to a higher level, in the cluster code, and use more of the generated code for encode/decode. This is just a stepping stone.
fast track: change created and approved by a domain owner, sufficient time passed for cross timezone review. |
Removing fast track, domain owner not part of the policy, and this is < 3 days. However, this seems OK to merge. |
Doh, needs one more per policy. @saurabhst @Damian-Nordic |
// Access Control List | ||
|
||
const char * AccessControlList() { return Format("acl"); } | ||
const char * AccessControlEntry(size_t index) { return Format("acl/%zx", index); } |
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.
This will not work on some platforms due to missing "%z" specifier. Suggest:
const char * AccessControlEntry(size_t index) { return Format("acl/%x", static_cast(index)); }
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.
I've created #14547 to fix this.
* Add a simple implementation of storage for ACLs. It uses a persistent storage delegate to store the data as a TLV-formatted blob. Platforms or applications that want content-aware storage can either implement a persistent storage delegate that reads the TLV-formatted blob or implement the AccessControl::Delegate interface. * Use tags correctly and fix a format string. * Applied improvements suggested by bzbarsky. * Don't specify buffer sizes for writers. * Use form of Next that includes both tag and type. * Don't wrap subjects and targets in an unnecessary structure layer. * Save the ACL entries to flash whenever an entry is created, updated, or deleted. * Add simple storage for ACL. * Style fixes. * Remove unneeded and potentially misleading comments. * Missed one of the comments. * Explain choice of buffer sizes. * Style fixes.
Replace the 'z' format specifier added in #14253 with one that's supported in all platforms.
Problem
Change overview
Testing