[#40] Client: Add memory optimization for hash
Signed-off-by: Pavel Gross <p.gross@yadro.com>
This commit is contained in:
parent
32a7e64538
commit
809bd90352
17 changed files with 170 additions and 64 deletions
|
@ -42,8 +42,8 @@ public class AsyncStreamReaderMock(string key, FrostFsObjectHeader objectHeader)
|
|||
ObjectId = new Refs.ObjectID { Value = ByteString.CopyFrom(SHA256.HashData(Array.Empty<byte>())) },
|
||||
Signature = new Refs.Signature
|
||||
{
|
||||
Key = ByteString.CopyFrom(Key.PublicKey()),
|
||||
Sign = Key.SignData(header.ToByteArray()),
|
||||
Key = Key.PublicKeyProto,
|
||||
Sign = Key.ECDsaKey. SignData(header.ToByteArray()),
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace FrostFS.SDK.Tests;
|
|||
public abstract class ServiceBase(string key)
|
||||
{
|
||||
public string StringKey { get; private set; } = key;
|
||||
public ECDsa Key { get; private set; } = key.LoadWif();
|
||||
public ClientKey Key { get; private set; } = new ClientKey(key.LoadWif());
|
||||
public FrostFsVersion Version { get; set; } = DefaultVersion;
|
||||
public FrostFsPlacementPolicy PlacementPolicy { get; set; } = DefaultPlacementPolicy;
|
||||
|
||||
|
@ -44,21 +44,21 @@ public abstract class ServiceBase(string key)
|
|||
{
|
||||
MetaSignature = new Refs.Signature
|
||||
{
|
||||
Key = ByteString.CopyFrom(Key.PublicKey()),
|
||||
Key = Key.PublicKeyProto,
|
||||
Scheme = Refs.SignatureScheme.EcdsaRfc6979Sha256,
|
||||
Sign = Key.SignData(response.MetaHeader.ToByteArray())
|
||||
Sign = Key.ECDsaKey.SignData(response.MetaHeader.ToByteArray())
|
||||
},
|
||||
BodySignature = new Refs.Signature
|
||||
{
|
||||
Key = ByteString.CopyFrom(Key.PublicKey()),
|
||||
Key = Key.PublicKeyProto,
|
||||
Scheme = Refs.SignatureScheme.EcdsaRfc6979Sha256,
|
||||
Sign = Key.SignData(response.GetBody().ToByteArray())
|
||||
Sign = Key.ECDsaKey.SignData(response.GetBody().ToByteArray())
|
||||
},
|
||||
OriginSignature = new Refs.Signature
|
||||
{
|
||||
Key = ByteString.CopyFrom(Key.PublicKey()),
|
||||
Key = Key.PublicKeyProto,
|
||||
Scheme = Refs.SignatureScheme.EcdsaRfc6979Sha256,
|
||||
Sign = Key.SignData([])
|
||||
Sign = Key.ECDsaKey.SignData(ReadOnlyMemory<byte>.Empty)
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -92,8 +92,8 @@ public class ObjectMocker(string key) : ObjectServiceBase(key)
|
|||
|
||||
headResponse.Body.Header.Signature = new Refs.Signature
|
||||
{
|
||||
Key = ByteString.CopyFrom(Key.PublicKey()),
|
||||
Sign = Key.SignData(headResponse.Body.Header.ToByteArray()),
|
||||
Key = Key.PublicKeyProto,
|
||||
Sign = Key.ECDsaKey.SignData(headResponse.Body.Header.ToByteArray()),
|
||||
};
|
||||
|
||||
headResponse.VerifyHeader = GetResponseVerificationHeader(headResponse);
|
||||
|
|
|
@ -55,10 +55,10 @@ public class ObjectTests(ITestOutputHelper testOutputHelper) : SmokeTestsBase
|
|||
|
||||
private async Task RunSuite(IFrostFSClient client, FrostFsContainerId containerId)
|
||||
{
|
||||
int[] objectSizes = [1, 257, 6 * 1024, 20 * 1024];
|
||||
int[] objectSizes = [1, 257, 5 * 1024 * 1024, 20 * 1024 * 1024];
|
||||
|
||||
string[] objectTypes = [clientCut, serverCut, singleObject];
|
||||
|
||||
|
||||
foreach (var objectSize in objectSizes)
|
||||
{
|
||||
_testOutputHelper.WriteLine($"test set for object size {objectSize}");
|
||||
|
@ -77,13 +77,13 @@ public class ObjectTests(ITestOutputHelper testOutputHelper) : SmokeTestsBase
|
|||
break;
|
||||
case clientCut:
|
||||
objectId = await CreateObjectClientCut(client, containerId, bytes);
|
||||
_testOutputHelper.WriteLine($"\tclient side cut");
|
||||
_testOutputHelper.WriteLine($"\tclient side cut");
|
||||
break;
|
||||
case singleObject:
|
||||
if (objectSize > 1 * 1024 * 1024)
|
||||
continue;
|
||||
objectId = await PutSingleObject(client, containerId, bytes);
|
||||
_testOutputHelper.WriteLine($"\tput single object");
|
||||
_testOutputHelper.WriteLine($"\tput single object");
|
||||
|
||||
break;
|
||||
default:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue