Skip to content

Commit

Permalink
Update docstring for _update_juju_secrets_cache
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-ratushnyy committed Sep 14, 2023
1 parent 45456f1 commit af0b0b5
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,20 @@ def _juju_secret_set(self, scope: Scopes, key: str, value: str) -> str:
return self.secrets[scope][Config.Secrets.SECRET_LABEL].id

def _update_juju_secrets_cache(self, scope: Scopes) -> None:
"""Helper function to get Juju secret."""
"""Helper function to retrieve all Juju secrets.
This function is responsible for direct communication with the Juju Secret
store to retrieve the Mono Charm's single, unique Secret object's metadata,
and --on success-- its contents.
In parallel with retrieving secret information, it's immediately locally cached,
making sure that we have the snapshot of the secret for the lifetime of the event
(that's being processed) without additional fetch requests to the Juju Secret Store.
(Note: metadata, i.e. the Secret object itself is cached as it may be necessary for
later operations, like updating contents.)
The function is returning a boolean that reflects success or failure of the above.
"""
peer_data = self._peer_data(scope)

if not peer_data.get(Config.Secrets.SECRET_INTERNAL_LABEL):
Expand Down

0 comments on commit af0b0b5

Please sign in to comment.