Exemple #1
0
    def streaming_copy(self, **kwargs):
        """copy from one endpoint to another without touching a disk"""
        source = kwargs.get("subject", None)
        dest = kwargs.get("target", None)
        dest_profile = kwargs.get("destination", None)
        force = kwargs.get("force", None)
        verify = kwargs.get("verify", False)
        dry_run = kwargs.get("dry_run", False)
        if not source:
            raise RadulaError("missing source bucket/key")
        if not dest:
            raise RadulaError("missing destination bucket/key")

        self.lib.thread_count = int(kwargs.get("threads"))
        chunk_size = kwargs.get("chunk_size", None)
        if chunk_size:
            self.lib.chunk_size = from_human_size(chunk_size,
                                                  minimum=RadulaLib.MIN_CHUNK)

        self.lib.streaming_copy(source,
                                dest,
                                dest_profile=dest_profile,
                                force=force,
                                verify=verify,
                                dry_run=dry_run)
Exemple #2
0
    def streaming_copy(self, **kwargs):
        """copy from one endpoint to another without touching a disk"""
        source = kwargs.get("subject", None)
        dest = kwargs.get("target", None)
        dest_profile = kwargs.get("destination", None)
        force = kwargs.get("force", None)
        verify = kwargs.get("verify", False)
        dry_run = kwargs.get("dry_run", False)
        if not source:
            raise RadulaError("missing source bucket/key")
        if not dest:
            raise RadulaError("missing destination bucket/key")

        self.lib.thread_count = int(kwargs.get("threads"))
        chunk_size = kwargs.get("chunk_size", None)
        if chunk_size:
            self.lib.chunk_size = from_human_size(chunk_size,
                                                  minimum=RadulaLib.MIN_CHUNK)

        self.lib.streaming_copy(source,
                                dest,
                                dest_profile=dest_profile,
                                force=force,
                                verify=verify,
                                dry_run=dry_run)
Exemple #3
0
    def download(self, **kwargs):
        """download remote subject to a local target file"""
        subject = kwargs.get("subject", None)
        target = kwargs.get("target", None)
        verify = kwargs.get("verify", False)
        force = kwargs.get("force", False)
        dry_run = kwargs.get("dry_run", False)
        ignore_existing = kwargs.get("ignore_existing", False)
        preserve_key = kwargs.get("preserve_key", False)

        if not subject:
            raise RadulaError("Missing file(s) to download")

        threads = int(kwargs.get("threads", RadulaLib.DEFAULT_THREADS))
        self.lib.thread_count = threads
        chunk_size = kwargs.get("chunk_size", None)
        if chunk_size:
            self.lib.chunk_size = from_human_size(chunk_size,
                                                  minimum=RadulaLib.MIN_CHUNK)

        self.lib.download(subject,
                          target,
                          verify=verify,
                          force=force,
                          dry_run=dry_run,
                          ignore_existing=ignore_existing,
                          preserve_key=preserve_key)
Exemple #4
0
    def upload(self, **kwargs):
        """initiate a multipart upload. See README for complete usage"""
        subject = kwargs.get("subject", None)
        target = kwargs.get("target", None)
        verify = kwargs.get("verify", False)
        resume = kwargs.get("resume", False)
        force = kwargs.get("force", False)
        dry_run = kwargs.get("dry_run", False)
        encrypt = kwargs.get("encrypt", None)
        ignore_existing = kwargs.get("ignore_existing", False)
        if not subject:
            raise RadulaError("Missing file(s) to upload")
        if not target:
            raise RadulaError("Missing bucket/key target")

        self.lib.thread_count = int(kwargs.get("threads"))
        chunk_size = kwargs.get("chunk_size", None)
        if chunk_size:
            self.lib.chunk_size = from_human_size(chunk_size,
                                                  minimum=RadulaLib.MIN_CHUNK)
        self.lib.upload(subject,
                        target,
                        verify=verify,
                        resume=resume,
                        force=force,
                        dry_run=dry_run,
                        encrypt=encrypt,
                        ignore_existing=ignore_existing)
Exemple #5
0
    def cat(self, **kwargs):
        source = kwargs.get("subject", None)
        if not source:
            raise RadulaError("missing source bucket/key")

        chunk_size = kwargs.get("chunk_size", None)
        if chunk_size:
            chunk_size = from_human_size(chunk_size,
                                         bounds=False,
                                         accept_range=True)

        self.lib.cat(source, chunk_size=chunk_size)
Exemple #6
0
    def local_md5(self, **kwargs):
        """performs a multithreaded hash of a local subject file"""
        subject = kwargs.get("subject", None)
        if not subject:
            raise RadulaError("Missing local subject file")

        self.lib.thread_count = int(kwargs.get("threads"))
        chunk_size = kwargs.get("chunk_size", None)
        if chunk_size:
            self.lib.chunk_size = from_human_size(chunk_size,
                                                  minimum=RadulaLib.MIN_CHUNK)
        print self.lib.local_md5(subject)
Exemple #7
0
    def cat(self, **kwargs):
        source = kwargs.get("subject", None)
        if not source:
            raise RadulaError("missing source bucket/key")

        chunk_size = kwargs.get("chunk_size", None)
        if chunk_size:
            chunk_size = from_human_size(chunk_size,
                                         bounds=False,
                                         accept_range=True)

        self.lib.cat(source, chunk_size=chunk_size)
Exemple #8
0
    def local_md5(self, **kwargs):
        """performs a multithreaded hash of a local subject file"""
        subject = kwargs.get("subject", None)
        if not subject:
            raise RadulaError("Missing local subject file")

        self.lib.thread_count = int(kwargs.get("threads"))
        chunk_size = kwargs.get("chunk_size", None)
        if chunk_size:
            self.lib.chunk_size = from_human_size(chunk_size,
                                                  minimum=RadulaLib.MIN_CHUNK)
        print self.lib.local_md5(subject)
Exemple #9
0
    def verify(self, **kwargs):
        """compares hashes of a local subject and a remote target"""
        subject = kwargs.get("subject", None)
        target = kwargs.get("target", None)
        if not subject:
            raise RadulaError("Missing local subject to compare")
        if not target:
            raise RadulaError("Missing remote target to compare")

        self.lib.thread_count = int(kwargs.get("threads"))
        chunk_size = kwargs.get("chunk_size", None)
        if chunk_size:
            self.lib.chunk_size = from_human_size(chunk_size,
                                                  minimum=RadulaLib.MIN_CHUNK)
        if not self.lib.verify(subject, target):
            exit(1)
Exemple #10
0
    def verify(self, **kwargs):
        """compares hashes of a local subject and a remote target"""
        subject = kwargs.get("subject", None)
        target = kwargs.get("target", None)
        if not subject:
            raise RadulaError("Missing local subject to compare")
        if not target:
            raise RadulaError("Missing remote target to compare")

        self.lib.thread_count = int(kwargs.get("threads"))
        chunk_size = kwargs.get("chunk_size", None)
        if chunk_size:
            self.lib.chunk_size = from_human_size(chunk_size,
                                                  minimum=RadulaLib.MIN_CHUNK)
        if not self.lib.verify(subject, target):
            exit(1)
Exemple #11
0
    def download(self, **kwargs):
        """download remote subject to a local target file"""
        subject = kwargs.get("subject", None)
        target = kwargs.get("target", None)
        verify = kwargs.get("verify", False)
        force = kwargs.get("force", False)
        dry_run = kwargs.get("dry_run", False)

        if not subject:
            raise RadulaError("Missing file(s) to download")

        threads = int(kwargs.get("threads", RadulaLib.DEFAULT_THREADS))
        self.lib.thread_count = threads
        chunk_size = kwargs.get("chunk_size", None)
        if chunk_size:
            self.lib.chunk_size = from_human_size(chunk_size,
                                                  minimum=RadulaLib.MIN_CHUNK)

        self.lib.download(subject, target, verify=verify,
                          force=force, dry_run=dry_run)
Exemple #12
0
    def upload(self, **kwargs):
        """initiate a multipart upload. See README for complete usage"""
        subject = kwargs.get("subject", None)
        target = kwargs.get("target", None)
        verify = kwargs.get("verify", False)
        resume = kwargs.get("resume", False)
        force = kwargs.get("force", False)
        dry_run = kwargs.get("dry_run", False)
        if not subject:
            raise RadulaError("Missing file(s) to upload")
        if not target:
            raise RadulaError("Missing bucket/key target")

        self.lib.thread_count = int(kwargs.get("threads"))
        chunk_size = kwargs.get("chunk_size", None)
        if chunk_size:
            self.lib.chunk_size = from_human_size(chunk_size,
                                                  minimum=RadulaLib.MIN_CHUNK)
        self.lib.upload(subject, target, verify=verify,
                        resume=resume, force=force, dry_run=dry_run)