Exemple #1
0
 def __init__(self, vofs, path):
     super(MyIOProxy, self).__init__()
     self.vofs = vofs
     # This is the vos.VOFile object last used
     self.lastVOFile = None
     self.size = None
     self.md5 = None
     self.path = path
     self.condition = CacheCondition(None)
Exemple #2
0
    def __init__(self,
                 root,
                 cache_dir,
                 options,
                 conn=None,
                 cache_limit=1024,
                 cache_nodes=False,
                 cache_max_flush_threads=10,
                 secure_get=False):
        """Initialize the VOFS.

        cache_limit is in MB.
        The style here is to use dictionaries to contain information
        about the Node.  The full VOSpace path is used as the Key for
        most of these dictionaries."""

        self.cache_nodes = cache_nodes

        # Standard attributes of the Node
        # Where in the file system this Node is currently located
        self.loading_dir = {}

        # Command line options.
        self.opt = options

        # What is the 'root' of the VOSpace? (eg vos:MyVOSpace)
        self.root = root

        # VOSpace is a bit slow so we do some caching.
        self.cache = Cache(cache_dir,
                           cache_limit,
                           False,
                           VOFS.cacheTimeout,
                           maxFlushThreads=cache_max_flush_threads)

        # All communication with the VOSpace goes through this client
        # connection.
        try:
            # MJG
            self.client = vos.Client(rootNode=root, conn=conn)
#            ,
#                                     cadc_short_cut=True, secure_get=secure_get)
        except Exception as e:
            e = FuseOSError(getattr(e, 'errno', EIO))
            e.filename = root
            e.strerror = getattr(e, 'strerror', 'failed while making mount')
            raise e

        # Create a condition variable to get rid of those nasty sleeps
        self.condition = CacheCondition(lock=None, timeout=VOFS.cacheTimeout)