Skip to content

Commit 6635b88

Browse files
committed
YT-24021: Support signatures in job proxy via exec node
commit_hash:b6af9463fe3d052031f6de19a0d349b2296c2e23
1 parent c9ad3d7 commit 6635b88

File tree

4 files changed

+47
-0
lines changed

4 files changed

+47
-0
lines changed

yt/yt/client/signature/signature.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,19 @@ void Serialize(const TSignature& signature, IYsonConsumer* consumer)
3131
consumer->OnEndMap();
3232
}
3333

34+
void ToProto(NProto::TSignature* protoSignature, const TSignature& signature)
35+
{
36+
auto headerBuf = signature.Header_.AsStringBuf();
37+
protoSignature->set_header(headerBuf.Data(), headerBuf.Size());
38+
protoSignature->set_payload(signature.Payload_);
39+
protoSignature->set_signature(signature.Signature_);
40+
}
41+
42+
void ToProto(NProto::TSignature* protoSignature, const TSignaturePtr& signature)
43+
{
44+
ToProto(protoSignature, *signature);
45+
}
46+
3447
////////////////////////////////////////////////////////////////////////////////
3548

3649
void Deserialize(TSignature& signature, INodePtr node)
@@ -46,6 +59,19 @@ void Deserialize(TSignature& signature, TYsonPullParserCursor* cursor)
4659
Deserialize(signature, ExtractTo<INodePtr>(cursor));
4760
}
4861

62+
void FromProto(TSignature* signature, const NProto::TSignature& protoSignature)
63+
{
64+
signature->Header_ = TYsonString(protoSignature.header());
65+
signature->Payload_ = protoSignature.payload();
66+
signature->Signature_ = protoSignature.signature();
67+
}
68+
69+
void FromProto(TSignaturePtr* signature, const NProto::TSignature& protoSignature)
70+
{
71+
*signature = New<TSignature>();
72+
FromProto(signature->Get(), protoSignature);
73+
}
74+
4975
////////////////////////////////////////////////////////////////////////////////
5076

5177
} // namespace NYT::NSignature

yt/yt/client/signature/signature.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
#include <yt/yt/core/ytree/public.h>
88

9+
#include <yt/yt_proto/yt/client/misc/proto/signature.pb.h>
10+
911
#include <vector>
1012

1113
namespace NYT::NSignature {
@@ -36,6 +38,12 @@ class TSignature final
3638
friend void Serialize(const TSignature& signature, NYson::IYsonConsumer* consumer);
3739
friend void Deserialize(TSignature& signature, NYTree::INodePtr node);
3840
friend void Deserialize(TSignature& signature, NYson::TYsonPullParserCursor* cursor);
41+
42+
friend void FromProto(TSignature* signature, const NProto::TSignature& protoSignature);
43+
friend void ToProto(NProto::TSignature* protoSignature, const TSignature& signature);
44+
45+
friend void FromProto(TSignaturePtr* signature, const NProto::TSignature& protoSignature);
46+
friend void ToProto(NProto::TSignature* protoSignature, const TSignaturePtr& signature);
3947
};
4048

4149
DEFINE_REFCOUNTED_TYPE(TSignature)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package NYT.NSignature.NProto;
2+
3+
////////////////////////////////////////////////////////////////////////////////
4+
5+
message TSignature
6+
{
7+
required bytes header = 1;
8+
required bytes payload = 2;
9+
required bytes signature = 3;
10+
}
11+
12+
////////////////////////////////////////////////////////////////////////////////

yt/yt_proto/yt/client/ya.make

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ SRCS(
4949
scheduler/proto/spec_patch.proto
5050

5151
misc/proto/workload.proto
52+
misc/proto/signature.proto
5253
)
5354

5455
EXCLUDE_TAGS(GO_PROTO)

0 commit comments

Comments
 (0)