[#1] Read from stream asynchronously

Signed-off-by: Ivan Pchelintsev <i.pchelintsev@yadro.com>
This commit is contained in:
Ivan Pchelintsev 2024-05-21 16:15:19 +03:00
parent cbf6ad5a77
commit 70ba87bc60
2 changed files with 4 additions and 2 deletions

View file

@ -21,6 +21,7 @@ public partial class Client
return response.Body.Container.ToModel();
}
//TODO: Return iterator
public async Task<ContainerId[]> ListContainersAsync()
{
var request = new ListRequest

View file

@ -132,7 +132,7 @@ public partial class Client
using var stream = await PutObjectInit(request);
var buffer = new byte[Constants.ObjectChunkSize];
var bufferLength = payload.Read(buffer, 0, Constants.ObjectChunkSize);
var bufferLength = await payload.ReadAsync(buffer.AsMemory(0, Constants.ObjectChunkSize));
while (bufferLength > 0)
{
request.Body = new PutRequest.Types.Body
@ -142,7 +142,7 @@ public partial class Client
request.VerifyHeader = null;
request.Sign(_key);
await stream.Write(request);
bufferLength = payload.Read(buffer, 0, Constants.ObjectChunkSize);
bufferLength = await payload.ReadAsync(buffer.AsMemory(0, Constants.ObjectChunkSize));
}
var response = await stream.Close();
@ -179,6 +179,7 @@ public partial class Client
await _objectServiceClient.DeleteAsync(request);
}
//TODO: Return iterator
public async Task<ObjectId[]> SearchObjectAsync(ContainerId cid, params ObjectFilter[] filters)
{
var request = new SearchRequest