-
Notifications
You must be signed in to change notification settings - Fork 8
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
Refactor Agency Configuration File Handling and Add Tests #10
Conversation
Returns: | ||
self: An instance of AgencyConfigFileStorage. | ||
""" | ||
self.lock = AgencyConfigLockManager.get_lock(self.agency_id) |
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.
My original plan for the context manager implementation was to eliminate the need for a separate lock manager class. Instead, the context manager itself would handle the lock. This means that upon entering the context (i.e., during the enter method), it would acquire the lock and then return the opened file. Conversely, upon exiting the context (exit method), it would release the lock and close the file.
@@ -4,6 +4,7 @@ version = "1.0.0" | |||
description = "Nalgonda is a FastAPI app to manage swarm agencies" | |||
authors = [ | |||
"Nikita Bobrovskiy <[email protected]>", | |||
"Guilherme Parpinelli <[email protected]>", |
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.
😀
AgencyConfigStorageInterface
, an abstract base class defining a standard interface for agency configuration storage.AgencyConfigFileStorage
, a concrete class that extendsAgencyConfigStorageInterface
. It provides thread-safe file operations for agency-specific configurations using a context manager pattern.AgencyConfigFileStorage
by integratingAgencyConfigLockManager
for managing locks based on agency IDs.AgencyConfigFileStorage
to validate functionality such as lock acquisition/release, loading and saving configuration data, and handling default configuration fallbacks when specific agency files are not present.