aboutsummaryrefslogtreecommitdiff
path: root/src/palhm/mod/aws.py
diff options
context:
space:
mode:
authorDavid Timber <dxdt@dev.snart.me>2022-09-26 17:24:21 +0800
committerDavid Timber <dxdt@dev.snart.me>2022-09-27 05:26:33 +0800
commit6789c980678f46a602d9f82bfc0ec2a3d52a645e (patch)
treebe5dbbcd78c5f6b05cfa7ed3c2e10db5d3eefb4f /src/palhm/mod/aws.py
parenteb485502b7941b486358c3cdabefdaefeff7843e (diff)
Fix bugs - AWS S3 backend large files
- Added 'alloc-size' for aws large file upload and localfs preallocation - Added 'block-size' for localfs(implemented) - Updated docs - Fix bug in localfs str() op
Diffstat (limited to 'src/palhm/mod/aws.py')
-rw-r--r--src/palhm/mod/aws.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/palhm/mod/aws.py b/src/palhm/mod/aws.py
index 725861d..3e7c2b4 100644
--- a/src/palhm/mod/aws.py
+++ b/src/palhm/mod/aws.py
@@ -25,7 +25,7 @@ from typing import Callable, Iterable
import boto3
import botocore
-from palhm import MUA, BackupBackend, Exec, GlobalContext
+from palhm import MUA, BackupBackend, BackupObject, Exec, GlobalContext
from palhm.exceptions import APIFailError
@@ -202,7 +202,7 @@ class S3BackupBackend (BackupBackend):
def close (self, ctx: GlobalContext):
self._cleanup_multiparts(ctx)
- def sink (self, ctx: GlobalContext, path: str) -> Exec:
+ def sink (self, ctx: GlobalContext, bo) -> Exec:
l = self._logger(ctx)
e = Exec()
@@ -214,10 +214,12 @@ class S3BackupBackend (BackupBackend):
"--only-show-errors" ]
if self.sc_sink:
e.argv.append("--storage-class=" + self.sc_sink)
- e.argv.extend(["-", "/".join([self.cur_backup_uri, path])])
+ if bo.alloc_size is not None:
+ e.argv.append("--expected-size=" + str(bo.alloc_size))
+ e.argv.extend(["-", "/".join([self.cur_backup_uri, bo.path])])
l.debug("sink: " + str(e))
- self.sink_list.append(mks3objkey([self.cur_backup_key, path]))
+ self.sink_list.append(mks3objkey([self.cur_backup_key, bo.path]))
return e