|
|
|
@ -71,15 +71,8 @@ class OpenDALStorage(BaseStorage):
|
|
|
|
logger.debug(f"file {filename} downloaded to {target_filepath}")
|
|
|
|
logger.debug(f"file {filename} downloaded to {target_filepath}")
|
|
|
|
|
|
|
|
|
|
|
|
def exists(self, filename: str) -> bool:
|
|
|
|
def exists(self, filename: str) -> bool:
|
|
|
|
# FIXME this is a workaround for opendal python-binding do not have a exists method and no better
|
|
|
|
res: bool = self.op.exists(path=filename)
|
|
|
|
# error handler here when opendal python-binding has a exists method, we should use it
|
|
|
|
|
|
|
|
# more https://github.com/apache/opendal/blob/main/bindings/python/src/operator.rs
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
res: bool = self.op.stat(path=filename).mode.is_file()
|
|
|
|
|
|
|
|
logger.debug(f"file {filename} checked")
|
|
|
|
|
|
|
|
return res
|
|
|
|
return res
|
|
|
|
except Exception:
|
|
|
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def delete(self, filename: str):
|
|
|
|
def delete(self, filename: str):
|
|
|
|
if self.exists(filename):
|
|
|
|
if self.exists(filename):
|
|
|
|
|