Consider reorganizing map access #9

Closed
opened 2025-01-29 13:09:15 +00:00 by alexvanin · 0 comments
Owner

Access to containerIDCache is protected by mutex. However mutex locks sometimes are far away from map access, e.g. resolveContainerIDHelper() reads the data without mutex, but it is correct because callers lock the mutex (see resolveOrCreateContainer).

To make code a bit more error prone, we can change the way to access mutex data. Two ways to deal with it:

  • create small function to read / write data from the map use locks only in these small function
  • add some copy-paste to existing functions that use locks

Read more in discussion here: #6 (comment)

Access to `containerIDCache` is protected by mutex. However mutex locks sometimes are far away from map access, e.g. `resolveContainerIDHelper()` reads the data without mutex, but it is correct because callers lock the mutex (see resolveOrCreateContainer). To make code a bit more error prone, we can change the way to access mutex data. Two ways to deal with it: - create small function to read / write data from the map use locks only in these small function - add some copy-paste to existing functions that use locks Read more in discussion here: https://git.frostfs.info/TrueCloudLab/rclone/pulls/6#issuecomment-64971
KurlesHS was assigned by alexvanin 2025-02-21 09:14:05 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/rclone#9
No description provided.