FirestoreStorage¶
- class gafaelfawr.storage.firestore.FirestoreStorage(config, logger)¶
Bases:
object
Google Firestore storage layer.
Gafaelfawr supports assigning UIDs and GIDs from Google Firestore rather than getting them from LDAP or upstream authentication tokens. This module provides the read/write layer and transaction management for that storage. It’s used from inside a per-process cache.
- Parameters:
config (
FirestoreConfig
) – Configuration for Google Firestore.logger (
BoundLogger
) – Logger for debug messages and errors.
Methods Summary
get_gid
(group)Get the GID for a group.
get_uid
(username, *[, bot])Get the UID for a user.
Initialize a Firestore document store for UID/GID assignment.
Methods Documentation
- async get_gid(group)¶
Get the GID for a group.
Retrieve the assigned GID for a group, or assign a new GID to that group if the group hasn’t been seen before.
- Parameters:
group (
str
) – Name of the group.- Returns:
GID of the group.
- Return type:
- Raises:
FirestoreNotInitializedError – Raised if Firestore has not been initialized.
NoAvailableGidError – Raised if no more GIDs are available in that range.
- async get_uid(username, *, bot=False)¶
Get the UID for a user.
Retrieve the assigned UID for a user, or assign a new UID to that user if the user hasn’t been seen before.
- Parameters:
- Returns:
UID of the user.
- Return type:
- Raises:
FirestoreNotInitializedError – Raised if Firestore has not been initialized.
NoAvailableUidError – Raised if no more UIDs are available in that range.