FirestoreService

class gafaelfawr.services.firestore.FirestoreService(*, uid_cache, gid_cache, storage, logger)

Bases: object

Manage UID and GID assignments using Firestore.

This is a thin layer over FirestoreStorage and the UID/GID cache that integrates cache management with the underlying storage. It is primarily intended to be used by the user information service rather than called directly.

Parameters:
  • uid_cache (IdCache) – The underlying UID and GID cache and locks.

  • gid_cache (IdCache) – The underlying UID and GID cache and locks.

  • storage (FirestoreStorage) – The underlying Firestore storage for UID and GID assignment, if Firestore was configured.

  • logger (BoundLogger) – Logger to use.

Methods Summary

get_gid(group, *[, uncached])

Get the GID for a given group from Firestore.

get_uid(username, *[, uncached])

Get the UID for a given user.

Methods Documentation

async get_gid(group, *, uncached=False)

Get the GID for a given group from Firestore.

Parameters:
  • group (str) – Group of the user.

  • uncached (bool, default: False) – Bypass the cache, used for health checks.

Returns:

GID of the user.

Return type:

int

Raises:

NoAvailableGidError – No more GIDs are available in that range.

async get_uid(username, *, uncached=False)

Get the UID for a given user.

Parameters:
  • username (str) – Username of the user.

  • uncached (bool, default: False) – Bypass the cache, used for health checks.

Returns:

UID of the user.

Return type:

int

Raises:

NoAvailableUidError – No more UIDs are available in that range.