Ejemplo n.º 1
0
    def GetFileEntryByPathSpec(self, path_spec):
        """Retrieves a file entry for a path specification.

    Args:
      path_spec (PathSpec): path specification.

    Returns:
      VShadowFileEntry: file entry or None if not available.
    """
        store_index = vshadow.VShadowPathSpecGetStoreIndex(path_spec)

        # The virtual root file has not corresponding store index but
        # should have a location.
        if store_index is None:
            location = getattr(path_spec, 'location', None)
            if location is None or location != self.LOCATION_ROOT:
                return
            return vshadow_file_entry.VShadowFileEntry(self._resolver_context,
                                                       self,
                                                       path_spec,
                                                       is_root=True,
                                                       is_virtual=True)

        if store_index < 0 or store_index >= self._vshadow_volume.number_of_stores:
            return
        return vshadow_file_entry.VShadowFileEntry(self._resolver_context,
                                                   self, path_spec)
Ejemplo n.º 2
0
  def testIntialize(self):
    """Test the __init__ function."""
    file_entry = vshadow_file_entry.VShadowFileEntry(
        self._resolver_context, self._file_system, self._vshadow_path_spec,
        is_virtual=True)

    self.assertIsNotNone(file_entry)
Ejemplo n.º 3
0
  def testIntialize(self):
    """Test the initialize functionality."""
    file_entry = vshadow_file_entry.VShadowFileEntry(
        self._resolver_context, self._file_system, self._vshadow_path_spec)

    self.assertIsNotNone(file_entry)