Refactor structs guarded by mutexes #350
Labels
area/implementation
kind/enhancement
New feature or request
participation/good first issue
Good for newcomers
Most structs guarding data behind a Mutex/RWMutex such as
authorization.OPA
,identity.APIKey
andidentity.MTLS
are not clear about what fields are guarded in the way they are declared and handled, requiring one who reads the code to dive into the details of each implementation to identify the critical sections.By not clearly delimiting the critical sections, not only it compromises the immediate readability of the code but it imposes a risk for long-term maintainability of it. One who touches the code could easily overlook data fields meant to be handled in a critical section and inadvertently jeopardize the entire concurrency control.
Here are a couple patterns to improve immediate readability and long-term security/maintainability of the implementations for critical sections and concurrency control:
controller.StatusReportMap
.cc @alexsnaps
The text was updated successfully, but these errors were encountered: