[#28] Client: add method to calculate ObjectId

Signed-off-by: Pavel Gross <p.gross@yadro.com>
This commit is contained in:
Pavel Gross 2024-12-09 23:54:50 +03:00 committed by PavelGrossSpb
parent abd9b5d0d0
commit 543247e4d9
6 changed files with 55 additions and 13 deletions

View file

@ -39,6 +39,8 @@ public partial class Pool : IFrostFSClient
private OwnerID? _ownerId;
private FrostFsVersion _version;
private FrostFsOwner? _owner;
private FrostFsOwner Owner
@ -94,6 +96,8 @@ public partial class Pool : IFrostFSClient
throw new ArgumentException($"Missed required parameter {nameof(options.Key)}");
}
_version = new FrostFsVersion(2, 13);
var nodesParams = AdjustNodeParams(options.NodeParams);
var cache = new SessionCache(options.SessionExpirationDuration);
@ -642,6 +646,14 @@ public partial class Pool : IFrostFSClient
return client.Client!.SearchObjectsAsync(args, ctx);
}
public FrostFsObjectId CalculateObjectId(FrostFsObjectHeader header)
{
if (header == null)
throw new ArgumentNullException(nameof(header));
return ObjectTools.CalculateObjectId(header, Owner, _version, Key);
}
public async Task<Accounting.Decimal> GetBalanceAsync(CallContext ctx)
{
var client = Connection();