-
Notifications
You must be signed in to change notification settings - Fork 88
Attachment refactor #7286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Attachment refactor #7286
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Greptile OverviewGreptile SummaryThis PR refactors the attachment storage system using the Strategy and Factory design patterns, creating a proper service layer architecture. The refactor successfully separates storage concerns from the data model and provides a unified interface for S3, GCS, and local storage backends. Key Improvements:
Architecture Quality: Process Note: Confidence Score: 4/5
Important Files Changed
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8 files reviewed, no comments
Description Of Changes
Refactors the attachment storage system to use a proper service layer architecture with the Strategy and Factory design patterns. This improves code organization, testability, and maintainability by separating storage concerns from the data model.
Key architectural improvements:
StorageProviderabstract base class that defines a consistent interface for all storage backends (S3, GCS, Local)StorageProviderFactoryfor clean provider instantiation based on configurationAttachmentServicein the service layer to handle all storage operations, following the project's layered architecture (API routes → Services → Models)Attachmentmodel, keeping it focused on data representation onlyCode Changes
StorageProviderabstract base class (src/fides/api/service/storage/providers/base.py) defining unified interface for upload, download, delete, presigned URLs, and file operationsS3StorageProviderimplementation (src/fides/api/service/storage/providers/s3_provider.py)GCSStorageProviderimplementation (src/fides/api/service/storage/providers/gcs_provider.py)LocalStorageProviderimplementation (src/fides/api/service/storage/providers/local_provider.py)StorageProviderFactory(src/fides/api/service/storage/providers/factory.py) for creating providers from configurationAttachmentService(src/fides/service/attachment_service.py) for attachment storage operations with methods for upload, retrieve, delete, and reference managementAttachmentmodel to remove embedded storage logicexternal_data_storage.pyto use new provider architecturepolling_attachment_handler.pyto useAttachmentServiceSteps to Confirm
pytest tests/ops/service/storage/providers/pytest tests/ctl/models/test_attachment.pyPre-Merge Checklist
CHANGELOG.mdupdatedmaindowngrade()migration is correct and works