Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding storeLargeFileFromLocalContentAsync method to B2StorageClient #145

Merged
merged 7 commits into from
Feb 12, 2021

Conversation

malaysf
Copy link
Contributor

@malaysf malaysf commented Feb 3, 2021

This behaves like storeLargeFileFromLocalContent but returns a cancellable future which will prevent additional tasks from starting and attempt to cancel in-progress API calls.

Addresses #16

This behaves like `storeLargeFileFromLocalContent` but returns a cancellable future which will prevent additional tasks from starting and attempt to cancel in-progress API calls.

Addresses #16
Copy link
Contributor

@certainmagic certainmagic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so far, i've just written some nitpicks. still letting the overall thing sink in. (and i skimmed the completion stuff.)

Copy link
Contributor

@certainmagic certainmagic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks. these seem like good improvements. :)

i'm wondering if we can/should have an example use somewhere -- as a javadoc comment somewhere? in B2Sample? in our README? not sure where.

Copy link

@tiwijo tiwijo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool stuff! Just a few suggestions on the tests

}
@Test
public void testPassthroughMethods() throws B2Exception, IOException {
cancellableContentSource.getContentLength();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the passthrough tests, it would be stronger to also check the return values/side-effects.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great idea thanks!


@Test(expected = IOException.class)
public void testInputStreamReadCancelled() throws B2Exception, IOException {
final InputStream inputStream = cancellableContentSource.createInputStream();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can tell me if I'm being too annoying, but it might be a stronger test if we set up the ExpectedException right before we call read(). Especially since an earlier commit had exceptions getting thrown in both cancel() and read().

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're not being annoying -- its an annoying change but the right one. Thanks for pointing this out.


@Test
public void testStoreFileAsyncCancelled() throws B2Exception, IOException, ExecutionException, InterruptedException {
final List<B2PartStorer> partStorers = new ArrayList<>();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice test!

@malaysf malaysf merged commit 0ecd68d into master Feb 12, 2021
@malaysf malaysf deleted the malay/large-file-upload-async branch February 12, 2021 20:27
ericjding added a commit that referenced this pull request May 10, 2021
* Update CHANGELOG.md to include release 4.0.0

* disable content compression so as not to automatically decompress compressed content (#142)

* disable content compression so as not to automatically decompress compressed content in getContent

* add more explanation to setContentCompressionEnabled(false)

* new comments for setContentCompressionEnabled(false)

* bump major version and update CHANGELOG

* fix grammar -> by default

* adding suffix SNAPSHOT to major version

* create B2Json version of ByteArrayOutputStream and throws IOException… (#143)

* create B2Json version of ByteArrayOutputStream and throws IOException(Requested array size exceeds maximum limit)

* use smaller MAX_ARRAY_SIZE for unit test to avoid OOM error in builds

* revisions based on comments from ab, malay

* rewrite and rename B2JsonByteArrayOutputStream to B2JsonBoundedByteArrayOutputStream

* more revisions for B2JsonBoundedByteArrayOutputStream.java

* revisions based on brianb's comments and other discussions

* add more comments on the technical context of throwing IOException for B2JsonBoundedByteArrayOutputStream

* revised internal implementation of B2JsonBoundedByteArrayOutputStream; add tests for maxCapacity 0, integer overflow; other revision based on comments

* remove tests to catch IOException for integer overflow since it causes Travis CI build failure

* add index bounds check, fix bug where maxCapacity is not a power of 2

* refactor parameter length for checkCapacity

* Adding storeLargeFileFromLocalContentAsync method to B2StorageClient (#145)

* Adding storeLargeFileFromLocalContentAsync method to B2StorageClient

This behaves like `storeLargeFileFromLocalContent` but returns a cancellable future which will prevent additional tasks from starting and attempt to cancel in-progress API calls.

* fix B2LargeFileStorerTest

* update Changelog for 5.0.0 release

* update version.txt for 5.0.0 release

Co-authored-by: Keith Felt <[email protected]>
Co-authored-by: keithele <[email protected]>
Co-authored-by: mxue-BB <[email protected]>
Co-authored-by: malaysf <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants