buildgrid.server.peer module

class buildgrid.server.peer.Peer(uid: str, token: str | None = None, tool_name: str | None = None, tool_version: str | None = None)

Bases: object

Represents a client during a session.

classmethod register_peer(uid: str, context: ServicerContext, token: str | None = None) Peer

Registers a new peer from a given context.

Parameters:
  • uid (str) – a unique identifier

  • token (str) – an authentication token (optional)

  • context (grpc.ServicerContext) – context in which the peer is being registered

Returns:

an existing or newly created Peer object

Return type:

Peer

classmethod find_peer(uid: str) Peer | None
property uid: str
property token: str | None
classmethod deregister_peer(peer_uid: str) None

Deregisters a Peer from the list of peers present. If the Peer deregistered has a single instance, we delete it from the dictionary.