SIENTIAPDE-1717: Remove list_bucket_objects method from StorageRepository and its associated test.

This commit is contained in:
Bruno Domingues
2026-03-30 14:18:14 -03:00
parent 7a0961f29d
commit f5eb8d1e5b
2 changed files with 0 additions and 67 deletions

View File

@@ -118,36 +118,3 @@ class StorageRepository:
)
return BytesIO(file_content)
def list_bucket_objects(self, bucket_name: str, max_keys: int = 1000) -> list[str]:
"""
List objects in a MinIO bucket.
This method uses the MinIO/S3 list_objects_v2 API to retrieve objects
from the specified bucket. This is optimized for cleanup operations
by using configurable pagination.
Args:
bucket_name: Name of the bucket to list objects from.
max_keys: Maximum number of keys per page (default: 1000).
Returns:
List[str]: List of object keys (file names).
"""
# Use list_objects_v2 for efficient pagination
paginator = self.minio_client.get_paginator('list_objects_v2')
pages = paginator.paginate(Bucket=bucket_name, MaxKeys=max_keys)
objects = []
total_count = 0
for page in pages:
if 'Contents' in page:
for obj in page['Contents']:
objects.append(obj['Key'])
total_count += 1
self.logger.info(f'Listed {total_count} objects from bucket {bucket_name}')
return objects