fiuai-s3 0.3.7__tar.gz → 0.3.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of fiuai-s3 might be problematic. Click here for more details.
- {fiuai_s3-0.3.7 → fiuai_s3-0.3.9}/PKG-INFO +1 -1
- {fiuai_s3-0.3.7 → fiuai_s3-0.3.9}/pyproject.toml +1 -1
- {fiuai_s3-0.3.7 → fiuai_s3-0.3.9}/src/fiuai_s3/__init__.py +1 -1
- {fiuai_s3-0.3.7 → fiuai_s3-0.3.9}/src/fiuai_s3/minio/minio_storage.py +20 -0
- {fiuai_s3-0.3.7 → fiuai_s3-0.3.9}/src/fiuai_s3/object_storage.py +21 -1
- {fiuai_s3-0.3.7 → fiuai_s3-0.3.9}/.gitignore +0 -0
- {fiuai_s3-0.3.7 → fiuai_s3-0.3.9}/LICENSE +0 -0
- {fiuai_s3-0.3.7 → fiuai_s3-0.3.9}/README.md +0 -0
- {fiuai_s3-0.3.7 → fiuai_s3-0.3.9}/src/fiuai_s3/alicloud/__init__.py +0 -0
- {fiuai_s3-0.3.7 → fiuai_s3-0.3.9}/src/fiuai_s3/alicloud/alicloud_storage.py +0 -0
- {fiuai_s3-0.3.7 → fiuai_s3-0.3.9}/src/fiuai_s3/minio/__init__.py +0 -0
- {fiuai_s3-0.3.7 → fiuai_s3-0.3.9}/src/fiuai_s3/type.py +0 -0
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
from .object_storage import ObjectStorage, ObjectStorageFactory, StorageConfig
|
|
9
9
|
from .type import DocFileObject, DocSourceFrom, DocFileType
|
|
10
10
|
|
|
11
|
-
__version__ = "0.3.
|
|
11
|
+
__version__ = "0.3.9"
|
|
12
12
|
__all__ = ["ObjectStorage", "ObjectStorageFactory", "StorageConfig", "DocFileObject", "DocSourceFrom", "DocFileType"]
|
|
@@ -70,6 +70,26 @@ class MinioStorage(ObjectStorage):
|
|
|
70
70
|
raise ValueError("MinIO endpoint can not contain path, format should be: host:port")
|
|
71
71
|
|
|
72
72
|
return endpoint
|
|
73
|
+
|
|
74
|
+
def upload_temp_file(self, object_key: str, data: bytes, tmppath: str = None) -> bool:
|
|
75
|
+
"""上传临时文件
|
|
76
|
+
|
|
77
|
+
Args:
|
|
78
|
+
object_key: 对象存储中的key
|
|
79
|
+
tmppath: 临时文件路径, 如果为空,则使用默认临时目录
|
|
80
|
+
"""
|
|
81
|
+
_path = f"{self.config.temp_dir}/{object_key}" if not tmppath else f"{tmppath.rstrip('/')}/{object_key}"
|
|
82
|
+
return self.upload_file(_path, data)
|
|
83
|
+
|
|
84
|
+
def download_temp_file(self, object_key: str, tmppath: str = None) -> bool:
|
|
85
|
+
"""下载临时文件
|
|
86
|
+
|
|
87
|
+
Args:
|
|
88
|
+
object_key: 对象存储中的key
|
|
89
|
+
tmppath: 临时文件路径, 如果为空,则使用默认临时目录
|
|
90
|
+
"""
|
|
91
|
+
_path = f"{self.config.temp_dir}/{object_key}" if not tmppath else f"{tmppath.rstrip('/')}/{object_key}"
|
|
92
|
+
return self.download_file(_path)
|
|
73
93
|
|
|
74
94
|
def upload_file(self, object_key: str, data: bytes) -> bool:
|
|
75
95
|
"""上传文件到MinIO
|
|
@@ -47,6 +47,26 @@ class ObjectStorage(ABC):
|
|
|
47
47
|
self.auth_company_id = auth_company_id
|
|
48
48
|
self.doc_id = doc_id
|
|
49
49
|
|
|
50
|
+
@abstractmethod
|
|
51
|
+
def upload_temp_file(self, object_key: str, data: bytes, tmppath: str = None) -> bool:
|
|
52
|
+
"""上传临时文件
|
|
53
|
+
|
|
54
|
+
Args:
|
|
55
|
+
object_key: 对象存储中的key
|
|
56
|
+
tmppath: 临时文件路径, 如果为空,则使用默认临时目录
|
|
57
|
+
"""
|
|
58
|
+
pass
|
|
59
|
+
|
|
60
|
+
@abstractmethod
|
|
61
|
+
def download_temp_file(self, object_key: str, tmppath: str = None) -> bool:
|
|
62
|
+
"""下载临时文件
|
|
63
|
+
|
|
64
|
+
Args:
|
|
65
|
+
object_key: 对象存储中的key
|
|
66
|
+
tmppath: 临时文件路径, 如果为空,则使用默认临时目录
|
|
67
|
+
"""
|
|
68
|
+
pass
|
|
69
|
+
|
|
50
70
|
@abstractmethod
|
|
51
71
|
def upload_file(self, object_key: str, data: bytes) -> bool:
|
|
52
72
|
"""上传文件到对象存储
|
|
@@ -177,7 +197,7 @@ class ObjectStorageFactory:
|
|
|
177
197
|
endpoint=endpoint,
|
|
178
198
|
access_key=access_key,
|
|
179
199
|
secret_key=secret_key,
|
|
180
|
-
temp_dir=temp_dir,
|
|
200
|
+
temp_dir=temp_dir.rstrip("/").lstrip("/"),
|
|
181
201
|
use_https=use_https
|
|
182
202
|
)
|
|
183
203
|
cls._instance = None
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|