[#1] Add object Search operation

Signed-off-by: Ivan Pchelintsev <i.pchelintsev@yadro.com>
This commit is contained in:
Ivan Pchelintsev 2024-05-17 11:52:38 +03:00
parent 63f91ac627
commit bb55d093fa
5 changed files with 156 additions and 4 deletions

View file

@ -1,5 +1,7 @@
using FrostFS.Object;
using FrostFS.SDK.ModelsV2;
using MatchType = FrostFS.Object.MatchType;
using ObjectType = FrostFS.Object.ObjectType;
namespace FrostFS.SDK.ClientV2.Mappers.GRPC;
@ -20,7 +22,26 @@ public static class ObjectAttributeMapper
}
}
public static class ObjectHeadMapper
public static class ObjectFilterMapper
{
public static SearchRequest.Types.Body.Types.Filter ToGrpcMessage(this ObjectFilter filter)
{
var objMatchTypeName = Enum.GetName(typeof(MatchType), filter.MatchType);
if (objMatchTypeName is null)
{
throw new ArgumentException($"Unknown MatchType. Value: '{filter.MatchType}'.");
}
return new SearchRequest.Types.Body.Types.Filter
{
MatchType = Enum.Parse<MatchType>(objMatchTypeName),
Key = filter.Key,
Value = filter.Value
};
}
}
public static class ObjectHeaderMapper
{
public static Header ToGrpcMessage(this ObjectHeader header)
{