cup.storage package¶
init for cup.storage
Submodules¶
cup.storage.obj module¶
- description:
Object related storage
- class cup.storage.obj.AFSObjectSystem(config)[source]¶
Bases:
ObjectInterface
AFSObjectSystem implemented interface.
- delete(path)[source]¶
delete a file
- Parameters:
path – object path
- Returns:
{ 'returncode': 0 for success, others for failure, 'msg': 'if any' }
- get(path, localpath)[source]¶
get the object into localpath
- Returns:
{ 'returncode': 0 for success, others for failure, 'msg': 'if any' }
- head(path)[source]¶
get the object info
- Returns:
{ 'returncode': 0 for success, others for failure, 'msg': 'if any' 'objectinfo': { size: 1024, ....... } }
- mkdir(path)[source]¶
mkdir dir of a path
- Returns:
{ 'returncode': 0 for success, others for failure, 'msg': 'if any' 'objectinfo': { size: 1024, ....... } }
- class cup.storage.obj.FTPObjectSystem(config)[source]¶
Bases:
ObjectInterface
ftp object system, Plz notice all methods of FTPObjectSystem is NOT thread-safe! Be careful when you use it in a service of concurrency.
- head(path)[source]¶
get the file info
- Returns:
{ 'returncode': 0 for success, others for failure, 'msg': 'if any' 'fileinfo': [ "-rw-rw-r-- 1 work work 201 Nov 9 17:03 __init__.py" ] }
- class cup.storage.obj.LocalObjectSystem(kvconfig=None)[source]¶
Bases:
ObjectInterface
local object system
- class cup.storage.obj.S3ObjectSystem(config)[source]¶
Bases:
ObjectInterface
s3 object system
- delete(path)[source]¶
delete a file
- Parameters:
path – object path
- Returns:
- {
‘returncode’: 0 for success, others for failure, ‘msg’: ‘if any’
}
- delete_bucket(bucket_name, forcely=False)[source]¶
delete bucket
- Parameters:
forcely –
- if forcely is True, the bucket will be delete no matter it has
objects inside. Otherwise, you have to delete items inside, then delete the bucket
- get(path, localpath)[source]¶
get the object into localpath
- Returns:
- {
‘returncode’: 0 for success, others for failure, ‘msg’: ‘if any’
}
- head(path)[source]¶
get the object info
- Returns:
{ 'returncode': 0 for success, others for failure, 'msg': 'if any' 'objectinfo': { size: 1024, ....... } }
- mkdir(path)[source]¶
mkdir dir of a path
- Returns:
{ 'returncode': 0 for success, others for failure, 'msg': 'if any', 'objectinfo': { size: 1024, .. } }