cup.storage package

Submodules

cup.storage.obj module

description:Object related storage
class cup.storage.obj.AFSObjectSystem(config)[source]

Bases: cup.storage.obj.ObjectInterface

afs object

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 :return:

{
‘returncode’: 0 for success, others for failure, ‘msg’: ‘if any’

}

head(path)[source]

get the object info :return:

{

‘returncode’: 0 for success, others for failure, ‘msg’: ‘if any’ ‘objectinfo’: {

}

}

mkdir(path)[source]

mkdir dir of a path :return:

{

‘returncode’: 0 for success, others for failure, ‘msg’: ‘if any’ ‘objectinfo’: {

}

}

put(dest, localfile)[source]
Parameters:
  • dest – system path
  • localfile – localfile
Returns:

{

‘returncode’: 0 for success, others for failure, ‘msg’: ‘if any’

}

rmdir(path)[source]

rmdir of a path

class cup.storage.obj.S3ObjectSystem(config)[source]

Bases: cup.storage.obj.ObjectInterface

s3 object system

create_bucket(bucket_name)[source]

create bucket

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 :return:

{
‘returncode’: 0 for success, others for failure, ‘msg’: ‘if any’

}

head(path)[source]

get the object info :return:

{

‘returncode’: 0 for success, others for failure, ‘msg’: ‘if any’ ‘objectinfo’: {

}

}

head_bucket(bucket_name)[source]

create bucket

mkdir(path)[source]

mkdir dir of a path :return:

{

‘returncode’: 0 for success, others for failure, ‘msg’: ‘if any’ ‘objectinfo’: {

}

}

put(dest, localfile)[source]
Parameters:
  • dest – system path
  • localfile – localfile
Returns:

{

‘returncode’: 0 for success, others for failure, ‘msg’: ‘if any’

}

rmdir(path)[source]

rmdir of a path

class cup.storage.obj.FTPObjectSystem(config)[source]

Bases: cup.storage.obj.ObjectInterface

ftp object system

delete(path)[source]

delete file

get(path, localpath)[source]

get a file into localpath

head(path)[source]

get the file info :return:

{

‘returncode’: 0 for success, others for failure, ‘msg’: ‘if any’ ‘fileinfo’: [

“-rw-rw-r– 1 work work 201 Nov 9 17:03 __init__.py”

[

}

is_file(path)[source]

path is file or not

mkdir(path, recursive=True)[source]
put(dest, localfile)[source]
Parameters:
  • dest – ftp path
  • localfile – localfile
rmdir(path, recursive=True)[source]
class cup.storage.obj.LocalObjectSystem(kvconfig=None)[source]

Bases: cup.storage.obj.ObjectInterface

local object system

delete(path)[source]

delete a file in local

get(path, localpath)[source]

get a file into localpath

head(path)[source]

get the object info

mkdir(path, recursive=True)[source]
put(dest, localfile)[source]

local object put == copy

rmdir(path, recursive=True)[source]

Module contents

init for cup.storage