Coverage for chalicelib/utils/storage/interface.py: 71%

17 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-10-10 12:56 +0000

1from abc import ABC, abstractmethod 

2 

3 

4class ObjectStorage(ABC): 

5 @abstractmethod 

6 def exists(self, bucket, key): 

7 # Returns True if the object exists in the bucket, False otherwise 

8 pass 

9 

10 @abstractmethod 

11 def get_file(self, source_bucket, source_key): 

12 # Download and returns the file contents as bytes 

13 pass 

14 

15 @abstractmethod 

16 def get_presigned_url_for_sharing(self, bucket, expires_in, key, check_exists=False): 

17 # Returns a pre-signed URL for downloading the file from the object storage 

18 pass 

19 

20 @abstractmethod 

21 def get_presigned_url_for_upload(self, bucket, expires_in, key, **args): 

22 # Returns a pre-signed URL for uploading the file to the object storage 

23 pass 

24 

25 @abstractmethod 

26 def tag_for_deletion(self, bucket, key): 

27 # Adds the special tag 'to_delete_in_days' to the file to mark it for deletion 

28 pass