[#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
|
@ -2,13 +2,13 @@ using FrostFS.Refs;
|
|||
using FrostFS.SDK.ClientV2;
|
||||
using FrostFS.SDK.ClientV2.Interfaces;
|
||||
using FrostFS.SDK.ClientV2.Mappers.GRPC;
|
||||
using FrostFS.SDK.ClientV2.Parameters;
|
||||
using FrostFS.SDK.ClientV2;
|
||||
using FrostFS.SDK.Cryptography;
|
||||
using FrostFS.SDK.ModelsV2;
|
||||
using FrostFS.SDK.ModelsV2.Enums;
|
||||
using FrostFS.SDK.ModelsV2.Netmap;
|
||||
|
||||
using Google.Protobuf;
|
||||
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
|
@ -19,7 +19,7 @@ public abstract class ObjectTestsBase
|
|||
protected static readonly string key = "KwHDAJ66o8FoLBjVbjP2sWBmgBMGjt7Vv4boA7xQrBoAYBE397Aq";
|
||||
|
||||
protected IOptions<SingleOwnerClientSettings> Settings { get; set; }
|
||||
protected ContainerId ContainerId { get; set; }
|
||||
protected FrostFsContainerId ContainerId { get; set; }
|
||||
|
||||
protected NetworkMocker NetworkMocker { get; set; } = new NetworkMocker(key);
|
||||
protected SessionMocker SessionMocker { get; set; } = new SessionMocker(key);
|
||||
|
@ -38,18 +38,20 @@ public abstract class ObjectTestsBase
|
|||
|
||||
Mocker = new ObjectMocker(key)
|
||||
{
|
||||
PlacementPolicy = new PlacementPolicy(true, new Replica(1)),
|
||||
Version = new ModelsV2.Version(2, 13),
|
||||
PlacementPolicy = new FrostFsPlacementPolicy(true, new FrostFsReplica(1)),
|
||||
Version = new FrostFsVersion(2, 13),
|
||||
ContainerGuid = Guid.NewGuid()
|
||||
};
|
||||
|
||||
ContainerId = new ContainerId(Base58.Encode(Mocker.ContainerGuid.ToBytes()));
|
||||
ContainerId = new FrostFsContainerId(Base58.Encode(Mocker.ContainerGuid.ToBytes()));
|
||||
|
||||
Mocker.ObjectHeader = new(ContainerId, ModelsV2.Enums.ObjectType.Regular, [new ObjectAttribute("k", "v")])
|
||||
{
|
||||
Version = new ModelsV2.Version(2, 13),
|
||||
OwnerId = OwnerId.FromKey(ecdsaKey)
|
||||
};
|
||||
Mocker.ObjectHeader = new(
|
||||
ContainerId,
|
||||
FrostFsObjectType.Regular,
|
||||
[new FrostFsAttribute("k", "v")],
|
||||
null,
|
||||
FrostFsOwner.FromKey(ecdsaKey),
|
||||
new FrostFsVersion(2, 13));
|
||||
}
|
||||
|
||||
protected IFrostFSClient GetClient()
|
||||
|
@ -75,8 +77,8 @@ public class ObjectTest : ObjectTestsBase
|
|||
|
||||
var ctx = new Context {
|
||||
Key = ecdsaKey,
|
||||
OwnerId = OwnerId.FromKey(ecdsaKey),
|
||||
Version = new ModelsV2.Version(2, 13) };
|
||||
OwnerId = FrostFsOwner.FromKey(ecdsaKey),
|
||||
Version = new FrostFsVersion(2, 13) };
|
||||
|
||||
var objectId = client.CalculateObjectId(Mocker.ObjectHeader!, ctx);
|
||||
|
||||
|
@ -218,7 +220,7 @@ public class ObjectTest : ObjectTestsBase
|
|||
Assert.Equal("k", linkObject.Header.Split.ParentHeader.Attributes[0].Key);
|
||||
Assert.Equal("v", linkObject.Header.Split.ParentHeader.Attributes[0].Value);
|
||||
|
||||
var modelObjId = ObjectId.FromHash(linkObject.Header.Split.Parent.Value.ToByteArray());
|
||||
var modelObjId = FrostFsObjectId.FromHash(linkObject.Header.Split.Parent.Value.ToByteArray());
|
||||
|
||||
Assert.Equal(result.Value, modelObjId.ToString());
|
||||
}
|
||||
|
@ -256,7 +258,7 @@ public class ObjectTest : ObjectTestsBase
|
|||
|
||||
Assert.Equal(Mocker.HeadResponse!.PayloadLength, response.PayloadLength);
|
||||
|
||||
Assert.Equal(ObjectType.Regular, response.ObjectType);
|
||||
Assert.Equal(FrostFsObjectType.Regular, response.ObjectType);
|
||||
|
||||
Assert.Single(response.Attributes);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue