[#28] Client: Move CalculateObjectId from IFrostFsClient to statis tools
Signed-off-by: Pavel Gross <p.gross@yadro.com>
This commit is contained in:
parent
543247e4d9
commit
db9b93b2e6
4 changed files with 23 additions and 20 deletions
|
@ -290,14 +290,6 @@ public class FrostFSClient : IFrostFSClient
|
||||||
{
|
{
|
||||||
return GetObjectService().SearchObjectsAsync(args, ctx);
|
return GetObjectService().SearchObjectsAsync(args, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FrostFsObjectId CalculateObjectId(FrostFsObjectHeader header)
|
|
||||||
{
|
|
||||||
if (header == null)
|
|
||||||
throw new ArgumentNullException(nameof(header));
|
|
||||||
|
|
||||||
return ObjectTools.CalculateObjectId(header, ClientCtx.Owner, ClientCtx.Version, ClientCtx.Key);
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Session Implementation
|
#region Session Implementation
|
||||||
|
|
|
@ -65,6 +65,4 @@ public interface IFrostFSClient
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public Task<string?> Dial(CallContext ctx);
|
public Task<string?> Dial(CallContext ctx);
|
||||||
|
|
||||||
FrostFsObjectId CalculateObjectId(FrostFsObjectHeader header);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -646,14 +646,6 @@ public partial class Pool : IFrostFSClient
|
||||||
return client.Client!.SearchObjectsAsync(args, ctx);
|
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)
|
public async Task<Accounting.Decimal> GetBalanceAsync(CallContext ctx)
|
||||||
{
|
{
|
||||||
var client = Connection();
|
var client = Connection();
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
using FrostFS.Object;
|
using FrostFS.Object;
|
||||||
|
@ -9,14 +10,34 @@ using Google.Protobuf;
|
||||||
|
|
||||||
namespace FrostFS.SDK.Client;
|
namespace FrostFS.SDK.Client;
|
||||||
|
|
||||||
internal static class ObjectTools
|
public static class ObjectTools
|
||||||
{
|
{
|
||||||
internal static FrostFsObjectId CalculateObjectId(
|
public static FrostFsObjectId CalculateObjectId(
|
||||||
FrostFsObjectHeader header,
|
FrostFsObjectHeader header,
|
||||||
FrostFsOwner owner,
|
FrostFsOwner owner,
|
||||||
FrostFsVersion version,
|
FrostFsVersion version,
|
||||||
ClientKey key)
|
ClientKey key)
|
||||||
{
|
{
|
||||||
|
if (header is null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(header));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (owner is null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(owner));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (version is null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(version));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key is null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(key));
|
||||||
|
}
|
||||||
|
|
||||||
var grpcHeader = CreateHeader(header, [], owner, version);
|
var grpcHeader = CreateHeader(header, [], owner, version);
|
||||||
|
|
||||||
if (header.Split != null)
|
if (header.Split != null)
|
||||||
|
|
Loading…
Reference in a new issue