buildgrid.server.context module
- buildgrid.server.context.get_empty() RequestMetadata
Function to create an empty request metadata structure, to use as the deafult for the ContextVar
- buildgrid.server.context.metadatacontext() Callable[[Func], Func]
Helper function to obtain metadata and set request metadata ContextVar, and then reset it on completion of method.
Note
args[2] of the method must be of type grpc.ServicerContext
This returns a decorator that extracts the invocation_metadata from the context argument and sets the ContextVar variable with it. Resetting the ContextVar variable after the method has completed.
- buildgrid.server.context.metadata_list() Tuple[Tuple[str, str | bytes], ...]
Helper function to construct the metadata list from the ContextVar.