Snapshot Manager

Funcionalidad

El módulo Snapshot Manager se relaciona con Scheduler. Scheduler indica qué archivos o carpetas han cambiado y el tipo de operación ocurrida para que Snapshot Manager realiza el snapshot del sistema convenientemente. También se ralacciona con Database para poder implementar el snapshot en forma de transacción.

Relaciones

Snapshot Manager se relaciona directamente con Scheduler y Database e indirectamente sirve a la interfaz gráfica para proporcionar cualquier información de interés acerca de un snapshot o la historia de un archivo.

Documentación

Especificación del formato de snapshot
Manual del módulo en PDF

API Interna

Esta es una fracción de la API actual de BackendProxy que resume la funcionalidad ofrecida por SnapshotManager.

BackendProxy.py

    ##@brief Recover a snapshot to an especify path
    #
    #@param snapTimestamp timestamp of the snapshot to recover
    #@param recoverPath path where place recovered files
    #@return actual recover path where snapshot had been recovered
    @dbus.service.method(dbus_interface='com.hdlorean.Snapshot',in_signature='xs', out_signature='s')
    def recoverSnapshot(self, snapTimestamp, recoverPath):
        return self.__snap.recoverSnapshot(snapTimestamp, recoverPath)
 
    ##@brief Recover a file or a directory to a specific path
    #
    #@param snapTimestamp max timestamp for the file or directory to recover
    #@param originalPathList path of the file(s) (all with the same parent directory) or directory to recover
    #@param recoverPath place where recovered file(s) are placed
    #@return actual recover path where files(s) are recovered
    @dbus.service.method(dbus_interface='com.hdlorean.Snapshot',in_signature='xass', out_signature='s')
    def recoverBackups(self, snapTimestamp, originalPathList, recoverPath):
        return self.__snap.recoverSnapshot(snapTimestamp, originalPathList, recoverPath)
 
    ##@brief Get a list of contents of a directory
    #
    #@param snapTimestamp timestamp of the snapshot 
    #@param path path of the directory to list
    #@return a list of tuples with file name (string), file path (string), monitorized indicator (boolean), file permissions (octal integer), file size (integer), last operation date (string), last operation (string), backup performed (integral, differential, directory, not necesary), file type (F for files or D for directories) and number of backups
    # If file was not monitorized then, info after monitorized indicator is None and monitorized indicator is False.
    @dbus.service.method(dbus_interface='com.hdlorean.Snapshot',in_signature='xs', out_signature='a(ssbxxssssx)')
    def getDirList(self, snapTimestamp, path):
        return self.__snap.getDirList(snapTimestamp,path)
 
    ##@brief Get a list of contents of a directory along all of the time line
    #
    #@param path path of the directory to list
    #@return a list of tuples with paths inside the directory and type of the path ('F' for a file or 'D' for a directory)
    @dbus.service.method(dbus_interface='com.hdlorean.Snapshot',in_signature='s', out_signature='a(ss)')
    def getCompleteDirList(self, path):
        return self.__snap.getCompleteDirList(path)
 
    ##@brief Get info about a file at some time
    #
    # Note that file can be a directory but then, it will be treated like a file
    #
    #@param snapTimestamp timestamp of the snapshot 
    #@param path path of file or directory 
    #@return a tuple with file name (string), file path (string), monitorized indicator (boolean), file permissions (octal integer), file size (integer), last operation date (string), last operation (string), backup performed (integral, differential, directory, not necesary), file type (F for files or D for directories) and number of backups
    # For each tuple, if file or directory was not monitorized then, info after monitorized indicator is 0 or '' and monitorized indicator is False.
    @dbus.service.method(dbus_interface='com.hdlorean.Snapshot',in_signature='xs', out_signature='ssbxxssssx')
    def getFileInfo(self, snapTimestamp, path):
        return self.__snap.getFileInfo(int(snapTimestamp),path)
 
    ##@brief Gets the backup historical for a path
    #
    # The historical of a path is a list with all operations tracked over the path. Time line includes
    # util info like size or perms in that moment.
    #
    #@param path path of file or directory 
    #@return a list of tuples  file name (string), file path (string), monitorized indicator (boolean),
    # file permissions (octal integer), file size (integer), last operation date (string), last operation (string), backup performed (integral, differential, directory, not necesary),
    # file type (F for files or D for directories) and number of backups ordered by the most recent backup to the first backup
    @dbus.service.method(dbus_interface='com.hdlorean.Snapshot',in_signature='s', out_signature='a(ssbxxssssx)')
    def getHistorical(self, path): 
        return self.__snap.getHistorical(path)
 
    ##@brief It returns the most recent snapshot timestamp
    #
    #@return the most recent snapshot timestamp or 0 there are no snapshots performed            
    @dbus.service.method(dbus_interface='com.hdlorean.Snapshot',in_signature='', out_signature='x')
    def lastTimestamp(self):
        return self.__snap.lastTimestamp()
 
    ##@brief It returns the very first snapshot timestamp
    #
    #@return the very first snapshot timestamp or 0 there are no snapshots performed
    @dbus.service.method(dbus_interface='com.hdlorean.Snapshot',in_signature='', out_signature='x')
    def firstTimestamp(self):
        return self.__snap.firstTimestamp()
 
    ##@brief It returns the inmediatly previous snapshot timestamp of another
    #
    #@param snapTimestamp reference timestamp
    #@return the inmediatly previous snapshot timestamp of another or None if it does not exist    
    @dbus.service.method(dbus_interface='com.hdlorean.Snapshot',in_signature='x', out_signature='x')
    def prevTimestamp(self, snapTimestamp):
        return self.__snap.prevTimestamp(snapTimestamp)
 
    ##@brief It returns the inmediatly next snapshot timestamp of another
    #
    #@param snapTimestamp reference timestamp 
    #@return the inmediatly next snapshot timestamp of another or None if it does not exist
    @dbus.service.method(dbus_interface='com.hdlorean.Snapshot',in_signature='x', out_signature='x')
    def nextTimestamp(self, snapTimestamp):
        return self.__snap.nextTimestamp(snapTimestamp)
 
    ##@brief It returns a list of timestamps between two bounds
    #
    #@param startSnapTimestamp low snapshot bound. It can be None to reference the first timestamp
    #@param stopSnapTimestamp hight snapshot bound. It can be None to reference the last timestamp
    #@return a list of timestamps between two bounds
    @dbus.service.method(dbus_interface='com.hdlorean.Snapshot',in_signature='xx', out_signature='ax')
    def getTimestampsBetween(self,startSnapTimestamp,endSnapTimestamp):
        return self.__snap.getTimestampsBetween(startSnapTimestamp,endSnapTimestamp)
 
    ##@brief It returns a list of all timestamps from one given
    #
    #@param startSnapTimestamp snapshto timestamp to search from
    #@return a list of all timestamps from one given
    @dbus.service.method(dbus_interface='com.hdlorean.Snapshot',in_signature='x', out_signature='ax')
    def getTimestampsFrom(self,startSnapTimestamp):
        return self.__snap.getTimestampsBetween(startSnapTimestamp,None)
 
    ##@brief It returns a list of all timestamps until one given
    #
    #@param stopSnapTimestamp snapshto timestamp to search until
    #@return a list of all timestamps until one given
    @dbus.service.method(dbus_interface='com.hdlorean.Snapshot',in_signature='x', out_signature='ax')
    def getTimestampsUntil(self,endSnapTimestamp):
        return self.__snap.getTimestampsBetween(None,endSnapTimestamp)
 
    ##@brief It returns a list of all timestamps
    #
    #@return a list of all timestamps between two bounds
    @dbus.service.method(dbus_interface='com.hdlorean.Snapshot',in_signature='', out_signature='ax')
    def getAllTimestamps(self):
        return self.__snap.getTimestampsBetween(None,None)
 
    ##@brief Given a timestamp in history, the method returns a human readable string for it
    #
    #@param snapTimestamp timestamp to convert into
    #@return a human readable string for timestamp given or the string 'never' if timestamp is not in history
    @dbus.service.method(dbus_interface='com.hdlorean.Snapshot',in_signature='x', out_signature='s')
    def getHumanTimestamp(self,snapTimestamp):
        return self.__snap.getHumanTimestamp(snapTimestamp)

Equipo

  • David
  • Fede
  • Mario
  • Salva
  • Diana

Planificación

Extendiendo la funcionalidad del sistema de snapshots.

David

Terminados

  • Traducir el wrapper abandonado de xdelta (snapshot-core) a python
  • Arreglar posibles fallitos de History y ampliar funcionalidad

Corto plazo

  1. Arreglar posibles fallitos de History y ampliar funcionalidad

Medio plazo

Largo plazo


Fede

Terminados

  • Especificar junto con Salva el formato de backups.
  • Detectar todos los fallos o excepciones que pudieran ocurrir durante la ejecución del módulo Snapshot Manager y definir una jerarquía de excepciones

Corto plazo

  1. Añadir la funcionalidad a SnapshotManager: getAtemporalDirList (o similar) que devuelve todo el contenido de una carpeta que puediera haber tenido a lo laro del tiempo

Medio plazo

  1. Mejorar la gestión de recuperación de backups para que sea thread safe y no deje colgado por la respuesta a DBUS

Largo plazo


Mario

Terminados

  1. Revisar la documentación del módulo Snapshot Core poniendo especial énfasis sobre la especificación de snapshots.

Corto plazo

  1. Realizar la consola

Medio plazo

Largo plazo


Diana

Terminados

  • Decorar los métodos nuevos de BackendProxy

Corto plazo

Medio plazo

Largo plazo


Salva

Terminados

  • Actualizar el informe de investigación para que refleje los nuevos conocimientos
  • Implementar símbolos de debug y un logger
  • Especificar junto con Fede el formato de backups.
  • Asegurar la triada crear un snapshot, recuperar un fichero o directorio y recuperar un snapshot para febrero.

Corto plazo

  • Proporcionar la funcionalidad faltante

Medio plazo

  1. Estudiar cómo tratar los eventos mover y renombrar para mejorar su eficiencia.

Largo plazo

Launchpad

Página en launchpad

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License