use of org.apache.hadoop.hive.llap.security.LlapSigner.Signable in project hive by apache.
the class NotTezEventHelper method createSignableNotTezEvent.
public static Signable createSignableNotTezEvent(InputDataInformationEvent event, String vertexName, String destInputName) {
final NotTezEvent.Builder builder = NotTezEvent.newBuilder().setInputEventProtoBytes(ProtoConverters.convertRootInputDataInformationEventToProto(event).toByteString()).setVertexName(vertexName).setDestInputName(destInputName);
return new Signable() {
@Override
public void setSignInfo(int masterKeyId) {
builder.setKeyId(masterKeyId);
}
@Override
public byte[] serialize() throws IOException {
NotTezEvent nte = builder.build();
ByteArrayOutputStream baos = new ByteArrayOutputStream(nte.getSerializedSize());
nte.writeTo(baos);
return baos.toByteArray();
}
};
}
use of org.apache.hadoop.hive.llap.security.LlapSigner.Signable in project hive by apache.
the class GenericUDTFGetSplits method makeEventBytes.
private SignedMessage makeEventBytes(Vertex wx, String vertexName, Event event, LlapSigner signer) throws IOException {
assert event instanceof InputDataInformationEvent;
List<RootInputLeafOutput<InputDescriptor, InputInitializerDescriptor>> inputs = TaskSpecBuilder.getVertexInputs(wx);
Preconditions.checkState(inputs.size() == 1);
Signable signableNte = NotTezEventHelper.createSignableNotTezEvent((InputDataInformationEvent) event, vertexName, inputs.get(0).getName());
if (signer != null) {
return signer.serializeAndSign(signableNte);
} else {
SignedMessage sm = new SignedMessage();
sm.message = signableNte.serialize();
return sm;
}
}
use of org.apache.hadoop.hive.llap.security.LlapSigner.Signable in project hive by apache.
the class GenericUDTFGetSplits method createSignedVertexSpec.
private SignedMessage createSignedVertexSpec(LlapSigner signer, TaskSpec taskSpec, ApplicationId applicationId, String queryUser, String queryIdString) throws IOException {
QueryIdentifierProto queryIdentifierProto = QueryIdentifierProto.newBuilder().setApplicationIdString(applicationId.toString()).setDagIndex(taskSpec.getDagIdentifier()).setAppAttemptNumber(0).build();
final SignableVertexSpec.Builder svsb = Converters.constructSignableVertexSpec(taskSpec, queryIdentifierProto, applicationId.toString(), queryUser, queryIdString);
if (signer == null) {
SignedMessage result = new SignedMessage();
result.message = serializeVertexSpec(svsb);
return result;
}
return signer.serializeAndSign(new Signable() {
@Override
public void setSignInfo(int masterKeyId) {
svsb.setSignatureKeyId(masterKeyId);
}
@Override
public byte[] serialize() throws IOException {
return serializeVertexSpec(svsb);
}
});
}
Aggregations