aws / amazon-s3-encryption-client-dotnet

An encryption client that allows you to secure your sensitive data before you send it to Amazon S3.
https://aws.github.io/amazon-s3-encryption-client-dotnet/
Apache License 2.0
15 stars 10 forks source link

Add ConcurrentDictionary to allow performing multipart uploads in mul… #2

Closed ganeshnj closed 3 years ago

ganeshnj commented 3 years ago

Issue #, if available: None

Description of changes: When using AmazonS3EncryptionClientV2 in multi-threaded environment, it fails to store UploadPartEncryptionContext of a multipart upload, because by default Dictionary isn't a thread safe data structure in C#.

There exists ConcurrentDictionary which is available on all target framework except net35. Therefore, I added custom ConcurrentDictionary which includes all the basic operations that are being used in the code at the moment.

Testing:: Able to multipart upload in multiple threads using AmazonS3EncryptionClientV2.

Note: All threads are working on separate input streams.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.