@@ -64,7 +64,10 @@ def __init__(self, repository, ttl=None):
6464 self .ttl = ttl or int (get_config ("services" , "minio" , "ttl" , default = self .ttl ))
6565
6666 self .storage = StorageService ()
67- self .storage_hash = self .get_archive_hash (repository )
67+ if repository :
68+ self .storage_hash = self .get_archive_hash (repository )
69+ else :
70+ self .storage_hash = None
6871
6972 @classmethod
7073 def get_archive_hash (cls , repository ) -> str :
@@ -98,6 +101,8 @@ def write_json_data_to_storage(
98101 * ,
99102 encoder = ReportEncoder ,
100103 ):
104+ if not self .storage_hash :
105+ raise ValueError ("No hash key provided" )
101106 if commit_id is None :
102107 # Some classes don't have a commit associated with them
103108 # For example Pull belongs to multiple commits.
@@ -147,20 +152,29 @@ def read_file(self, path: str) -> str:
147152 return contents .decode ()
148153
149154 @sentry_sdk .trace
150- def delete_file (self , path ) :
155+ def delete_file (self , path : str ) -> None :
151156 """
152157 Generic method to delete a file from the archive.
153158 """
154159 self .storage .delete_file (self .root , path )
155160
161+ @sentry_sdk .trace
162+ def delete_files (self , paths : list [str ]) -> None :
163+ """
164+ Generic method to delete files from the archive.
165+ """
166+ self .storage .delete_files (bucket_name = self .root , paths = paths )
167+
156168 def read_chunks (self , commit_sha : str ) -> str :
157169 """
158170 Convenience method to read a chunks file from the archive.
159171 """
172+ if not self .storage_hash :
173+ raise ValueError ("No hash key provided" )
160174 path = MinioEndpoints .chunks .get_path (
161175 version = "v4" , repo_hash = self .storage_hash , commitid = commit_sha
162176 )
163177 return self .read_file (path )
164178
165- def create_presigned_put (self , path ) :
179+ def create_presigned_put (self , path : str ) -> str :
166180 return self .storage .create_presigned_put (self .root , path , self .ttl )
0 commit comments