[#1] Read from stream asynchronously
Signed-off-by: Ivan Pchelintsev <i.pchelintsev@yadro.com>
This commit is contained in:
parent
cbf6ad5a77
commit
70ba87bc60
2 changed files with 4 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue