Skip to content
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

Make region-client map concurrency safe #197

Merged
merged 1 commit into from
Sep 11, 2023

Conversation

lavafroth
Copy link
Contributor

Changes

  • A custom client map data structure is created as a sub-package under providers
  • The client map structure uses a mutex for synchronization
  • All concurrency unsafe map[string]*s3.Client instances are replaced with the custom structure
  • The structure can be created using clientmap.New() or clientmap.WithCapacity(int)
  • Key-value pairs can be retrieved or set using the Get and Set methods respectively
  • Bare range over the structure is unavailable; hence we use a for i := ... loop over the length using the Len() method

@sa7mon sa7mon added the refactor Code cleanup / optimization label Sep 11, 2023
@sa7mon
Copy link
Owner

sa7mon commented Sep 11, 2023

@lavafroth This looks great. Thanks for the contribution!

@sa7mon sa7mon merged commit f42a674 into sa7mon:main Sep 11, 2023
7 of 8 checks passed
@lavafroth lavafroth deleted the concurrency-safe-client-map branch September 12, 2023 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Code cleanup / optimization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants