[#4] infrastructure and sample Client Cut

Signed-off-by: Pavel Gross <p.gross@yadro.com>
This commit is contained in:
Pavel Gross 2024-06-10 11:31:36 +03:00
parent 0c4723c705
commit 545e647d7b
22 changed files with 717 additions and 193 deletions

View file

@ -1,5 +1,6 @@
using FrostFS.Container;
using FrostFS.SDK.ClientV2.Mappers.GRPC;
using FrostFS.SDK.Cryptography;
using FrostFS.SDK.ModelsV2;
using System.Collections.Generic;
using System.Threading.Tasks;
@ -17,6 +18,7 @@ public partial class Client
ContainerId = cid.ToGrpcMessage()
},
};
request.AddMetaHeader();
request.Sign(_key);
var response = await _containerServiceClient.GetAsync(request);
@ -33,13 +35,14 @@ public partial class Client
OwnerId = OwnerId.ToGrpcMessage()
}
};
request.AddMetaHeader();
request.Sign(_key);
var response = await _containerServiceClient.ListAsync(request);
Verifier.CheckResponse(response);
foreach (var cid in response.Body.ContainerIds)
{
yield return ContainerId.FromHash(cid.Value.ToByteArray());
yield return new ContainerId(Base58.Encode(cid.Value.ToByteArray()));
}
}
@ -48,6 +51,7 @@ public partial class Client
var cntnr = container.ToGrpcMessage();
cntnr.OwnerId = OwnerId.ToGrpcMessage();
cntnr.Version = Version.ToGrpcMessage();
var request = new PutRequest
{
Body = new PutRequest.Types.Body
@ -60,7 +64,7 @@ public partial class Client
request.Sign(_key);
var response = await _containerServiceClient.PutAsync(request);
Verifier.CheckResponse(response);
return ContainerId.FromHash(response.Body.ContainerId.Value.ToByteArray());
return new ContainerId(Base58.Encode(response.Body.ContainerId.Value.ToByteArray()));
}
public async Task DeleteContainerAsync(ContainerId cid)