[#23] Client: Refactoring to optimize memory usage
All checks were successful
DCO / DCO (pull_request) Successful in 33s
All checks were successful
DCO / DCO (pull_request) Successful in 33s
Signed-off-by: Pavel Gross <p.gross@yando.com>
This commit is contained in:
parent
1a02ac2ae7
commit
6562aa27a5
141 changed files with 1722 additions and 896 deletions
|
@ -1,19 +1,18 @@
|
|||
using System;
|
||||
using FrostFS.SDK.ModelsV2.Enums;
|
||||
|
||||
namespace FrostFS.SDK.ClientV2.Mappers.GRPC;
|
||||
|
||||
public static class StatusMapper
|
||||
{
|
||||
public static ModelsV2.ResponseStatus ToModel(this Status.Status status)
|
||||
public static FrostFsResponseStatus ToModel(this Status.Status status)
|
||||
{
|
||||
if (status is null)
|
||||
return new ModelsV2.ResponseStatus(StatusCode.Success);
|
||||
return new FrostFsResponseStatus(FrostFsStatusCode.Success);
|
||||
|
||||
var codeName = Enum.GetName(typeof(FrostFsStatusCode), status.Code);
|
||||
|
||||
var codeName = Enum.GetName(typeof(StatusCode), status.Code);
|
||||
|
||||
return codeName is null
|
||||
? throw new ArgumentException($"Unknown StatusCode. Value: '{status.Code}'.")
|
||||
: new ModelsV2.ResponseStatus((StatusCode)Enum.Parse(typeof(StatusCode), codeName), status.Message);
|
||||
: new FrostFsResponseStatus((FrostFsStatusCode)status.Code, status.Message);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue