[#1] Define SDK structure
TODO: Вынести маппинг модель -> grpc в отдельный слой Signed-off-by: Ivan Pchelintsev <i.pchelintsev@yadro.com>
This commit is contained in:
parent
905f683bf1
commit
2800fff041
57 changed files with 5760 additions and 0 deletions
32
sdk/src/FrostFS.SDK.ModelsV2/ContainerId.cs
Normal file
32
sdk/src/FrostFS.SDK.ModelsV2/ContainerId.cs
Normal file
|
@ -0,0 +1,32 @@
|
|||
using FrostFS.SDK.Cryptography;
|
||||
|
||||
namespace FrostFS.SDK.ModelsV2;
|
||||
|
||||
public class ContainerId
|
||||
{
|
||||
public string Value { get; }
|
||||
|
||||
public ContainerId(string id)
|
||||
{
|
||||
Value = id;
|
||||
}
|
||||
|
||||
public static ContainerId FromHash(byte[] hash)
|
||||
{
|
||||
if (hash.Length != Helper.Sha256HashLength)
|
||||
{
|
||||
throw new FormatException("ContainerID must be a sha256 hash.");
|
||||
}
|
||||
return new ContainerId(Base58.Encode(hash));
|
||||
}
|
||||
|
||||
public byte[] ToHash()
|
||||
{
|
||||
return Base58.Decode(Value);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Value;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue