示例#1
0
    def save(self, handler, filepath):
        """
        Save a stream given as handler to filepath.

        :param handler: Incoming stream.
        :type handler: file
        :param filepath: Save stream as this name.
        :type filepath: str
        """
        raise TwinDBBackupInternalError(
            "Method save() is not implemented in %s" % self.__class__)
示例#2
0
    def write(self, content, filepath):
        """
        Write ``content`` to a file.

        :param content: Content to write to the file.
        :type content: str
        :param filepath: Relative path to file.
        :type filepath: str
        """
        raise TwinDBBackupInternalError(
            "Method write() is not implemented in %s" % self.__class__)
示例#3
0
    def read(self, filepath):
        """
        Read content of a file path from destination.

        :param filepath: Relative path to file.
        :type filepath: str
        :return: Content of the file.
        :rtype: str
        """
        raise TwinDBBackupInternalError(
            "Method read() is not implemented in %s" % self.__class__)
示例#4
0
def share(twindb_config, s3_url):
    """
    Function for generate make public file and get public url

    :param twindb_config: tool configuration
    :type twindb_config: TwinDBBackupConfig
    :param s3_url: S3 url to file
    :type s3_url: str
    :raise: TwinDBBackupError
    """
    try:
        print(twindb_config.destination().share(s3_url))
    except NotImplementedError as err:
        raise TwinDBBackupInternalError(err) from err