Esempio n. 1
0
        public async Task <CommitUploadResult> CommitUploadAsync(string bucketName, string objectKey, string uploadId, CommitUploadOptions commitUploadOptions)
        {
            CommitUploadResult result = new CommitUploadResult();
            await Task.Run(() =>
            {
                UploadOperation.customMetadataSemaphore.Wait();
                try
                {
                    if (commitUploadOptions.CustomMetadata != null)
                    {
                        commitUploadOptions.CustomMetadata.ToSWIG(); //Appends the customMetadata in the go-layer to a global field
                    }

                    using (var commitUploadResult = SWIG.storj_uplink.uplink_commit_upload2(_access._project, bucketName, objectKey, uploadId))
                    {
                        if (commitUploadResult.error != null && !string.IsNullOrEmpty(commitUploadResult.error.message))
                        {
                            result.Error = commitUploadResult.error.message;
                        }
                        else
                        {
                            result.Object = Models.Object.FromSWIG(commitUploadResult.object_);
                        }
                    }
                }
                finally
                {
                    UploadOperation.customMetadataSemaphore.Release();
                }
            }).ConfigureAwait(false);

            return(result);
        }
        public async Task <CommitUploadResult> CommitUploadAsync(string bucketName, string objectKey, string uploadId, CommitUploadOptions commitUploadOptions)
        {
            CommitUploadResult result = new CommitUploadResult();

            var uplinkCommitUploadOptions = new SWIG.UplinkCommitUploadOptions();

            using (var commitUploadResult = await Task.Run(() => SWIG.storj_uplink.uplink_commit_upload(_access._project, bucketName, objectKey, uploadId, uplinkCommitUploadOptions)))
            {
                if (commitUploadResult.error != null && !string.IsNullOrEmpty(commitUploadResult.error.message))
                {
                    result.Error = commitUploadResult.error.message;
                }
                else
                {
                    result.Object = Models.Object.FromSWIG(commitUploadResult.object_);
                }
            }

            return(result);
        }