julee.util.repositories

Classes

FileStorageRepository

Handles storage and retrieval of large files/payloads.

Module Contents

class julee.util.repositories.FileStorageRepository[source]

Bases: Protocol

Handles storage and retrieval of large files/payloads.

Architectural Purpose: This repository is designed to manage large data payloads that might exceed Temporal’s payload size limits or are better stored externally. It allows workflows to store references to files rather than the files themselves, maintaining workflow determinism while handling large data.

async download_file(file_id)[source]

Download a file from storage by its ID.

Parameters:

file_id (str) – Unique identifier of the file.

Returns:

File content as bytes if found, None otherwise.

Return type:

bytes | None

async get_file_metadata(file_id)[source]

Retrieve metadata for a stored file.

Parameters:

file_id (str) – Unique identifier of the file.

Returns:

FileMetadata object if found, None otherwise.

Return type:

julee.util.domain.FileMetadata | None

async upload_file(args)[source]

Upload a file to storage.

Parameters:

args (julee.util.domain.FileUploadArgs) – FileUploadArgs containing file_id, data, and metadata.

Returns:

FileMetadata object with details about the uploaded file.

Return type:

julee.util.domain.FileMetadata

Implementation Notes: - Must be idempotent: uploading the same file_id multiple times is safe. - Should return metadata including the actual size and content type. - Must perform security validation: file size limits, content type verification, and filename sanitization. - Should reject files that don’t match declared content type.