diff --git a/GO/custom_metadata_helper.go b/GO/custom_metadata_helper.go
index 4a5531d7..3a51cb1e 100644
--- a/GO/custom_metadata_helper.go
+++ b/GO/custom_metadata_helper.go
@@ -5,7 +5,7 @@ import "C"
import (
"reflect"
"unsafe"
-
+ "log"
"storj.io/uplink"
)
@@ -14,18 +14,21 @@ var customMetadata = map[string]string{}
//export prepare_custommetadata
// prepare_custommetadata creates a temporary SharePrefixes-Array to be filled by append_custommetadata and used by upload_set_custom_metadata2
func prepare_custommetadata() {
+ log.Println("prepare_custommetadata: Initializing custom metadata map")
customMetadata = make(map[string]string)
}
//export append_custommetadata
// append_custommetadata appends one CustomMetadata by providing the contents directly
func append_custommetadata(key *C.char, value *C.char){
+ log.Printf("append_custommetadata: Adding key=%s, value=%s\n", C.GoString(key), C.GoString(value))
customMetadata[C.GoString(key)] = C.GoString(value)
}
//export upload_set_custom_metadata2
// upload_set_custom_metadata2 sets the customMetadata on an upload
func upload_set_custom_metadata2(upload *C.UplinkUpload) *C.UplinkError {
+ log.Println("upload_set_custom_metadata2: Setting custom metadata on upload")
up, ok := universe.Get(upload._handle).(*Upload)
if !ok {
return mallocError(ErrInvalidHandle.New("upload"))
@@ -122,4 +125,4 @@ func uplink_update_object_metadata2(project *C.UplinkProject, bucket_name, objec
err := proj.UpdateObjectMetadata(proj.scope.ctx, C.GoString(bucket_name), C.GoString(object_key), customMetadata, nil)
return mallocError(err)
-}
\ No newline at end of file
+}
diff --git a/GO/restrict_scope_helper.go b/GO/restrict_scope_helper.go
index cf6b08d7..c6629f5a 100644
--- a/GO/restrict_scope_helper.go
+++ b/GO/restrict_scope_helper.go
@@ -5,7 +5,7 @@ import "C"
import (
"time"
-
+ "log"
"storj.io/uplink"
)
@@ -14,6 +14,7 @@ var shareprefixes []uplink.SharePrefix;
//export prepare_shareprefixes
// prepare_shareprefixes creates a temporary SharePrefixes-Array to be filled by append_shareprefix and used by access_share2
func prepare_shareprefixes(shareprefixesLen C.size_t) {
+ log.Printf("prepare_shareprefixes: Initializing shareprefixes array with length %d\n", shareprefixesLen)
ishareprefixesLen := int(shareprefixesLen)
shareprefixes = make([]uplink.SharePrefix, 0, ishareprefixesLen)
@@ -22,6 +23,7 @@ func prepare_shareprefixes(shareprefixesLen C.size_t) {
//export append_shareprefix
// append_shareprefix appends one SharePrefix by providing the contents directly
func append_shareprefix(bucket *C.char, prefix *C.char){
+ log.Printf("append_shareprefix: Adding bucket=%s, prefix=%s\n", C.GoString(bucket), C.GoString(prefix))
shareprefix := uplink.SharePrefix{
Bucket: C.GoString(bucket),
Prefix: C.GoString(prefix),
@@ -33,6 +35,7 @@ func append_shareprefix(bucket *C.char, prefix *C.char){
//export access_share2
// access_share2 restricts a given scope with the provided caveat and the temporary encryption shareprefixes
func access_share2(access *C.UplinkAccess, permission C.UplinkPermission) C.UplinkAccessResult { //nolint:golint
+ log.Println("access_share2: Restricting access with provided permission and shareprefixes")
if access == nil {
return C.UplinkAccessResult{
error: mallocError(ErrNull.New("access")),
@@ -69,4 +72,4 @@ func access_share2(access *C.UplinkAccess, permission C.UplinkPermission) C.Upli
return C.UplinkAccessResult{
access: (*C.UplinkAccess)(mallocHandle(universe.Add(&Access{newAccess}))),
}
-}
\ No newline at end of file
+}
diff --git a/uplink.NET/uplink.NET/Models/Access.cs b/uplink.NET/uplink.NET/Models/Access.cs
index 9bed0412..e2d26e16 100644
--- a/uplink.NET/uplink.NET/Models/Access.cs
+++ b/uplink.NET/uplink.NET/Models/Access.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
@@ -256,6 +256,7 @@ public string Serialize()
/// The restricted access
public Access Share(Permission permission, List prefixes)
{
+ Console.WriteLine("Share: Preparing to share access with permissions and prefixes");
SWIG.storj_uplink.prepare_shareprefixes((uint)prefixes.Count);
foreach (var prefix in prefixes)
@@ -268,6 +269,7 @@ public Access Share(Permission permission, List prefixes)
if (accessResult.error != null && !string.IsNullOrEmpty(accessResult.error.message))
throw new AccessShareException(accessResult.error.message);
+ Console.WriteLine("Share: Successfully shared access");
return new Access(accessResult.access);
}
}
@@ -286,11 +288,13 @@ public Access Share(Permission permission, List prefixes)
/// true, if overwriting worked - raises exception on error
public bool OverrideEncryptionAccess(string bucketName, string prefix, EncryptionKey encryptionKey)
{
+ Console.WriteLine("OverrideEncryptionAccess: Overriding encryption key for bucket: {0}, prefix: {1}", bucketName, prefix);
using (var error = SWIG.storj_uplink.uplink_access_override_encryption_key(_access, bucketName, prefix, encryptionKey._encryptionKeyResulRef.encryption_key))
{
if (error != null && !string.IsNullOrEmpty(error.message))
throw new AccessException(error.message);
+ Console.WriteLine("OverrideEncryptionAccess: Successfully overridden encryption key");
return true;
}
}
@@ -327,12 +331,14 @@ public string CreateShareURL(string bucketName, string key, bool raw, bool is_pu
public async Task RevokeAsync(Access childAccess)
{
+ Console.WriteLine("RevokeAsync: Revoking access");
using (UplinkError error = await Task.Run(() => SWIG.storj_uplink.uplink_revoke_access(_project, childAccess._access)).ConfigureAwait(false))
{
if (error != null && !string.IsNullOrEmpty(error.message))
{
throw new AccessRevokeException(error.message);
}
+ Console.WriteLine("RevokeAsync: Successfully revoked access");
}
}
diff --git a/uplink.NET/uplink.NET/Services/BucketService.cs b/uplink.NET/uplink.NET/Services/BucketService.cs
index 6ef7fe9c..99a8ae8f 100644
--- a/uplink.NET/uplink.NET/Services/BucketService.cs
+++ b/uplink.NET/uplink.NET/Services/BucketService.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
@@ -21,63 +21,86 @@ public BucketService(Access access)
public async Task CreateBucketAsync(string bucketName)
{
+ Console.WriteLine("CreateBucketAsync: Creating bucket with name: {0}", bucketName);
using (SWIG.UplinkBucketResult bucketResult = await Task.Run(() => SWIG.storj_uplink.uplink_create_bucket(_access._project, bucketName)).ConfigureAwait(false))
{
if (bucketResult.error != null && !string.IsNullOrEmpty(bucketResult.error.message))
+ {
+ Console.WriteLine("CreateBucketAsync: Error creating bucket: {0}", bucketResult.error.message);
throw new BucketCreationException(bucketName, bucketResult.error.message);
+ }
var bucket = Bucket.FromSWIG(bucketResult.bucket, _access._project, bucketResult);
-
+ Console.WriteLine("CreateBucketAsync: Successfully created bucket: {0}", bucketName);
return bucket;
}
}
public async Task EnsureBucketAsync(string bucketName)
{
+ Console.WriteLine("EnsureBucketAsync: Ensuring bucket with name: {0}", bucketName);
using (SWIG.UplinkBucketResult bucketResult = await Task.Run(() => SWIG.storj_uplink.uplink_ensure_bucket(_access._project, bucketName)).ConfigureAwait(false))
{
if (bucketResult.error != null && !string.IsNullOrEmpty(bucketResult.error.message))
+ {
+ Console.WriteLine("EnsureBucketAsync: Error ensuring bucket: {0}", bucketResult.error.message);
throw new BucketCreationException(bucketName, bucketResult.error.message);
+ }
var bucket = Bucket.FromSWIG(bucketResult.bucket, _access._project, bucketResult);
-
+ Console.WriteLine("EnsureBucketAsync: Successfully ensured bucket: {0}", bucketName);
return bucket;
}
}
public async Task DeleteBucketAsync(string bucketName)
{
+ Console.WriteLine("DeleteBucketAsync: Deleting bucket with name: {0}", bucketName);
using (SWIG.UplinkBucketResult bucketResult = await Task.Run(() => SWIG.storj_uplink.uplink_delete_bucket(_access._project, bucketName)).ConfigureAwait(false))
{
if (bucketResult.error != null && !string.IsNullOrEmpty(bucketResult.error.message))
+ {
+ Console.WriteLine("DeleteBucketAsync: Error deleting bucket: {0}", bucketResult.error.message);
throw new BucketDeletionException(bucketName, bucketResult.error.message);
+ }
+ Console.WriteLine("DeleteBucketAsync: Successfully deleted bucket: {0}", bucketName);
}
}
public async Task DeleteBucketWithObjectsAsync(string bucketName)
{
+ Console.WriteLine("DeleteBucketWithObjectsAsync: Deleting bucket with objects, name: {0}", bucketName);
using (SWIG.UplinkBucketResult bucketResult = await Task.Run(() => SWIG.storj_uplink.uplink_delete_bucket_with_objects(_access._project, bucketName)).ConfigureAwait(false))
{
if (bucketResult.error != null && !string.IsNullOrEmpty(bucketResult.error.message))
+ {
+ Console.WriteLine("DeleteBucketWithObjectsAsync: Error deleting bucket with objects: {0}", bucketResult.error.message);
throw new BucketDeletionException(bucketName, bucketResult.error.message);
+ }
+ Console.WriteLine("DeleteBucketWithObjectsAsync: Successfully deleted bucket with objects: {0}", bucketName);
}
}
public async Task GetBucketAsync(string bucketName)
{
+ Console.WriteLine("GetBucketAsync: Retrieving bucket with name: {0}", bucketName);
using (SWIG.UplinkBucketResult bucketResult = await Task.Run(() => SWIG.storj_uplink.uplink_stat_bucket(_access._project, bucketName)).ConfigureAwait(false))
{
if (bucketResult.error != null && !string.IsNullOrEmpty(bucketResult.error.message))
+ {
+ Console.WriteLine("GetBucketAsync: Error retrieving bucket: {0}", bucketResult.error.message);
throw new BucketNotFoundException(bucketName, bucketResult.error.message);
+ }
var bucket = Bucket.FromSWIG(bucketResult.bucket, _access._project, bucketResult);
-
+ Console.WriteLine("GetBucketAsync: Successfully retrieved bucket: {0}", bucketName);
return bucket;
}
}
public async Task ListBucketsAsync(ListBucketsOptions listBucketsOptions)
{
+ Console.WriteLine("ListBucketsAsync: Listing buckets with options: {0}", listBucketsOptions);
var listBucketsOptionsSWIG = listBucketsOptions.ToSWIG();
_listOptions.Add(listBucketsOptionsSWIG);
using (SWIG.UplinkBucketIterator bucketIterator = await Task.Run(() => SWIG.storj_uplink.uplink_list_buckets(_access._project, listBucketsOptionsSWIG)).ConfigureAwait(false))
@@ -86,6 +109,7 @@ public async Task ListBucketsAsync(ListBucketsOptions listBucketsOpt
{
if (error != null && !string.IsNullOrEmpty(error.message))
{
+ Console.WriteLine("ListBucketsAsync: Error listing buckets: {0}", error.message);
throw new BucketListException(error.message);
}
}
@@ -97,7 +121,7 @@ public async Task ListBucketsAsync(ListBucketsOptions listBucketsOpt
var bucket = SWIG.storj_uplink.uplink_bucket_iterator_item(bucketIterator);
bucketList.Items.Add(Bucket.FromSWIG(bucket, _access._project));
}
-
+ Console.WriteLine("ListBucketsAsync: Successfully listed buckets");
return bucketList;
}
}
diff --git a/uplink.NET/uplink.NET/Services/MultipartUploadService.cs b/uplink.NET/uplink.NET/Services/MultipartUploadService.cs
index 1efd2958..5b2b0a03 100644
--- a/uplink.NET/uplink.NET/Services/MultipartUploadService.cs
+++ b/uplink.NET/uplink.NET/Services/MultipartUploadService.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
@@ -23,26 +23,33 @@ public MultipartUploadService(Access access)
public async Task BeginUploadAsync(string bucketName, string objectKey, UploadOptions uploadOptions)
{
+ Console.WriteLine("BeginUploadAsync: Starting upload for bucket: {0}, objectKey: {1}", bucketName, objectKey);
var uploadOptionsSWIG = uploadOptions.ToSWIG();
_uploadOptions.Add(uploadOptionsSWIG);
using (SWIG.UplinkUploadInfoResult uploadinfoResult = await Task.Run(() => SWIG.storj_uplink.uplink_begin_upload(_access._project, bucketName, objectKey, uploadOptionsSWIG)).ConfigureAwait(false))
{
if (uploadinfoResult.error != null && !string.IsNullOrEmpty(uploadinfoResult.error.message))
+ {
+ Console.WriteLine("BeginUploadAsync: Error starting upload: {0}", uploadinfoResult.error.message);
throw new MultipartUploadFailedException(objectKey, uploadinfoResult.error.message);
+ }
+ Console.WriteLine("BeginUploadAsync: Successfully started upload for bucket: {0}, objectKey: {1}", bucketName, objectKey);
return UploadInfo.FromSWIG(uploadinfoResult.info);
}
}
public async Task UploadPartAsync(string bucketName, string objectKey, string uploadId, uint partNumber, byte[] partBytes)
{
+ Console.WriteLine("UploadPartAsync: Uploading part {0} for bucket: {1}, objectKey: {2}, uploadId: {3}", partNumber, bucketName, objectKey, uploadId);
using (var partUploadResult = await Task.Run(() => SWIG.storj_uplink.uplink_upload_part(_access._project, bucketName, objectKey, uploadId, partNumber)).ConfigureAwait(false))
{
PartUploadResult result = new PartUploadResult(partUploadResult.part_upload);
if (partUploadResult.error != null && !string.IsNullOrEmpty(partUploadResult.error.message))
{
+ Console.WriteLine("UploadPartAsync: Error uploading part: {0}", partUploadResult.error.message);
result.Error = partUploadResult.error.message;
}
else
@@ -50,9 +57,11 @@ public async Task UploadPartAsync(string bucketName, string ob
try
{
result.BytesWritten = await Task.Run(() => DoUnsafeUpload(partUploadResult.part_upload, objectKey, partBytes)).ConfigureAwait(false);
+ Console.WriteLine("UploadPartAsync: Successfully uploaded part {0} for bucket: {1}, objectKey: {2}, uploadId: {3}", partNumber, bucketName, objectKey, uploadId);
}
catch (Exception ex)
{
+ Console.WriteLine("UploadPartAsync: Exception during upload: {0}", ex.Message);
result.Error = ex.Message;
}
}
@@ -67,13 +76,20 @@ private unsafe uint DoUnsafeUpload(SWIG.UplinkPartUpload partUpload, string obje
using (SWIG.UplinkWriteResult sentResult = SWIG.storj_uplink.uplink_part_upload_write(partUpload, new SWIG.SWIGTYPE_p_void(new IntPtr(arrayPtr), true), (uint)partBytes.Length))
{
if (sentResult.error != null && !string.IsNullOrEmpty(sentResult.error.message))
+ {
+ Console.WriteLine("DoUnsafeUpload: Error writing part: {0}", sentResult.error.message);
throw new MultipartUploadFailedException(objectKey, sentResult.error.message);
+ }
using (var commitResult = SWIG.storj_uplink.uplink_part_upload_commit(partUpload))
{
if (commitResult != null && !string.IsNullOrEmpty(commitResult.message))
+ {
+ Console.WriteLine("DoUnsafeUpload: Error committing part: {0}", commitResult.message);
throw new MultipartUploadFailedException(objectKey, commitResult.message);
+ }
+ Console.WriteLine("DoUnsafeUpload: Successfully wrote and committed part for objectKey: {0}", objectKey);
return sentResult.bytes_written;
}
}
@@ -82,20 +98,31 @@ private unsafe uint DoUnsafeUpload(SWIG.UplinkPartUpload partUpload, string obje
public async Task UploadPartSetETagAsync(PartUpload partUpload, string eTag)
{
+ Console.WriteLine("UploadPartSetETagAsync: Setting ETag for part upload");
var result = await Task.Run(() => SWIG.storj_uplink.uplink_part_upload_set_etag(partUpload._partUpload, eTag)).ConfigureAwait(false);
if (result != null && !string.IsNullOrEmpty(result.message))
+ {
+ Console.WriteLine("UploadPartSetETagAsync: Error setting ETag: {0}", result.message);
throw new SetETagFailedException(result.message);
+ }
+ Console.WriteLine("UploadPartSetETagAsync: Successfully set ETag for part upload");
}
public async Task AbortUploadAsync(string bucketName, string objectKey, string uploadId)
{
+ Console.WriteLine("AbortUploadAsync: Aborting upload for bucket: {0}, objectKey: {1}, uploadId: {2}", bucketName, objectKey, uploadId);
var result = await Task.Run(() => SWIG.storj_uplink.uplink_abort_upload(_access._project, bucketName, objectKey, uploadId)).ConfigureAwait(false);
if (result != null && !string.IsNullOrEmpty(result.message))
+ {
+ Console.WriteLine("AbortUploadAsync: Error aborting upload: {0}", result.message);
throw new SetETagFailedException(result.message);
+ }
+ Console.WriteLine("AbortUploadAsync: Successfully aborted upload for bucket: {0}, objectKey: {1}, uploadId: {2}", bucketName, objectKey, uploadId);
}
public async Task CommitUploadAsync(string bucketName, string objectKey, string uploadId, CommitUploadOptions commitUploadOptions)
{
+ Console.WriteLine("CommitUploadAsync: Committing upload for bucket: {0}, objectKey: {1}, uploadId: {2}", bucketName, objectKey, uploadId);
CommitUploadResult result = new CommitUploadResult();
await Task.Run(() =>
{
@@ -111,11 +138,13 @@ await Task.Run(() =>
{
if (commitUploadResult.error != null && !string.IsNullOrEmpty(commitUploadResult.error.message))
{
+ Console.WriteLine("CommitUploadAsync: Error committing upload: {0}", commitUploadResult.error.message);
result.Error = commitUploadResult.error.message;
}
else
{
result.Object = Models.Object.FromSWIG(commitUploadResult.object_);
+ Console.WriteLine("CommitUploadAsync: Successfully committed upload for bucket: {0}, objectKey: {1}, uploadId: {2}", bucketName, objectKey, uploadId);
}
}
}
@@ -129,16 +158,19 @@ await Task.Run(() =>
public async Task GetPartUploadInfoAsync(PartUpload partUpload)
{
+ Console.WriteLine("GetPartUploadInfoAsync: Retrieving part upload info");
using (var uplinkPartResult = await Task.Run(() => SWIG.storj_uplink.uplink_part_upload_info(partUpload._partUpload)).ConfigureAwait(false))
{
var partResult = new PartResult();
if (uplinkPartResult.error != null && !string.IsNullOrEmpty(uplinkPartResult.error.message))
{
+ Console.WriteLine("GetPartUploadInfoAsync: Error retrieving part upload info: {0}", uplinkPartResult.error.message);
partResult.Error = uplinkPartResult.error.message;
}
else
{
partResult.Part = Part.FromSWIG(uplinkPartResult.part);
+ Console.WriteLine("GetPartUploadInfoAsync: Successfully retrieved part upload info");
}
return partResult;
@@ -147,6 +179,7 @@ public async Task GetPartUploadInfoAsync(PartUpload partUpload)
public async Task ListUploadPartsAsync(string bucketName, string objectKey, string uploadId, ListUploadPartsOptions listUploadPartOptions)
{
+ Console.WriteLine("ListUploadPartsAsync: Listing upload parts for bucket: {0}, objectKey: {1}, uploadId: {2}", bucketName, objectKey, uploadId);
var listUploadPartsOptionsSWIG = listUploadPartOptions.ToSWIG();
_listUploadPartsOptions.Add(listUploadPartsOptionsSWIG);
@@ -156,6 +189,7 @@ public async Task ListUploadPartsAsync(string bucketName, strin
{
if (error != null && !string.IsNullOrEmpty(error.message))
{
+ Console.WriteLine("ListUploadPartsAsync: Error listing upload parts: {0}", error.message);
throw new UploadPartsListException(error.message);
}
}
@@ -169,12 +203,14 @@ public async Task ListUploadPartsAsync(string bucketName, strin
uploadPartList.Items.Add(uplink.NET.Models.Part.FromSWIG(partUploadResult));
}
}
+ Console.WriteLine("ListUploadPartsAsync: Successfully listed upload parts for bucket: {0}, objectKey: {1}, uploadId: {2}", bucketName, objectKey, uploadId);
return uploadPartList;
}
}
public async Task ListUploadsAsync(string bucketName, ListUploadOptions listUploadOptions)
{
+ Console.WriteLine("ListUploadsAsync: Listing uploads for bucket: {0}", bucketName);
var listUploadsOptionsSWIG = listUploadOptions.ToSWIG();
_listUploadsOptions.Add(listUploadsOptionsSWIG);
@@ -184,6 +220,7 @@ public async Task ListUploadsAsync(string bucketName, ListUploadOpt
{
if (error != null && !string.IsNullOrEmpty(error.message))
{
+ Console.WriteLine("ListUploadsAsync: Error listing uploads: {0}", error.message);
throw new UploadsListException(error.message);
}
}
@@ -197,6 +234,7 @@ public async Task ListUploadsAsync(string bucketName, ListUploadOpt
uploadsList.Items.Add(uplink.NET.Models.UploadInfo.FromSWIG(uploadInfo));
}
}
+ Console.WriteLine("ListUploadsAsync: Successfully listed uploads for bucket: {0}", bucketName);
return uploadsList;
}
}
diff --git a/uplink.NET/uplink.NET/Services/ObjectService.cs b/uplink.NET/uplink.NET/Services/ObjectService.cs
index 11c13a12..18c5c2cf 100644
--- a/uplink.NET/uplink.NET/Services/ObjectService.cs
+++ b/uplink.NET/uplink.NET/Services/ObjectService.cs
@@ -53,6 +53,7 @@ public async Task UploadObjectAsync(Bucket bucket, string targe
using (SWIG.UplinkUploadResult uploadResult = await Task.Run(() => SWIG.storj_uplink.uplink_upload_object(_access._project, bucket.Name, targetPath, uploadOptionsSWIG)).ConfigureAwait(false))
{
+ Console.WriteLine("UploadObjectAsync: Uploading object to bucket: {0}, targetPath: {1}", bucket.Name, targetPath);
UploadOperation upload = new UploadOperation(stream, uploadResult, targetPath, customMetadata);
if (immediateStart)
upload.StartUploadAsync(); //Don't await it, otherwise it would "block" UploadObjectAsync
@@ -73,6 +74,7 @@ public async Task UploadObjectAsync(Bucket bucket, string targe
using (SWIG.UplinkUploadResult uploadResult = await Task.Run(() => SWIG.storj_uplink.uplink_upload_object(_access._project, bucket.Name, targetPath, uploadOptionsSWIG)).ConfigureAwait(false))
{
+ Console.WriteLine("UploadObjectAsync: Uploading object to bucket: {0}, targetPath: {1}", bucket.Name, targetPath);
UploadOperation upload = new UploadOperation(bytesToUpload, uploadResult, targetPath, customMetadata);
if (immediateStart)
upload.StartUploadAsync(); //Don't await it, otherwise it would "block" UploadObjectAsync
@@ -87,6 +89,7 @@ public async Task UploadObjectChunkedAsync(Bucket bucket
_uploadOptions.Add(uploadOptionsSWIG);
using (SWIG.UplinkUploadResult uploadResult = await Task.Run(() => SWIG.storj_uplink.uplink_upload_object(_access._project, bucket.Name, targetPath, uploadOptionsSWIG)).ConfigureAwait(false))
{
+ Console.WriteLine("UploadObjectChunkedAsync: Uploading object to bucket: {0}, targetPath: {1}", bucket.Name, targetPath);
ChunkedUploadOperation upload = new ChunkedUploadOperation(uploadResult, targetPath, customMetadata);
return upload;
@@ -104,7 +107,7 @@ public async Task DownloadObjectAsync(Bucket bucket, string t
{
using (SWIG.UplinkDownloadResult downloadResult = await Task.Run(() => SWIG.storj_uplink.uplink_download_object(_access._project, bucket.Name, targetPath, downloadOptionsSWIG)).ConfigureAwait(false))
{
-
+ Console.WriteLine("DownloadObjectAsync: Downloading object from bucket: {0}, targetPath: {1}", bucket.Name, targetPath);
if (downloadResult.error != null && !string.IsNullOrEmpty(downloadResult.error.message))
throw new ObjectNotFoundException(targetPath, downloadResult.error.message);
@@ -125,6 +128,7 @@ public async Task DownloadObjectAsync(Bucket bucket, string t
public async Task DownloadObjectAsStreamAsync(Bucket bucket, string targetPath)
{
+ Console.WriteLine("DownloadObjectAsStreamAsync: Downloading object as stream from bucket: {0}, targetPath: {1}", bucket.Name, targetPath);
var objectToDownload = await GetObjectAsync(bucket, targetPath);
return new DownloadStream(bucket, (int)objectToDownload.SystemMetadata.ContentLength, targetPath);
}
@@ -132,6 +136,7 @@ public async Task DownloadObjectAsStreamAsync(Bucket bucket, str
public async Task ListObjectsAsync(Bucket bucket, ListObjectsOptions listObjectsOptions)
{
+ Console.WriteLine("ListObjectsAsync: Listing objects in bucket: {0}", bucket.Name);
var listObjectsOptionsSWIG = listObjectsOptions.ToSWIG();
_listOptions.Add(listObjectsOptionsSWIG);
@@ -160,6 +165,7 @@ public async Task ListObjectsAsync(Bucket bucket, ListObjectsOptions
public async Task GetObjectAsync(Bucket bucket, string targetPath)
{
+ Console.WriteLine("GetObjectAsync: Retrieving object from bucket: {0}, targetPath: {1}", bucket.Name, targetPath);
using (var objectResult = await Task.Run(() => SWIG.storj_uplink.uplink_stat_object(_access._project, bucket.Name, targetPath)).ConfigureAwait(false))
{
if (objectResult.error != null && !string.IsNullOrEmpty(objectResult.error.message))
@@ -171,6 +177,7 @@ public async Task ListObjectsAsync(Bucket bucket, ListObjectsOptions
public async Task DeleteObjectAsync(Bucket bucket, string targetPath)
{
+ Console.WriteLine("DeleteObjectAsync: Deleting object from bucket: {0}, targetPath: {1}", bucket.Name, targetPath);
using (SWIG.UplinkObjectResult objectResult = await Task.Run(() => SWIG.storj_uplink.uplink_delete_object(_access._project, bucket.Name, targetPath)).ConfigureAwait(false))
{
if (objectResult.error != null && !string.IsNullOrEmpty(objectResult.error.message))
@@ -186,6 +193,7 @@ public async Task DeleteObjectAsync(Bucket bucket, string targetPath)
public async Task MoveObjectAsync(Bucket oldBucket, string oldKey, Bucket newBucket, string newKey)
{
+ Console.WriteLine("MoveObjectAsync: Moving object from bucket: {0}, oldKey: {1} to bucket: {2}, newKey: {3}", oldBucket.Name, oldKey, newBucket.Name, newKey);
using (var options = new SWIG.UplinkMoveObjectOptions())
using (SWIG.UplinkError error = await Task.Run(() => SWIG.storj_uplink.uplink_move_object(_access._project, oldBucket.Name, oldKey, newBucket.Name, newKey, options)))
{
@@ -198,6 +206,7 @@ public async Task MoveObjectAsync(Bucket oldBucket, string oldKey, Bucket newBuc
public async Task CopyObjectAsync(Bucket oldBucket, string oldKey, Bucket newBucket, string newKey)
{
+ Console.WriteLine("CopyObjectAsync: Copying object from bucket: {0}, oldKey: {1} to bucket: {2}, newKey: {3}", oldBucket.Name, oldKey, newBucket.Name, newKey);
using (var options = new SWIG.UplinkCopyObjectOptions())
using (SWIG.UplinkObjectResult result = await Task.Run(() => SWIG.storj_uplink.uplink_copy_object(_access._project, oldBucket.Name, oldKey, newBucket.Name, newKey, options)))
{
@@ -210,6 +219,7 @@ public async Task CopyObjectAsync(Bucket oldBucket, string oldKey, Bucket newBuc
public async Task UpdateObjectMetadataAsync(Bucket bucket, string targetPath, CustomMetadata metadata)
{
+ Console.WriteLine("UpdateObjectMetadataAsync: Updating metadata for object in bucket: {0}, targetPath: {1}", bucket.Name, targetPath);
await UploadOperation.customMetadataSemaphore.WaitAsync();
try
{