evalquiz_material_server package
Subpackages
- evalquiz_material_server.tests package
- Submodules
- evalquiz_material_server.tests.test_server_component module
calculate_combined_file_hash()delete_all_files_in_folder()file_upload_cleanup()material_server_service()prepare_material_upload_data()test_client_upload_material()test_client_upload_material_multiple_binaries()test_pymongo_connection()test_server_get_material()test_server_upload_material()to_async_iter()
- Module contents
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:
MaterialServerBaseServes 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
- 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:
- 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.
- 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:
FirstDataChunkNotMetadataException – Raised, if the first element is not a Metadata instance.
NoMimetypeMappingException – The mimetype in lecture_material.file_type could not be mapped to a file extension.
- Returns:
Empty gRPC compatible return format. Equivalent to “None”.
- Return type: