curve/curvefs_python/curvefs.py

488 lines
18 KiB
Python

#
# Copyright (c) 2020 NetEase Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.10
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info as _swig_python_version_info
if _swig_python_version_info >= (2, 7, 0):
def swig_import_helper():
import importlib
pkg = __name__.rpartition('.')[0]
mname = '.'.join((pkg, '_curvefs')).lstrip('.')
try:
return importlib.import_module(mname)
except ImportError:
return importlib.import_module('_curvefs')
_curvefs = swig_import_helper()
del swig_import_helper
elif _swig_python_version_info >= (2, 6, 0):
def swig_import_helper():
from os.path import dirname
import imp
fp = None
try:
fp, pathname, description = imp.find_module('_curvefs', [dirname(__file__)])
except ImportError:
import _curvefs
return _curvefs
if fp is not None:
try:
_mod = imp.load_module('_curvefs', fp, pathname, description)
finally:
fp.close()
return _mod
_curvefs = swig_import_helper()
del swig_import_helper
else:
import _curvefs
del _swig_python_version_info
try:
_swig_property = property
except NameError:
pass # Python < 2.2 doesn't have 'property'.
try:
import builtins as __builtin__
except ImportError:
import __builtin__
def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
if (name == "thisown"):
return self.this.own(value)
if (name == "this"):
if type(value).__name__ == 'SwigPyObject':
self.__dict__[name] = value
return
method = class_type.__swig_setmethods__.get(name, None)
if method:
return method(self, value)
if (not static):
if _newclass:
object.__setattr__(self, name, value)
else:
self.__dict__[name] = value
else:
raise AttributeError("You cannot add attributes to %s" % self)
def _swig_setattr(self, class_type, name, value):
return _swig_setattr_nondynamic(self, class_type, name, value, 0)
def _swig_getattr(self, class_type, name):
if (name == "thisown"):
return self.this.own()
method = class_type.__swig_getmethods__.get(name, None)
if method:
return method(self)
raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
def _swig_repr(self):
try:
strthis = "proxy of " + self.this.__repr__()
except __builtin__.Exception:
strthis = ""
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
try:
_object = object
_newclass = 1
except __builtin__.Exception:
class _object:
pass
_newclass = 0
CURVE_INODE_DIRECTORY = _curvefs.CURVE_INODE_DIRECTORY
CURVE_INODE_PAGEFILE = _curvefs.CURVE_INODE_PAGEFILE
CURVEINODE_APPENDFILE = _curvefs.CURVEINODE_APPENDFILE
CURVE_INODE_APPENDECFILE = _curvefs.CURVE_INODE_APPENDECFILE
CURVE_ERROR_OK = _curvefs.CURVE_ERROR_OK
CURVE_ERROR_EXISTS = _curvefs.CURVE_ERROR_EXISTS
CURVE_ERROR_FAILED = _curvefs.CURVE_ERROR_FAILED
CURVE_ERROR_DISABLEIO = _curvefs.CURVE_ERROR_DISABLEIO
CURVE_ERROR_AUTHFAIL = _curvefs.CURVE_ERROR_AUTHFAIL
CURVE_ERROR_DELETING = _curvefs.CURVE_ERROR_DELETING
CURVE_ERROR_NOTEXIST = _curvefs.CURVE_ERROR_NOTEXIST
CURVE_ERROR_UNDER_SNAPSHOT = _curvefs.CURVE_ERROR_UNDER_SNAPSHOT
CURVE_ERROR_NOT_UNDERSNAPSHOT = _curvefs.CURVE_ERROR_NOT_UNDERSNAPSHOT
CURVE_ERROR_DELETE_ERROR = _curvefs.CURVE_ERROR_DELETE_ERROR
CURVE_ERROR_NOT_ALLOCATE = _curvefs.CURVE_ERROR_NOT_ALLOCATE
CURVE_ERROR_NOT_SUPPORT = _curvefs.CURVE_ERROR_NOT_SUPPORT
CURVE_ERROR_NOT_EMPTY = _curvefs.CURVE_ERROR_NOT_EMPTY
CURVE_ERROR_NO_SHRINK_BIGGER_FILE = _curvefs.CURVE_ERROR_NO_SHRINK_BIGGER_FILE
CURVE_ERROR_SESSION_NOTEXISTS = _curvefs.CURVE_ERROR_SESSION_NOTEXISTS
CURVE_ERROR_FILE_OCCUPIED = _curvefs.CURVE_ERROR_FILE_OCCUPIED
CURVE_ERROR_PARAM_ERROR = _curvefs.CURVE_ERROR_PARAM_ERROR
CURVE_ERROR_INTERNAL_ERROR = _curvefs.CURVE_ERROR_INTERNAL_ERROR
CURVE_ERROR_CRC_ERROR = _curvefs.CURVE_ERROR_CRC_ERROR
CURVE_ERROR_INVALID_REQUEST = _curvefs.CURVE_ERROR_INVALID_REQUEST
CURVE_ERROR_DISK_FAIL = _curvefs.CURVE_ERROR_DISK_FAIL
CURVE_ERROR_NO_SPACE = _curvefs.CURVE_ERROR_NO_SPACE
CURVE_ERROR_NOT_ALIGNED = _curvefs.CURVE_ERROR_NOT_ALIGNED
CURVE_ERROR_BAD_FD = _curvefs.CURVE_ERROR_BAD_FD
CURVE_ERROR_LENGTH_NOT_SUPPORT = _curvefs.CURVE_ERROR_LENGTH_NOT_SUPPORT
CURVE_FILE_CREATED = _curvefs.CURVE_FILE_CREATED
CURVE_FILE_DELETING = _curvefs.CURVE_FILE_DELETING
CURVE_FILE_CLONING = _curvefs.CURVE_FILE_CLONING
CURVE_FILE_CLONEMETAINSTALLED = _curvefs.CURVE_FILE_CLONEMETAINSTALLED
CURVE_FILE_CLONED = _curvefs.CURVE_FILE_CLONED
CURVE_FILE_BEINGCLONED = _curvefs.CURVE_FILE_BEINGCLONED
CURVE_ERROR_UNKNOWN = _curvefs.CURVE_ERROR_UNKNOWN
CURVE_OP_READ = _curvefs.CURVE_OP_READ
CURVE_OP_WRITE = _curvefs.CURVE_OP_WRITE
CLUSTERIDMAX = _curvefs.CLUSTERIDMAX
class AioContext_t(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, AioContext_t, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, AioContext_t, name)
__repr__ = _swig_repr
__swig_setmethods__["offset"] = _curvefs.AioContext_t_offset_set
__swig_getmethods__["offset"] = _curvefs.AioContext_t_offset_get
if _newclass:
offset = _swig_property(_curvefs.AioContext_t_offset_get, _curvefs.AioContext_t_offset_set)
__swig_setmethods__["length"] = _curvefs.AioContext_t_length_set
__swig_getmethods__["length"] = _curvefs.AioContext_t_length_get
if _newclass:
length = _swig_property(_curvefs.AioContext_t_length_get, _curvefs.AioContext_t_length_set)
__swig_setmethods__["ret"] = _curvefs.AioContext_t_ret_set
__swig_getmethods__["ret"] = _curvefs.AioContext_t_ret_get
if _newclass:
ret = _swig_property(_curvefs.AioContext_t_ret_get, _curvefs.AioContext_t_ret_set)
__swig_setmethods__["op"] = _curvefs.AioContext_t_op_set
__swig_getmethods__["op"] = _curvefs.AioContext_t_op_get
if _newclass:
op = _swig_property(_curvefs.AioContext_t_op_get, _curvefs.AioContext_t_op_set)
__swig_setmethods__["cb"] = _curvefs.AioContext_t_cb_set
__swig_getmethods__["cb"] = _curvefs.AioContext_t_cb_get
if _newclass:
cb = _swig_property(_curvefs.AioContext_t_cb_get, _curvefs.AioContext_t_cb_set)
__swig_setmethods__["buf"] = _curvefs.AioContext_t_buf_set
__swig_getmethods__["buf"] = _curvefs.AioContext_t_buf_get
if _newclass:
buf = _swig_property(_curvefs.AioContext_t_buf_get, _curvefs.AioContext_t_buf_set)
def __init__(self):
this = _curvefs.new_AioContext_t()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _curvefs.delete_AioContext_t
__del__ = lambda self: None
AioContext_t_swigregister = _curvefs.AioContext_t_swigregister
AioContext_t_swigregister(AioContext_t)
class UserInfo_t(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, UserInfo_t, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, UserInfo_t, name)
__repr__ = _swig_repr
__swig_setmethods__["owner"] = _curvefs.UserInfo_t_owner_set
__swig_getmethods__["owner"] = _curvefs.UserInfo_t_owner_get
if _newclass:
owner = _swig_property(_curvefs.UserInfo_t_owner_get, _curvefs.UserInfo_t_owner_set)
__swig_setmethods__["password"] = _curvefs.UserInfo_t_password_set
__swig_getmethods__["password"] = _curvefs.UserInfo_t_password_get
if _newclass:
password = _swig_property(_curvefs.UserInfo_t_password_get, _curvefs.UserInfo_t_password_set)
def __init__(self):
this = _curvefs.new_UserInfo_t()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _curvefs.delete_UserInfo_t
__del__ = lambda self: None
UserInfo_t_swigregister = _curvefs.UserInfo_t_swigregister
UserInfo_t_swigregister(UserInfo_t)
class FileInfo_t(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, FileInfo_t, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, FileInfo_t, name)
__repr__ = _swig_repr
__swig_setmethods__["id"] = _curvefs.FileInfo_t_id_set
__swig_getmethods__["id"] = _curvefs.FileInfo_t_id_get
if _newclass:
id = _swig_property(_curvefs.FileInfo_t_id_get, _curvefs.FileInfo_t_id_set)
__swig_setmethods__["parentid"] = _curvefs.FileInfo_t_parentid_set
__swig_getmethods__["parentid"] = _curvefs.FileInfo_t_parentid_get
if _newclass:
parentid = _swig_property(_curvefs.FileInfo_t_parentid_get, _curvefs.FileInfo_t_parentid_set)
__swig_setmethods__["filetype"] = _curvefs.FileInfo_t_filetype_set
__swig_getmethods__["filetype"] = _curvefs.FileInfo_t_filetype_get
if _newclass:
filetype = _swig_property(_curvefs.FileInfo_t_filetype_get, _curvefs.FileInfo_t_filetype_set)
__swig_setmethods__["length"] = _curvefs.FileInfo_t_length_set
__swig_getmethods__["length"] = _curvefs.FileInfo_t_length_get
if _newclass:
length = _swig_property(_curvefs.FileInfo_t_length_get, _curvefs.FileInfo_t_length_set)
__swig_setmethods__["ctime"] = _curvefs.FileInfo_t_ctime_set
__swig_getmethods__["ctime"] = _curvefs.FileInfo_t_ctime_get
if _newclass:
ctime = _swig_property(_curvefs.FileInfo_t_ctime_get, _curvefs.FileInfo_t_ctime_set)
__swig_setmethods__["filename"] = _curvefs.FileInfo_t_filename_set
__swig_getmethods__["filename"] = _curvefs.FileInfo_t_filename_get
if _newclass:
filename = _swig_property(_curvefs.FileInfo_t_filename_get, _curvefs.FileInfo_t_filename_set)
__swig_setmethods__["owner"] = _curvefs.FileInfo_t_owner_set
__swig_getmethods__["owner"] = _curvefs.FileInfo_t_owner_get
if _newclass:
owner = _swig_property(_curvefs.FileInfo_t_owner_get, _curvefs.FileInfo_t_owner_set)
__swig_setmethods__["fileStatus"] = _curvefs.FileInfo_t_fileStatus_set
__swig_getmethods__["fileStatus"] = _curvefs.FileInfo_t_fileStatus_get
if _newclass:
fileStatus = _swig_property(_curvefs.FileInfo_t_fileStatus_get, _curvefs.FileInfo_t_fileStatus_set)
__swig_setmethods__["stripeUnit"] = _curvefs.FileInfo_t_stripeUnit_set
__swig_getmethods__["stripeUnit"] = _curvefs.FileInfo_t_stripeUnit_get
if _newclass:
stripeUnit = _swig_property(_curvefs.FileInfo_t_stripeUnit_get, _curvefs.FileInfo_t_stripeUnit_set)
__swig_setmethods__["stripeCount"] = _curvefs.FileInfo_t_stripeCount_set
__swig_getmethods__["stripeCount"] = _curvefs.FileInfo_t_stripeCount_get
if _newclass:
stripeCount = _swig_property(_curvefs.FileInfo_t_stripeCount_get, _curvefs.FileInfo_t_stripeCount_set)
def __init__(self):
this = _curvefs.new_FileInfo_t()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _curvefs.delete_FileInfo_t
__del__ = lambda self: None
FileInfo_t_swigregister = _curvefs.FileInfo_t_swigregister
FileInfo_t_swigregister(FileInfo_t)
class DirInfos_t(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, DirInfos_t, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, DirInfos_t, name)
__repr__ = _swig_repr
__swig_setmethods__["dirpath"] = _curvefs.DirInfos_t_dirpath_set
__swig_getmethods__["dirpath"] = _curvefs.DirInfos_t_dirpath_get
if _newclass:
dirpath = _swig_property(_curvefs.DirInfos_t_dirpath_get, _curvefs.DirInfos_t_dirpath_set)
__swig_setmethods__["userinfo"] = _curvefs.DirInfos_t_userinfo_set
__swig_getmethods__["userinfo"] = _curvefs.DirInfos_t_userinfo_get
if _newclass:
userinfo = _swig_property(_curvefs.DirInfos_t_userinfo_get, _curvefs.DirInfos_t_userinfo_set)
__swig_setmethods__["dirsize"] = _curvefs.DirInfos_t_dirsize_set
__swig_getmethods__["dirsize"] = _curvefs.DirInfos_t_dirsize_get
if _newclass:
dirsize = _swig_property(_curvefs.DirInfos_t_dirsize_get, _curvefs.DirInfos_t_dirsize_set)
__swig_setmethods__["fileinfo"] = _curvefs.DirInfos_t_fileinfo_set
__swig_getmethods__["fileinfo"] = _curvefs.DirInfos_t_fileinfo_get
if _newclass:
fileinfo = _swig_property(_curvefs.DirInfos_t_fileinfo_get, _curvefs.DirInfos_t_fileinfo_set)
def __init__(self):
this = _curvefs.new_DirInfos_t()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _curvefs.delete_DirInfos_t
__del__ = lambda self: None
DirInfos_t_swigregister = _curvefs.DirInfos_t_swigregister
DirInfos_t_swigregister(DirInfos_t)
def Init(path):
return _curvefs.Init(path)
Init = _curvefs.Init
def Open4Qemu(filename):
return _curvefs.Open4Qemu(filename)
Open4Qemu = _curvefs.Open4Qemu
def Open(filename, info):
return _curvefs.Open(filename, info)
Open = _curvefs.Open
def Create(filename, info, size):
return _curvefs.Create(filename, info, size)
Create = _curvefs.Create
def Read(fd, buf, offset, length):
return _curvefs.Read(fd, buf, offset, length)
Read = _curvefs.Read
def Write(fd, buf, offset, length):
return _curvefs.Write(fd, buf, offset, length)
Write = _curvefs.Write
def AioRead(fd, aioctx):
return _curvefs.AioRead(fd, aioctx)
AioRead = _curvefs.AioRead
def AioWrite(fd, aioctx):
return _curvefs.AioWrite(fd, aioctx)
AioWrite = _curvefs.AioWrite
def StatFile4Qemu(filename, finfo):
return _curvefs.StatFile4Qemu(filename, finfo)
StatFile4Qemu = _curvefs.StatFile4Qemu
def StatFile(filename, info, finfo):
return _curvefs.StatFile(filename, info, finfo)
StatFile = _curvefs.StatFile
def ChangeOwner(filename, owner, info):
return _curvefs.ChangeOwner(filename, owner, info)
ChangeOwner = _curvefs.ChangeOwner
def Close(fd):
return _curvefs.Close(fd)
Close = _curvefs.Close
def Rename(info, oldpath, newpath):
return _curvefs.Rename(info, oldpath, newpath)
Rename = _curvefs.Rename
def Extend(filename, info, size):
return _curvefs.Extend(filename, info, size)
Extend = _curvefs.Extend
def Unlink(filename, info):
return _curvefs.Unlink(filename, info)
Unlink = _curvefs.Unlink
def DeleteForce(filename, info):
return _curvefs.DeleteForce(filename, info)
DeleteForce = _curvefs.DeleteForce
def Recover(filename, info, fileId):
return _curvefs.Recover(filename, info, fileId)
Recover = _curvefs.Recover
def Listdir(dirpath, info):
return _curvefs.Listdir(dirpath, info)
Listdir = _curvefs.Listdir
def Mkdir(dirpath, info):
return _curvefs.Mkdir(dirpath, info)
Mkdir = _curvefs.Mkdir
def Rmdir(dirpath, info):
return _curvefs.Rmdir(dirpath, info)
Rmdir = _curvefs.Rmdir
def UnInit():
return _curvefs.UnInit()
UnInit = _curvefs.UnInit
def GetClusterId(buf=None, len=0):
return _curvefs.GetClusterId(buf, len)
GetClusterId = _curvefs.GetClusterId
class CBDClient(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, CBDClient, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, CBDClient, name)
__repr__ = _swig_repr
def __init__(self):
this = _curvefs.new_CBDClient()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _curvefs.delete_CBDClient
__del__ = lambda self: None
def Init(self, configPath):
return _curvefs.CBDClient_Init(self, configPath)
def UnInit(self):
return _curvefs.CBDClient_UnInit(self)
def Open(self, filename, userInfo):
return _curvefs.CBDClient_Open(self, filename, userInfo)
def Close(self, fd):
return _curvefs.CBDClient_Close(self, fd)
def Create(self, filename, userInfo, size):
return _curvefs.CBDClient_Create(self, filename, userInfo, size)
def Create2(self, filename, userInfo, size, stripeUnit, stripeCount):
return _curvefs.CBDClient_Create2(self, filename, userInfo, size, stripeUnit, stripeCount)
def Unlink(self, filename, info):
return _curvefs.CBDClient_Unlink(self, filename, info)
def DeleteForce(self, filename, info):
return _curvefs.CBDClient_DeleteForce(self, filename, info)
def Recover(self, filename, info, fileId):
return _curvefs.CBDClient_Recover(self, filename, info, fileId)
def Rename(self, info, oldpath, newpath):
return _curvefs.CBDClient_Rename(self, info, oldpath, newpath)
def Extend(self, filename, info, size):
return _curvefs.CBDClient_Extend(self, filename, info, size)
def Read(self, fd, buf, offset, length):
return _curvefs.CBDClient_Read(self, fd, buf, offset, length)
def Write(self, fd, buf, offset, length):
return _curvefs.CBDClient_Write(self, fd, buf, offset, length)
def AioRead(self, fd, aioctx):
return _curvefs.CBDClient_AioRead(self, fd, aioctx)
def AioWrite(self, fd, aioctx):
return _curvefs.CBDClient_AioWrite(self, fd, aioctx)
def StatFile(self, filename, info, finfo):
return _curvefs.CBDClient_StatFile(self, filename, info, finfo)
def ChangeOwner(self, filename, owner, info):
return _curvefs.CBDClient_ChangeOwner(self, filename, owner, info)
def Listdir(self, dirpath, info):
return _curvefs.CBDClient_Listdir(self, dirpath, info)
def Mkdir(self, dirpath, info):
return _curvefs.CBDClient_Mkdir(self, dirpath, info)
def Rmdir(self, dirpath, info):
return _curvefs.CBDClient_Rmdir(self, dirpath, info)
def GetClusterId(self):
return _curvefs.CBDClient_GetClusterId(self)
CBDClient_swigregister = _curvefs.CBDClient_swigregister
CBDClient_swigregister(CBDClient)
# This file is compatible with both classic and new-style classes.