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:

Methods Summary

get_gid(group)

Get the GID for a group.

get_uid(username, *[, bot])

Get the UID for a user.

initialize()

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:

int

Raises:
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:
  • username (str) – Name of the user.

  • bot (bool, default: False) – If set to true, this is a bot user and should use the bot user range instead of the regular user range if a UID hasn’t already been assigned.

Returns:

UID of the user.

Return type:

int

Raises:
async initialize()#

Initialize a Firestore document store for UID/GID assignment.

This is safe to call on an already-initialized document store and will silently do nothing. :rtype: None