PKG-INFO 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. Metadata-Version: 1.0
  2. Name: fdfs-client-py
  3. Version: 1.2.6
  4. Summary: Python client for Fastdfs ver 3.08
  5. Home-page: UNKNOWN
  6. Author: scott yuan
  7. Author-email: scottzer8@gmail.com
  8. License: GPLV3
  9. Description: # Fdfs_client py
  10. The Python interface to the Fastdfs Ver 3.08.
  11. ## Installation
  12. $ sudo python setup.py install
  13. ## Getting Started
  14. 1. import fdfs_client.client module
  15. 2. instantiate class Fdfs_client
  16. 3. call memeber functions
  17. >>>from fdfs_client.client import *
  18. >>>client = Fdfs_client('/etc/fdfs/client.conf')
  19. >>>ret = client.upload_by_filename('test')
  20. >>>ret
  21. {'Group name':'group1','Status':'Upload successed.', 'Remote file_id':'group1/M00/00/00/
  22. wKjzh0_xaR63RExnAAAaDqbNk5E1398.py','Uploaded size':'6.0KB','Local file name':'test'
  23. , 'Storage IP':'192.168.243.133'}
  24. ## API Reference
  25. Class Fdfs_client:
  26. member functions:
  27. * upload_by_filename(self, filename, meta_dict = None)
  28. '''
  29. Upload a file to Storage server.
  30. arguments:
  31. @filename: string, name of file that will be uploaded
  32. @meta_dict: dictionary e.g.:{
  33. 'ext_name' : 'jpg',
  34. 'file_size' : '10240B',
  35. 'width' : '160px',
  36. 'hight' : '80px'
  37. } meta_dict can be null
  38. @return dict {
  39. 'Group name' : group_name,
  40. 'Remote file_id' : remote_file_id,
  41. 'Status' : 'Upload successed.',
  42. 'Local file name' : local_file_name,
  43. 'Uploaded size' : upload_size,
  44. 'Storage IP' : storage_ip
  45. } if success else None
  46. * upload_by_buffer(self, filebuffer, file_ext_name = None, meta_dict = None)
  47. '''
  48. Upload a buffer to Storage server.
  49. arguments:
  50. @filebuffer: string, buffer
  51. @file_ext_name: string, file extend name
  52. @meta_dict: dictionary e.g.:{
  53. 'ext_name' : 'jpg',
  54. 'file_size' : '10240B',
  55. 'width' : '160px',
  56. 'hight' : '80px'
  57. }
  58. @return dict {
  59. 'Group name' : group_name,
  60. 'Remote file_id' : remote_file_id,
  61. 'Status' : 'Upload successed.',
  62. 'Local file name' : '',
  63. 'Uploaded size' : upload_size,
  64. 'Storage IP' : storage_ip
  65. }
  66. '''
  67. * upload_slave_by_filename(self, filename, remote_file_id, prefix_name, \
  68. meta_dict = None)
  69. '''
  70. Upload slave file to Storage server.
  71. arguments:
  72. @filename: string, local file name
  73. @remote_file_id: string, remote file id
  74. @prefix_name: string
  75. @meta_dict: dictionary e.g.:{
  76. 'ext_name' : 'jpg',
  77. 'file_size' : '10240B',
  78. 'width' : '160px',
  79. 'hight' : '80px'
  80. }
  81. @return dictionary {
  82. 'Status' : 'Upload slave successed.',
  83. 'Local file name' : local_filename,
  84. 'Uploaded size' : upload_size,
  85. 'Remote file id' : remote_file_id,
  86. 'Storage IP' : storage_ip
  87. }
  88. '''
  89. * upload_slave_by_buffer(self, filebuffer, remote_file_id, \
  90. meta_dict = None, file_ext_name = None)
  91. '''
  92. Upload slave file by buffer
  93. arguments:
  94. @filebuffer: string
  95. @remote_file_id: string
  96. @meta_dict: dictionary e.g.:{
  97. 'ext_name' : 'jpg',
  98. 'file_size' : '10240B',
  99. 'width' : '160px',
  100. 'hight' : '80px'
  101. }
  102. @return dictionary {
  103. 'Status' : 'Upload slave successed.',
  104. 'Local file name' : local_filename,
  105. 'Uploaded size' : upload_size,
  106. 'Remote file id' : remote_file_id,
  107. 'Storage IP' : storage_ip
  108. }
  109. '''
  110. * upload_appender_by_filename(self, local_filename, meta_dict = None)
  111. '''
  112. Upload an appender file by filename.
  113. arguments:
  114. @local_filename: string
  115. @meta_dict: dictionary e.g.:{
  116. 'ext_name' : 'jpg',
  117. 'file_size' : '10240B',
  118. 'width' : '160px',
  119. 'hight' : '80px'
  120. } Notice: it can be null
  121. @return dict {
  122. 'Group name' : group_name,
  123. 'Remote file_id' : remote_file_id,
  124. 'Status' : 'Upload successed.',
  125. 'Local file name' : '',
  126. 'Uploaded size' : upload_size,
  127. 'Storage IP' : storage_ip
  128. }
  129. '''
  130. * upload_appender_by_buffer(self, filebuffer, file_ext_name = None, meta_dict = None)
  131. '''
  132. Upload a buffer to Storage server.
  133. arguments:
  134. @filebuffer: string
  135. @file_ext_name: string, can be null
  136. @meta_dict: dictionary, can be null
  137. @return dict {
  138. 'Group name' : group_name,
  139. 'Remote file_id' : remote_file_id,
  140. 'Status' : 'Upload successed.',
  141. 'Local file name' : '',
  142. 'Uploaded size' : upload_size,
  143. 'Storage IP' : storage_ip
  144. }
  145. '''
  146. * delete_file(self, remote_file_id)
  147. '''
  148. Delete a file from Storage server.
  149. arguments:
  150. @remote_file_id: string, file_id of file that is on storage server
  151. @return tuple ('Delete file successed.', remote_file_id, storage_ip)
  152. '''
  153. * download_to_file(self, local_filename, remote_file_id, offset = 0, down_bytes = 0)
  154. '''
  155. Download a file from Storage server.
  156. arguments:
  157. @local_filename: string, local name of file
  158. @remote_file_id: string, file_id of file that is on storage server
  159. @offset: long
  160. @down_bytes: long
  161. @return dict {
  162. 'Remote file_id' : remote_file_id,
  163. 'Content' : local_filename,
  164. 'Download size' : downloaded_size,
  165. 'Storage IP' : storage_ip
  166. }
  167. '''
  168. * download_to_buffer(self, remote_file_id, offset = 0, down_bytes = 0)
  169. '''
  170. Download a file from Storage server and store in buffer.
  171. arguments:
  172. @remote_file_id: string, file_id of file that is on storage server
  173. @offset: long
  174. @down_bytes: long
  175. @return dict {
  176. 'Remote file_id' : remote_file_id,
  177. 'Content' : file_buffer,
  178. 'Download size' : downloaded_size,
  179. 'Storage IP' : storage_ip
  180. }
  181. '''
  182. * list_one_group(self, group_name)
  183. '''
  184. List one group information.
  185. arguments:
  186. @group_name: string, group name will be list
  187. @return Group_info, instance
  188. '''
  189. * list_all_groups(self)
  190. '''
  191. List all group information.
  192. @return dictionary {
  193. 'Groups count' : group_count,
  194. 'Groups' : list of groups
  195. }
  196. '''
  197. * list_servers(self, group_name, storage_ip = None)
  198. '''
  199. List all storage servers information in a group
  200. arguments:
  201. @group_name: string
  202. @return dictionary {
  203. 'Group name' : group_name,
  204. 'Servers' : server list,
  205. }
  206. '''
  207. * get_meta_data(self, remote_file_id)
  208. '''
  209. Get meta data of remote file.
  210. arguments:
  211. @remote_fileid: string, remote file id
  212. @return dictionary, meta data
  213. '''
  214. * set_meta_data(self, remote_file_id, \
  215. meta_dict, op_flag = STORAGE_SET_METADATA_FLAG_OVERWRITE)
  216. '''
  217. Set meta data of remote file.
  218. arguments:
  219. @remote_file_id: string
  220. @meta_dict: dictionary
  221. @op_flag: char, 'O' for overwrite, 'M' for merge
  222. @return dictionary {
  223. 'Status' : status,
  224. 'Storage IP' : storage_ip
  225. }
  226. '''
  227. * append_by_filename(self, local_filename, remote_fileid)
  228. '''
  229. Append a file of Storage server
  230. arguments:
  231. @local_filename: string
  232. @remote_fileid: string
  233. @return dict {
  234. 'Group name' : group_name,
  235. 'Remote file_id' : remote_file_id,
  236. 'Status' : 'Upload successed.',
  237. 'Local file name' : '',
  238. 'Uploaded size' : upload_size,
  239. 'Storage IP' : storage_ip
  240. }
  241. '''
  242. * append_by_buffer(self, file_buffer, remote_fileid)
  243. '''
  244. Append a file of Storage server
  245. arguments:
  246. @file_buffer: string
  247. @remote_fileid: string
  248. @return dict {
  249. 'Group name' : group_name,
  250. 'Remote file_id' : remote_file_id,
  251. 'Status' : 'Upload successed.',
  252. 'Local file name' : '',
  253. 'Uploaded size' : upload_size,
  254. 'Storage IP' : storage_ip
  255. }
  256. '''
  257. * truncate_file(self, truncated_filesize, appender_fileid)
  258. '''
  259. Truncate file in Storage server.
  260. arguments:
  261. @truncated_filesize: long
  262. @appender_fileid: remote_fileid
  263. @return: dictionary {
  264. 'Status' : 'Truncate successed.',
  265. 'Storage IP' : storage_ip
  266. }
  267. '''
  268. * modify_by_filename(self, filename, appender_fileid, offset = 0)
  269. '''
  270. Modify a file in Storage server by filename.
  271. arguments:
  272. @filename: string, local file name
  273. @offset: long, file offset
  274. @appender_fileid: string, remote file id
  275. @return: dictionary {
  276. 'Status' : 'Modify successed.',
  277. 'Storage IP' : storage_ip
  278. }
  279. '''
  280. * modify_by_buffer(self, filebuffer, appender_fileid, offset = 0)
  281. '''
  282. Modify a file in Storage server by buffer.
  283. arguments:
  284. @filebuffer: string, file buffer
  285. @offset: long, file offset
  286. @appender_fileid: string, remote file id
  287. @return: dictionary {
  288. 'Status' : 'Modify successed.',
  289. 'Storage IP' : storage_ip
  290. }
  291. '''
  292. ### Connection Pools
  293. Behind the scenes, fdfs_client-py uses a connection pool to manage connections to
  294. sets of tracker server and storage server.
  295. ## Versioning scheme
  296. fdfs_client-py ver 1.2.0b support client protol of Fastdfs ver 3.08.
  297. Python must be ver 2.6 later.
  298. Author
  299. ------
  300. fdfs_client-py is developed and maintained by scott yuan (scottzer8@gmail.com)
  301. It can be found here: http://github.com/andymccurdy/redis-py
  302. Special thanks to:
  303. * Andy Mccurdy, author of redis-py, referenced his code.
  304. * g.rodola, author sendfile module for python, g.rodola@gmail.com
  305. Keywords: Fastdfs,Distribute File System
  306. Platform: UNKNOWN
  307. Classifier: Development Status :: 1 - Production/Beta
  308. Classifier: Environment :: Console
  309. Classifier: Intended Audience :: Developers
  310. Classifier: License :: GPLV3
  311. Classifier: Operating System :: OS Independent
  312. Classifier: Programming Language :: Python