Ensure S3 provider specific quirks

This commit is contained in:
Johannes Zellner
2025-02-13 14:40:34 +01:00
parent dd5e4adc73
commit 2617fcdcfd

View File

@@ -1,6 +1,6 @@
<script setup>
import { ref, useTemplateRef, onMounted, computed } from 'vue';
import { ref, useTemplateRef, onMounted, computed, watch } from 'vue';
import { Dialog, Dropdown, FormGroup, TextInput, Checkbox, PasswordInput, NumberInput } from 'pankow';
import { prettyBinarySize } from 'pankow/utils';
// TODO REGIONS_UPCLOUD is not used??
@@ -36,7 +36,7 @@ const format = ref('rsync');
const encryptionPassword = ref('');
const encryptedFilenames = ref(false);
const memoryLimit = ref(minMemoryLimit.value);
const uploadPartSize = ref(1024*1024);
const uploadPartSize = ref(10*1024*1024);
const syncConcurrency = ref(10);
const downloadConcurrency = ref(10);
const copyConcurrency = ref(10);
@@ -218,6 +218,18 @@ const isValid = computed(() => {
return true;
});
watch(provider, (newProvider) => {
console.log('provider change', newProvider)
if (newProvider === 'scaleway-objectstorage') {
// scaleway only supports 1000 parts per object (https://www.scaleway.com/en/docs/s3-multipart-upload/)
if (parseInt(uploadPartSize.value) < 100 * 1024 * 1024) uploadPartSize.value = 100 * 1024 * 1024;
} else if (newProvider === 's3') {
if (parseInt(downloadConcurrency.value) < 30) downloadConcurrency.value = 30;
if (parseInt(syncConcurrency.value) < 20) syncConcurrency.value = 20;
if (parseInt(copyConcurrency.value) < 500) downloadConcurrency.value = 500;
}
});
onMounted(async () => {
await getBlockDevices();
await getMemory();
@@ -237,7 +249,7 @@ defineExpose({
backupFolder.value = result.backupFolder;
useHardlinks.value = !result.noHardlinks;
memoryLimit.value = result.limits.memoryLimit || minMemoryLimit.value;
uploadPartSize.value = result.limits.uploadPartSize || (1024*1024);
uploadPartSize.value = result.limits.uploadPartSize || (10*1024*1024);
syncConcurrency.value = result.limits.syncConcurrency || 10;
downloadConcurrency.value = result.limits.downloadConcurrency || 10;
copyConcurrency.value = result.limits.copyConcurrency || 10;
@@ -475,9 +487,9 @@ defineExpose({
<FormGroup v-if="s3like(provider)">
<label for="uploadPartSizeInput">{{ $t('backups.configureBackupStorage.uploadPartSize') }}: <b>{{ prettyBinarySize(uploadPartSize, 'Default (50 MiB)') }}</b></label>
<p class="small">{{ $t('backups.configureBackupStorage.uploadPartSizeDescription') }}</p>
<input type="range" id="uploadPartSizeInput" v-model="uploadPartSize" list="uploadPartSizeTicks" :step="1024*1024" :min="1024*1024" :max="1024*1024*1024" />
<input type="range" id="uploadPartSizeInput" v-model="uploadPartSize" list="uploadPartSizeTicks" :step="1024*1024" :min="10*1024*1024" :max="1024*1024*1024" />
<datalist id="uploadPartSizeTicks">
<option :value="1024*1024"></option>
<option :value="1024*1024*10"></option>
<option :value="1024*1024*64"></option>
<option :value="1024*1024*128"></option>
<option :value="1024*1024*256"></option>