Search in sources :

Example 1 with Signable

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();
        }
    };
}
Also used : NotTezEvent(org.apache.hadoop.hive.llap.daemon.rpc.LlapDaemonProtocolProtos.NotTezEvent) Signable(org.apache.hadoop.hive.llap.security.LlapSigner.Signable) ByteArrayOutputStream(java.io.ByteArrayOutputStream)

Example 2 with Signable

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;
    }
}
Also used : RootInputLeafOutput(org.apache.tez.dag.api.RootInputLeafOutput) SignedMessage(org.apache.hadoop.hive.llap.security.LlapSigner.SignedMessage) Signable(org.apache.hadoop.hive.llap.security.LlapSigner.Signable) InputDataInformationEvent(org.apache.tez.runtime.api.events.InputDataInformationEvent)

Example 3 with Signable

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);
        }
    });
}
Also used : SignableVertexSpec(org.apache.hadoop.hive.llap.daemon.rpc.LlapDaemonProtocolProtos.SignableVertexSpec) SignedMessage(org.apache.hadoop.hive.llap.security.LlapSigner.SignedMessage) Signable(org.apache.hadoop.hive.llap.security.LlapSigner.Signable) QueryIdentifierProto(org.apache.hadoop.hive.llap.daemon.rpc.LlapDaemonProtocolProtos.QueryIdentifierProto) IOException(java.io.IOException) TaskLocationHint(org.apache.tez.dag.api.TaskLocationHint)

Aggregations

Signable (org.apache.hadoop.hive.llap.security.LlapSigner.Signable)3 SignedMessage (org.apache.hadoop.hive.llap.security.LlapSigner.SignedMessage)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 IOException (java.io.IOException)1 NotTezEvent (org.apache.hadoop.hive.llap.daemon.rpc.LlapDaemonProtocolProtos.NotTezEvent)1 QueryIdentifierProto (org.apache.hadoop.hive.llap.daemon.rpc.LlapDaemonProtocolProtos.QueryIdentifierProto)1 SignableVertexSpec (org.apache.hadoop.hive.llap.daemon.rpc.LlapDaemonProtocolProtos.SignableVertexSpec)1 RootInputLeafOutput (org.apache.tez.dag.api.RootInputLeafOutput)1 TaskLocationHint (org.apache.tez.dag.api.TaskLocationHint)1 InputDataInformationEvent (org.apache.tez.runtime.api.events.InputDataInformationEvent)1