refactor(master): allow ACL ops in KV backends#762
Conversation
Summary of ChangesHello @lgsilva3087, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly refactors the Access Control List (ACL) management within the master service to improve its compatibility and integration with Key-Value (KV) backends. The core change involves centralizing transaction management by passing a Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request is a well-executed refactoring that allows ACL operations to work with transactional backends like KV stores. It achieves this by threading FilesystemOperationContext through the call stack, moving transaction lifecycle management to the callers (matoclserv, restore), which is a solid design improvement. The introduction of getAclForAccess provides a clean abstraction for ACL retrieval. Additionally, the documentation for the affected interfaces has been significantly improved. The changes are consistent and well-implemented. I have found one minor documentation issue to address.
There was a problem hiding this comment.
Pull request overview
This PR refactors ACL operations in the master filesystem to enable KV backend participation by threading FilesystemOperationContext through all ACL methods. Previously, ACL operations created transactions internally, preventing KV backends from coordinating ACL updates with other metadata changes in a single transaction.
Changes:
- Thread
FilesystemOperationContextthrough all ACL methods (deleteAcl,setAcl,getAcl,applySetAcl,applySetRichAcl) in bothIFilesystemNodeOperationsandIFilesystemOperationsinterfaces - Move transaction lifecycle management from internal method bodies to callers (matoclserv, restore), enabling coordinated transactions for KV backends
- Introduce protected virtual
getAclForAccess()method to abstract ACL retrieval inaccess(), allowing KV backends to override and materialize ACLs from key-value storage
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/master/restore.cc | Add transaction creation and commit logic to ACL restore functions (do_deleteacl, do_setacl, do_setrichacl); improved unused parameter comment formatting |
| src/master/recursive_remove_task.cc | Pass fsOpContext to access() method for consistency with new signature |
| src/master/matoclserv.cc | Add transaction creation and commit logic to ACL client-facing operations (deleteacl, getacl, setacl); pass fsOpContext to idToNode call |
| src/master/kv_common_keys.h | Document ACL key prefix format for future KV backend implementation |
| src/master/filesystem_operations_interface.h | Add comprehensive documentation for all ACL methods; add fsOpContext parameter to all ACL method signatures |
| src/master/filesystem_operations.h | Update ACL method signatures with fsOpContext parameter; add documentation references |
| src/master/filesystem_operations.cc | Remove internal transaction creation from ACL methods; pass fsOpContext to node operations; remove unreachable code after return statements |
| src/master/filesystem_node_operations_interface.h | Add comprehensive documentation for ACL operations; add fsOpContext and access() parameters |
| src/master/filesystem_node.h | Update method signatures with fsOpContext; add protected getAclForAccess() virtual method; minor documentation reference fix needed |
| src/master/filesystem_node.cc | Mark fsOpContext as [[maybe_unused]] in base implementation; implement getAclForAccess() using in-memory aclStorage; pass fsOpContext through access() to support KV backend overrides |
2386ff3 to
a8a8415
Compare
a8a8415 to
bc886e4
Compare
bc886e4 to
6053d00
Compare
6053d00 to
ac7fb64
Compare
rolysr
left a comment
There was a problem hiding this comment.
LGTM. Please check my suggestions.
dmga44
left a comment
There was a problem hiding this comment.
LGTM, please check my minor suggestion.
Thread FilesystemOperationContext through all ACL methods (deleteAcl, setAcl, getAcl, applySetAcl, applySetRichAcl) in both IFilesystemNodeOperations and IFilesystemOperations, removing the internal transaction creation that was hardcoded inside each FilesystemOperationsBase method body. Callers (matoclserv, restore) now own the transaction lifecycle, enabling KV backends to participate in ACL operations as part of a single coordinated transaction. Introduce a protected virtual `getAclForAccess()` method to abstract ACL retrieval inside `access()`. The default in-memory implementation reads from `aclStorage`; KV backends can override it to materialise the ACL from the key-value store. Pass `FilesystemOperationContext` through `access()` at all call sites so the new virtual hook receives the context it needs. A caller-supplied `RichACL scratch` buffer is provided so temporary ACLs can be returned without extra allocation. The in-memory base implementation is not affected by the changes. Also document all affected interface declarations according to their implementations. Signed-off-by: guillex <guillex@leil.io>
ac7fb64 to
0a8e12b
Compare
ralcolea
left a comment
There was a problem hiding this comment.
Excellent work @lgsilva3087!! 👍 💪 🚀
I really liked the new documentation!! 🔥
Thread FilesystemOperationContext through all ACL methods (deleteAcl, setAcl, getAcl, applySetAcl, applySetRichAcl) in both IFilesystemNodeOperations and IFilesystemOperations, removing the internal transaction creation that was hardcoded inside each FilesystemOperationsBase method body.
Callers (matoclserv, restore) now own the transaction lifecycle, enabling KV backends to participate in ACL operations as part of a single coordinated transaction.
Introduce a protected virtual
getAclForAccess()method to abstract ACL retrieval insideaccess(). The default in-memory implementation reads fromaclStorage; KV backends can override it to materialise the ACL from the key-value store.Pass
FilesystemOperationContextthroughaccess()at all call sites so the new virtual hook receives the context it needs. A caller-suppliedRichACL scratchbuffer is provided so temporary ACLs can be returned without extra allocation.The in-memory base implementation is not affected by the changes.
Also document all affected interface declarations according to their implementations.
Related to: LS-70