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
Configurable storage provider #1937
Comments
Can I work on this issue?? |
@sainak Will you provide test secrets and credentials to work on this issue? |
@balaji-sivasakthi you will have to use local development tools like localstack and azureite |
@sainak Is these tools FOSS? |
For our use case, yes |
|
ApproachTo decouple the storage provider from specific use cases like patient and facility, we can introduce more flexibility by allowing the specification of bucket types and access controls through parameters. We'll utilize enums for access control and provide the bucket name as a parameter. class ClientConfig(TypedDict):
region_name: str
aws_access_key_id: str
aws_secret_access_key: str
endpoint_url: str
class CSProvider(enum.Enum):
AWS = "AWS"
GCP = "GCP"
AZURE = 'AZURE'
DOCKER = "DOCKER" # localstack in docker
LOCAL = "LOCAL" # localstack on host
class AccessControl(enum.Enum):
PUBLIC = "PUBLIC"
PRIVATE = "PRIVATE"
class BucketType(enum.Enum):
PATIENT = "PATIENT"
FACILITY = "FACILITY" Then we will create a factory method for storages based on the I will add a class method named from_provider inside the ConfigurableStorageProvider class. This method acts as a factory method to create instances of ConfigurableStorageProvider based on the specified CSProvider. When calling the from_provider method, you provide the desired CSProvider, account_url, and credential. It internally creates a ClientConfig object and initialises the ConfigurableStorageProvider instance accordingly. This approach makes it easier to instantiate the ConfigurableStorageProvider class by encapsulating the logic of creating the ClientConfig object based on the specified provider LLDdef __init__(self, provider: CSProvider, client_config: ClientConfig): def from_provider(cls, provider: CSProvider, account_url: str, credential: str) -> 'ConfigurableStorageProvider': def get_signed_url(self, bucket_name: BucketName, object_key: str, expiration: int, access_control: AccessControl) -> str: def check_mime_type(self, file_path: str, expected_mime_type: str) -> bool: |
Currently, we only support s3 compatible storage providers for storing and retrieving files, we need to make the storage provider more configurable
we have 2 buckets currently:
The solution is to create a configurable storage provider class that can support s3/azure blob storage/local storage to serve files.
requirements:
Share your implementation plan before working on this issue
The text was updated successfully, but these errors were encountered: