[#20] Client: Optimize memory usage

Avoid memory allocation, use cache and static

Signed-off-by: Pavel Gross <p.gross@yando.com>
This commit is contained in:
Pavel Gross 2024-08-01 16:17:36 +03:00
parent 35fe791406
commit 0ddde467cd
46 changed files with 596 additions and 372 deletions

View file

@ -125,7 +125,7 @@ public class Client : IFrostFSClient
public IAsyncEnumerable<ContainerId> ListContainersAsync(PrmContainerGetAll? args = null)
{
args = args ?? new PrmContainerGetAll();
args ??= new PrmContainerGetAll();
var service = GetContainerService(args);
return service.ListContainersAsync(args);
}
@ -223,7 +223,10 @@ public class Client : IFrostFSClient
#region ToolsImplementation
public ObjectId CalculateObjectId(ObjectHeader header)
{
return new ObjectTools(ClientCtx).CalculateObjectId(header);
if (header == null)
throw new ArgumentNullException(nameof(header));
return ObjectTools.CalculateObjectId(header, ClientCtx);
}
#endregion
@ -236,7 +239,6 @@ public class Client : IFrostFSClient
if (!localNodeInfo.Version.IsSupported(ClientCtx.Version))
{
var msg = $"FrostFS {localNodeInfo.Version} is not supported.";
Console.WriteLine(msg);
throw new ApplicationException(msg);
}
}