Ejemplo n.º 1
0
class FileSystem(object, Referenceable):
    """ An ipc interface to the FileSystem Manager. """

    __metaclass__ = RemoteMeta

    # calls that will be accessible remotely
    remote_calls = [
        'get_metadata',
        'get_metadata_by_node',
        'get_metadata_and_quick_tree_synced',
        'get_dirty_nodes',
    ]

    def __init__(self, fs_manager, action_queue):
        """ Creates the instance. """
        super(FileSystem, self).__init__()
        self.syncdaemon_filesystem = SyncdaemonFileSystem(fs_manager,
            action_queue)

    def get_metadata(self, path):
        """Return the metadata (as a dict) for the specified path."""
        logger.debug('get_metadata by path: %r', path)
        return self.syncdaemon_filesystem.get_metadata(path)

    def get_metadata_by_node(self, share_id, node_id):
        """Return the metadata (as a dict) for the specified share/node."""
        logger.debug('get_metadata by share: %r  node: %r', share_id, node_id)
        return self.syncdaemon_filesystem.get_metadata_by_node(share_id,
                                                               node_id)

    def get_metadata_and_quick_tree_synced(self, path):
        """ returns the dict with the attributes of the metadata for
        the specified path, including the quick subtree status.
        """
        logger.debug('get_metadata_and_quick_tree_synced: %r', path)
        return self.syncdaemon_filesystem.get_metadata_and_quick_tree_synced(
            path)

    def get_dirty_nodes(self):
        """Return a list of dirty nodes."""
        return self.syncdaemon_filesystem.get_dirty_nodes()
Ejemplo n.º 2
0
 def __init__(self, fs_manager, action_queue):
     """ Creates the instance. """
     super(FileSystem, self).__init__()
     self.syncdaemon_filesystem = SyncdaemonFileSystem(fs_manager,
         action_queue)