dxlfiletransferclient.store module¶
-
class
dxlfiletransferclient.store.
FileStoreManager
(storage_dir, working_dir=None)¶ Bases:
object
Class which writes file segments into a backing file store.
Constructor parameters:
Parameters: - storage_dir (str) -- Directory under which files are stored. If the directory does not already exist, an attempt will be made to create it.
- working_dir (str) -- Working directory under which files (or segments of files) may be stored in the process of being transferred to the storage_dir. If not specified, this defaults to ".workdir" under the value specified for the storage_dir parameter.
Raises: PermissionError -- If the storage_dir does not exist and cannot be created due to insufficient permissions.
-
store_segment
(message)¶ Process a message containing information for a file to store. If the request contains a file segment, the segment is written to disk.
Parameters: message (dxlclient.message.Message) -- The message containing the file segment to process. Returns: The result from the storage operation. Return type: FileStoreSegmentResult Raises: ValueError -- If any parameters associated with the segment to store are invalid. For example: if the segment number for the message is greater than 1 but no file id is associated with the message.
-
class
dxlfiletransferclient.store.
FileStoreSegmentResult
(file_id, segments_received, file_result=None)¶ Bases:
object
Class which holds the result data from a file segment storage attempt.
-
file_id
¶ Id of the file
Return type: str
-
file_result
¶ Storage result for the entire file (not just the segment), a member of the
dxlfiletransferclient.constants.FileStoreResultProp
class. If the stored segment was not the last one for the file, the return value would bedxlfiletransferclient.constants.FileStoreResultProp.NONE
.Return type: str
-
segments_received
¶ Segments received so far for the file
Return type: int
-
to_dict
()¶ Returns a dictionary representation of the file segment results.
Return type: dict
-