Skip to content

Commit

Permalink
Change order of cancellation token and metadata in sync with Api doc (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
poornas authored and deekoder committed Jul 24, 2017
1 parent f59b518 commit fa6abda
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
8 changes: 5 additions & 3 deletions Minio.Functional.Tests/FunctionalTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public static void Main(string[] args)

// Set HTTP Tracing Off
// minioClient.SetTraceOff();
PutObject_Test5(minioClient).Wait();

// Check if bucket exists
BucketExists_Test(minioClient).Wait();
Expand Down Expand Up @@ -418,7 +419,7 @@ await minio.PutObjectAsync(bucketName,
filestream,
size,
contentType,
metaData: metaData);
metaData:metaData);
await minio.GetObjectAsync(bucketName, objectName,
(stream) =>
{
Expand Down Expand Up @@ -1074,12 +1075,13 @@ private async static Task ListIncompleteUpload_Test1(MinioClient minio)
byte[] bs = File.ReadAllBytes(fileName);
System.IO.MemoryStream filestream = new System.IO.MemoryStream(bs);
long file_write_size = filestream.Length;



await minio.PutObjectAsync(bucketName,
objectName,
filestream,
filestream.Length,
contentType, cts.Token);
contentType, cancellationToken:cts.Token);

}
catch (OperationCanceledException)
Expand Down
4 changes: 2 additions & 2 deletions Minio/ApiEndpoints/IObjectOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public interface IObjectOperations
/// <param name="contentType">Content type of the new object, null defaults to "application/octet-stream"</param>
/// <param name="cancellationToken">Optional cancellation token to cancel the operation</param>
/// <param name="metaData">Optional Object metadata to be stored. Defaults to null.</param>
Task PutObjectAsync(string bucketName, string objectName, Stream data, long size, string contentType = null, CancellationToken cancellationToken = default(CancellationToken), Dictionary<string, string> metadata = null);
Task PutObjectAsync(string bucketName, string objectName, Stream data, long size, string contentType = null, Dictionary<string, string> metaData = null,CancellationToken cancellationToken = default(CancellationToken));

/// <summary>
/// Removes an object with given name in specific bucket
Expand Down Expand Up @@ -116,7 +116,7 @@ public interface IObjectOperations
/// <param name="contentType">Content type of the new object, null defaults to "application/octet-stream"</param>
/// <param name="cancellationToken">Optional cancellation token to cancel the operation</param>
/// <param name="metaData">Optional Object metadata to be stored. Defaults to null.</param>
Task PutObjectAsync(string bucketName, string objectName, string filePath, string contentType = null, CancellationToken cancellationToken = default(CancellationToken), Dictionary<string, string> metadata = null);
Task PutObjectAsync(string bucketName, string objectName, string filePath, string contentType = null, Dictionary<string, string> metaData = null, CancellationToken cancellationToken = default(CancellationToken));

/// <summary>
/// Get an object. The object will be streamed to the callback given by the user.
Expand Down
6 changes: 3 additions & 3 deletions Minio/ApiEndpoints/ObjectOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,14 @@ await GetObjectAsync(bucketName, objectName, (stream) =>
/// <param name="contentType">Content type of the new object, null defaults to "application/octet-stream"</param>
/// <param name="cancellationToken">Optional cancellation token to cancel the operation</param>
/// <param name="metaData">Object metadata to be stored. Defaults to null.</param>
public async Task PutObjectAsync(string bucketName, string objectName, string fileName, string contentType = null, CancellationToken cancellationToken = default(CancellationToken), Dictionary<string, string> metaData = null)
public async Task PutObjectAsync(string bucketName, string objectName, string fileName, string contentType = null, Dictionary<string, string> metaData = null, CancellationToken cancellationToken = default(CancellationToken))
{
utils.ValidateFile(fileName, contentType);
FileInfo fileInfo = new FileInfo(fileName);
long size = fileInfo.Length;
using (FileStream file = new FileStream(fileName, FileMode.Open, FileAccess.Read))
{
await PutObjectAsync(bucketName, objectName, file, size, contentType, cancellationToken, metaData);
await PutObjectAsync(bucketName, objectName, file, size, contentType, metaData, cancellationToken);
}

}
Expand All @@ -189,7 +189,7 @@ await GetObjectAsync(bucketName, objectName, (stream) =>
/// <param name="data">Stream of bytes to send</param>
/// <param name="cancellationToken">Optional cancellation token to cancel the operation</param>
/// <param name="metaData">Object metadata to be stored. Defaults to null.</param>
public async Task PutObjectAsync(string bucketName, string objectName, Stream data, long size, string contentType = null, CancellationToken cancellationToken = default(CancellationToken), Dictionary<string, string> metaData = null)
public async Task PutObjectAsync(string bucketName, string objectName, Stream data, long size, string contentType = null, Dictionary<string, string> metaData = null, CancellationToken cancellationToken = default(CancellationToken))
{
utils.validateBucketName(bucketName);
utils.validateObjectName(objectName);
Expand Down

0 comments on commit fa6abda

Please sign in to comment.