evalquiz_material_server package

Subpackages

Submodules

evalquiz_material_server.server_component module

class evalquiz_material_server.server_component.MaterialServerService(material_storage_path: ~pathlib.Path, path_dictionary_controller: ~evalquiz_proto.shared.path_dictionary_controller.PathDictionaryController = <evalquiz_proto.shared.path_dictionary_controller.PathDictionaryController object>)[source]

Bases: MaterialServerBase

Serves endpoints for material manipulation.

async delete_material(string: String) Empty[source]

Asynchronous method that is used by gRPC as an endpoint. Manages deletion of lecture materials

Parameters:

string (String) – The hash of the lecture material.

Returns:

Empty gRPC compatible return format. Equivalent to “None”.

Return type:

Empty

async get_material(string: String) AsyncIterator[MaterialUploadData][source]

Asynchronous method that is used by gRPC as an endpoint. Returns a specific lecture material for a hash.

Parameters:

string (String) – Hash of the material to query.

Returns:

An Iterator which elements represent packages of the stream. Includes LectureMaterial as the first element and data in bytes as the following elements.

Return type:

AsyncIterator[MaterialUploadData]

async get_material_hashes(empty: Empty) ListOfStrings[source]

Asynchronous method that is used by gRPC as an endpoint. Returns hashes of all registered lecture materials.

Parameters:

empty (Empty) – Empty gRPC compatible return format. Equivalent to “None”. Required as parameter.

Returns:

Hashes of all registered lecture materials.

Return type:

ListOfStrings

async get_material_name(string: String) String[source]

Asynchronous method that is used by gRPC as an endpoint. Returns material name of a lecture material hash.

Parameters:

string (String) – The hash of the lecture material.

Returns:

Material name, as specified in PathDictionaryController.

Return type:

String

async upload_material(material_upload_data_iterator: AsyncIterator[MaterialUploadData]) Empty[source]

Asynchronous method that is used by gRPC as an endpoint. Manages a lecture material upload. Note on how local_path is built: The file extension is added to the hash to enable mimetype recognition when loading the lecture material: When PathDictionaryController.load_file is invoked.

Parameters:

material_upload_data_iterator (AsyncIterator[MaterialUploadData]) – An Iterator which elements represent packages of the stream. Includes a Metadata instance as the first element and data in bytes as the following elements.

Raises:
Returns:

Empty gRPC compatible return format. Equivalent to “None”.

Return type:

Empty

async evalquiz_material_server.server_component.main() None[source]

Sets up and starts MaterialServerService.

Module contents