[#23] Client: Refactoring to optimize memory usage
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
|
@ -0,0 +1,62 @@
|
|||
using FrostFS.Refs;
|
||||
using FrostFS.SDK.Cryptography;
|
||||
|
||||
using FrostFS.SDK.ClientV2.Mappers.GRPC;
|
||||
using FrostFS.SDK.ClientV2;
|
||||
|
||||
namespace FrostFS.SDK;
|
||||
|
||||
public class FrostFsContainerId
|
||||
{
|
||||
private string? modelId;
|
||||
private ContainerID? containerID;
|
||||
|
||||
public FrostFsContainerId(string id)
|
||||
{
|
||||
this.modelId = id;
|
||||
}
|
||||
|
||||
internal FrostFsContainerId(ContainerID id)
|
||||
{
|
||||
this.containerID = id;
|
||||
}
|
||||
|
||||
public string Value
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.modelId != null)
|
||||
return this.modelId;
|
||||
|
||||
if (containerID != null)
|
||||
{
|
||||
this.modelId = Base58.Encode(containerID.Value.ToByteArray());
|
||||
return this.modelId;
|
||||
}
|
||||
|
||||
throw new InvalidObjectException();
|
||||
}
|
||||
}
|
||||
|
||||
internal ContainerID ContainerID
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.containerID != null)
|
||||
return this.containerID;
|
||||
|
||||
if (modelId != null)
|
||||
{
|
||||
this.containerID = this.ToMessage();
|
||||
return this.containerID;
|
||||
}
|
||||
|
||||
throw new InvalidObjectException();
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Value;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue