diff options
author | Tyler Gill <tyler.gill@byu.net> | 2017-09-26 08:19:38 +0300 |
---|---|---|
committer | Tyler Gill <tyler.gill@byu.net> | 2017-09-26 08:19:38 +0300 |
commit | 44c53d3eb17793386bd9593dfb7cd52f3c7b4c00 (patch) | |
tree | a0a53a5a7def0ba34adde22c6de5be6b41f2be51 /Duplicati/Library/Backend/Backblaze/B2.cs | |
parent | b3a3911d98c8e4c4f99a16fd2d531f8e58952b83 (diff) | |
parent | 9141ccfd4155b18aa6a760da4a4cd3f39fa00c03 (diff) |
Merge branch 'master' of https://github.com/duplicati/duplicati into fix/list-ienumerable
Diffstat (limited to 'Duplicati/Library/Backend/Backblaze/B2.cs')
-rw-r--r-- | Duplicati/Library/Backend/Backblaze/B2.cs | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/Duplicati/Library/Backend/Backblaze/B2.cs b/Duplicati/Library/Backend/Backblaze/B2.cs index 682e05e23..5b8838eab 100644 --- a/Duplicati/Library/Backend/Backblaze/B2.cs +++ b/Duplicati/Library/Backend/Backblaze/B2.cs @@ -27,17 +27,19 @@ namespace Duplicati.Library.Backend.Backblaze public class B2 : IBackend, IStreamingBackend
{
private const string B2_ID_OPTION = "b2-accountid";
- private const string B2_KEY_OPTION = "b2-applicationkey";
-
- private const string B2_CREATE_BUCKET_TYPE_OPTION = "b2-create-bucket-type";
+ private const string B2_KEY_OPTION = "b2-applicationkey"; + private const string B2_PAGESIZE_OPTION = "b2-page-size"; + + private const string B2_CREATE_BUCKET_TYPE_OPTION = "b2-create-bucket-type";
private const string DEFAULT_BUCKET_TYPE = "allPrivate";
- private const int PAGE_SIZE = 200;
+ private const int DEFAULT_PAGE_SIZE = 500;
private string m_bucketname;
private string m_prefix;
private string m_urlencodedprefix;
private string m_bucketType;
+ private int m_pagesize;
private B2AuthHelper m_helper;
private UploadUrlResponse m_uploadUrl;
@@ -89,9 +91,18 @@ namespace Duplicati.Library.Backend.Backblaze throw new UserInformationException(Strings.B2.NoB2UserIDError);
if (string.IsNullOrEmpty(accountKey))
throw new UserInformationException(Strings.B2.NoB2KeyError);
+
+ m_helper = new B2AuthHelper(accountId, accountKey); + + m_pagesize = DEFAULT_PAGE_SIZE; + if (options.ContainsKey(B2_PAGESIZE_OPTION))
+ {
+ int.TryParse(options[B2_PAGESIZE_OPTION], out m_pagesize);
- m_helper = new B2AuthHelper(accountId, accountKey);
- }
+ if (m_pagesize <= 0)
+ throw new UserInformationException(Strings.B2.InvalidPageSizeError(B2_PAGESIZE_OPTION, options[B2_PAGESIZE_OPTION]));
+ }
+ }
private BucketEntity Bucket
{
@@ -152,8 +163,9 @@ namespace Duplicati.Library.Backend.Backblaze new CommandLineArgument(B2_KEY_OPTION, CommandLineArgument.ArgumentType.Password, Strings.B2.B2applicationkeyDescriptionShort, Strings.B2.B2applicationkeyDescriptionLong, null, new string[] {"auth-username"}, null),
new CommandLineArgument("auth-password", CommandLineArgument.ArgumentType.Password, Strings.B2.AuthPasswordDescriptionShort, Strings.B2.AuthPasswordDescriptionLong),
new CommandLineArgument("auth-username", CommandLineArgument.ArgumentType.String, Strings.B2.AuthUsernameDescriptionShort, Strings.B2.AuthUsernameDescriptionLong),
- new CommandLineArgument(B2_CREATE_BUCKET_TYPE_OPTION, CommandLineArgument.ArgumentType.String, Strings.B2.B2createbuckettypeDescriptionShort, Strings.B2.B2createbuckettypeDescriptionLong, DEFAULT_BUCKET_TYPE),
- });
+ new CommandLineArgument(B2_CREATE_BUCKET_TYPE_OPTION, CommandLineArgument.ArgumentType.String, Strings.B2.B2createbuckettypeDescriptionShort, Strings.B2.B2createbuckettypeDescriptionLong, DEFAULT_BUCKET_TYPE), + new CommandLineArgument(B2_PAGESIZE_OPTION, CommandLineArgument.ArgumentType.Integer, Strings.B2.B2pagesizeDescriptionShort, Strings.B2.B2pagesizeDescriptionLong, DEFAULT_PAGE_SIZE.ToString()), + });
}
}
@@ -297,7 +309,7 @@ namespace Duplicati.Library.Backend.Backblaze string.Format("{0}/b2api/v1/b2_list_file_versions", m_helper.APIUrl),
new ListFilesRequest() {
BucketID = Bucket.BucketID,
- MaxFileCount = PAGE_SIZE,
+ MaxFileCount = m_pagesize,
StartFileID = nextFileID,
StartFileName = nextFileName
}
|