当前位置: 首页>>代码示例>>Python>>正文


Python Connector.getConns方法代码示例

本文整理汇总了Python中connector.Connector.getConns方法的典型用法代码示例。如果您正苦于以下问题:Python Connector.getConns方法的具体用法?Python Connector.getConns怎么用?Python Connector.getConns使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在connector.Connector的用法示例。


在下文中一共展示了Connector.getConns方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: CloudFS

# 需要导入模块: from connector import Connector [as 别名]
# 或者: from connector.Connector import getConns [as 别名]

#.........这里部分代码省略.........
		# cache file content from storage
		content = self.conn.pull(paths[0], paths[1])
		if paths[0] == None:
			raise FuseOSError(ENOENT)

		# search available file
		fd = None
		fdNum = -1		
		for i in range(0, self.maxFiles):
			fd = self.files[i]
			if fd['path'] == None:
				fdNum = i
				break

		if fd == None:
			raise FuseOSError(ENOENT)

		fd['path'] = path
		fd['dirty'] = False
		fd['data'] = content

		return fdNum
	
	def read(self, path, size, offset, fh):
		if self.files[fh]['path'] == None:
			raise FuseOSError(ENOENT)

		return self.files[fh]['data'][offset:offset + size]
	
	def readdir(self, path, fh):
		paths = splitPath(path)

		if paths[0] == '':
			dents = self.conn.getConns()
		else:
			dents = self.conn.getDents(paths[0], paths[1])

		return ['.', '..'] + dents
	
	def readlink(self, path):
		# readlink is not allowed
		raise FuseOSError(EPERM)
	
	def removexattr(self, path, name):
		raise FuseOSError(EPERM)
	
	def rename(self, old, new):
		# rename is not allowed
		raise FuseOSError(EPERM)
	
	def rmdir(self, path):
		paths = splitPath(path)

		# cannot remove mounted dir
		if paths[1] == '':
			raise FuseOSError(EPERM)
		if self.conn.rm(paths[0], paths[1]) != True:
			raise FuseOSError(ENOENT)
	
	def setxattr(self, path, name, value, options, position=0):
		raise FuseOSError(EPERM)

	def statfs(self, path):
		raise FuseOSError(EPERM)
	
	def symlink(self, target, source):
开发者ID:sangla1,项目名称:CloudFS,代码行数:70,代码来源:cloudfs.py


注:本文中的connector.Connector.getConns方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。