Trees | Indices | Help |
---|
|
1 # -*- Mode: Python -*- 2 # vi:si:et:sw=4:sts=4:ts=4 3 # 4 # Flumotion - a streaming media server 5 # Copyright (C) 2008 Fluendo, S.L. (www.fluendo.com). 6 # All rights reserved. 7 8 # This file may be distributed and/or modified under the terms of 9 # the GNU General Public License version 2 as published by 10 # the Free Software Foundation. 11 # This file is distributed without any warranty; without even the implied 12 # warranty of merchantability or fitness for a particular purpose. 13 # See "LICENSE.GPL" in the source distribution for more information. 14 15 # Licensees having purchased or holding a valid Flumotion Advanced 16 # Streaming Server license may use this file in accordance with the 17 # Flumotion Advanced Streaming Server Commercial License Agreement. 18 # See "LICENSE.Flumotion" in the source distribution for more information. 19 20 # Headers in this file shall remain intact. 21 22 """Virtual File System API. 23 This module contains the API used to invoke the virtual file system. 24 The virtual file system is a simple way of listing files, directories 25 and their metadata. 26 It's designed to be used over twisted.spread and is thus using deferreds. 27 """ 28 29 from twisted.internet.defer import succeed 30 31 from flumotion.common import log 32 33 _backends = [] 34 3537 """List the directory called path 38 @returns: the directory 39 @rtype: deferred that will fire an object implementing L{IDirectory} 40 """ 41 global _backends 42 if not _backends: 43 _registerBackends() 44 if not _backends: 45 raise AssertionError( 46 "there are no vfs backends available") 47 backend = _backends[0] 48 log.info('vfs', 'listing directory %s using %r' % (path, backend)) 49 directory = backend(path) 50 directory.cacheFiles() 51 return succeed(directory)52 5355 global _backends 56 for backend, attributeName in [ 57 ('flumotion.common.vfsgio', 'GIODirectory'), 58 ('flumotion.common.vfsgnome', 'GnomeVFSDirectory'), 59 ]: 60 try: 61 module = __import__(backend, {}, {}, ' ') 62 except ImportError: 63 log.info('vfs', 'skipping backend %s, dependency missing' % ( 64 backend, )) 65 continue 66 67 log.info('vfs', 'adding backend %s' % (backend, )) 68 backend = getattr(module, attributeName) 69 try: 70 backend('/') 71 except ImportError: 72 continue 73 _backends.append(backend) 74 75 registerVFSJelly()76 7779 """Register the jelly used by different backends 80 """ 81 82 from flumotion.common.vfsgnome import registerGnomeVFSJelly 83 registerGnomeVFSJelly() 84 85 from flumotion.common.vfsgio import registerGIOJelly 86 registerGIOJelly() 87 88 log.info('jelly', 'VFS registered')89
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Sat Mar 13 05:17:23 2010 | http://epydoc.sourceforge.net |