Repository: sentry Updated Branches: refs/heads/sentry-ha-redesign a29596e5f -> 688c11668
SENTRY-1782: Add an HMS image ID to the thrift schema definition for hdfs/sentry requests (Sergio Pena, reviewed by Alex Kolbasov) Project: http://git-wip-us.apache.org/repos/asf/sentry/repo Commit: http://git-wip-us.apache.org/repos/asf/sentry/commit/688c1166 Tree: http://git-wip-us.apache.org/repos/asf/sentry/tree/688c1166 Diff: http://git-wip-us.apache.org/repos/asf/sentry/diff/688c1166 Branch: refs/heads/sentry-ha-redesign Commit: 688c116682fb5bb5d31c03e5b067829b9b2a5408 Parents: a29596e Author: Alexander Kolbasov <[email protected]> Authored: Fri Jun 16 16:00:47 2017 -0700 Committer: Alexander Kolbasov <[email protected]> Committed: Fri Jun 16 16:00:47 2017 -0700 ---------------------------------------------------------------------- .../hdfs/service/thrift/SentryHDFSService.java | 860 ++++++++++++++++++- .../service/thrift/TAuthzUpdateRequest.java | 577 +++++++++++++ .../hdfs/service/thrift/TPathsUpdate.java | 111 ++- .../thrift/sentry_hdfs_serviceConstants.java | 41 + .../main/resources/sentry_hdfs_service.thrift | 11 + .../SentryHDFSServiceClientDefaultImpl.java | 6 +- .../sentry/hdfs/SentryHDFSServiceProcessor.java | 18 +- 7 files changed, 1612 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/sentry/blob/688c1166/sentry-hdfs/sentry-hdfs-common/src/gen/thrift/gen-javabean/org/apache/sentry/hdfs/service/thrift/SentryHDFSService.java ---------------------------------------------------------------------- diff --git a/sentry-hdfs/sentry-hdfs-common/src/gen/thrift/gen-javabean/org/apache/sentry/hdfs/service/thrift/SentryHDFSService.java b/sentry-hdfs/sentry-hdfs-common/src/gen/thrift/gen-javabean/org/apache/sentry/hdfs/service/thrift/SentryHDFSService.java index 29178d9..ac1fa6a 100644 --- a/sentry-hdfs/sentry-hdfs-common/src/gen/thrift/gen-javabean/org/apache/sentry/hdfs/service/thrift/SentryHDFSService.java +++ b/sentry-hdfs/sentry-hdfs-common/src/gen/thrift/gen-javabean/org/apache/sentry/hdfs/service/thrift/SentryHDFSService.java @@ -34,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2017-04-26") +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2017-06-12") public class SentryHDFSService { public interface Iface { @@ -45,6 +45,8 @@ public class SentryHDFSService { public TAuthzUpdateResponse get_all_authz_updates_from(long permSeqNum, long pathSeqNum) throws org.apache.thrift.TException; + public TAuthzUpdateResponse get_authz_updates(TAuthzUpdateRequest request) throws org.apache.thrift.TException; + public Map<String,List<String>> get_all_related_paths(String path, boolean exactMatch) throws org.apache.thrift.TException; } @@ -57,6 +59,8 @@ public class SentryHDFSService { public void get_all_authz_updates_from(long permSeqNum, long pathSeqNum, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void get_authz_updates(TAuthzUpdateRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void get_all_related_paths(String path, boolean exactMatch, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; } @@ -148,6 +152,29 @@ public class SentryHDFSService { throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "get_all_authz_updates_from failed: unknown result"); } + public TAuthzUpdateResponse get_authz_updates(TAuthzUpdateRequest request) throws org.apache.thrift.TException + { + send_get_authz_updates(request); + return recv_get_authz_updates(); + } + + public void send_get_authz_updates(TAuthzUpdateRequest request) throws org.apache.thrift.TException + { + get_authz_updates_args args = new get_authz_updates_args(); + args.setRequest(request); + sendBase("get_authz_updates", args); + } + + public TAuthzUpdateResponse recv_get_authz_updates() throws org.apache.thrift.TException + { + get_authz_updates_result result = new get_authz_updates_result(); + receiveBase(result, "get_authz_updates"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "get_authz_updates failed: unknown result"); + } + public Map<String,List<String>> get_all_related_paths(String path, boolean exactMatch) throws org.apache.thrift.TException { send_get_all_related_paths(path, exactMatch); @@ -289,6 +316,38 @@ public class SentryHDFSService { } } + public void get_authz_updates(TAuthzUpdateRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + get_authz_updates_call method_call = new get_authz_updates_call(request, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class get_authz_updates_call extends org.apache.thrift.async.TAsyncMethodCall { + private TAuthzUpdateRequest request; + public get_authz_updates_call(TAuthzUpdateRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.request = request; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("get_authz_updates", org.apache.thrift.protocol.TMessageType.CALL, 0)); + get_authz_updates_args args = new get_authz_updates_args(); + args.setRequest(request); + args.write(prot); + prot.writeMessageEnd(); + } + + public TAuthzUpdateResponse getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_get_authz_updates(); + } + } + public void get_all_related_paths(String path, boolean exactMatch, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { checkReady(); get_all_related_paths_call method_call = new get_all_related_paths_call(path, exactMatch, resultHandler, this, ___protocolFactory, ___transport); @@ -340,6 +399,7 @@ public class SentryHDFSService { processMap.put("handle_hms_notification", new handle_hms_notification()); processMap.put("check_hms_seq_num", new check_hms_seq_num()); processMap.put("get_all_authz_updates_from", new get_all_authz_updates_from()); + processMap.put("get_authz_updates", new get_authz_updates()); processMap.put("get_all_related_paths", new get_all_related_paths()); return processMap; } @@ -405,6 +465,26 @@ public class SentryHDFSService { } } + public static class get_authz_updates<I extends Iface> extends org.apache.thrift.ProcessFunction<I, get_authz_updates_args> { + public get_authz_updates() { + super("get_authz_updates"); + } + + public get_authz_updates_args getEmptyArgsInstance() { + return new get_authz_updates_args(); + } + + protected boolean isOneway() { + return false; + } + + public get_authz_updates_result getResult(I iface, get_authz_updates_args args) throws org.apache.thrift.TException { + get_authz_updates_result result = new get_authz_updates_result(); + result.success = iface.get_authz_updates(args.request); + return result; + } + } + public static class get_all_related_paths<I extends Iface> extends org.apache.thrift.ProcessFunction<I, get_all_related_paths_args> { public get_all_related_paths() { super("get_all_related_paths"); @@ -441,6 +521,7 @@ public class SentryHDFSService { processMap.put("handle_hms_notification", new handle_hms_notification()); processMap.put("check_hms_seq_num", new check_hms_seq_num()); processMap.put("get_all_authz_updates_from", new get_all_authz_updates_from()); + processMap.put("get_authz_updates", new get_authz_updates()); processMap.put("get_all_related_paths", new get_all_related_paths()); return processMap; } @@ -598,6 +679,57 @@ public class SentryHDFSService { } } + public static class get_authz_updates<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, get_authz_updates_args, TAuthzUpdateResponse> { + public get_authz_updates() { + super("get_authz_updates"); + } + + public get_authz_updates_args getEmptyArgsInstance() { + return new get_authz_updates_args(); + } + + public AsyncMethodCallback<TAuthzUpdateResponse> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback<TAuthzUpdateResponse>() { + public void onComplete(TAuthzUpdateResponse o) { + get_authz_updates_result result = new get_authz_updates_result(); + result.success = o; + try { + fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + get_authz_updates_result result = new get_authz_updates_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb,msg,msgType,seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, get_authz_updates_args args, org.apache.thrift.async.AsyncMethodCallback<TAuthzUpdateResponse> resultHandler) throws TException { + iface.get_authz_updates(args.request,resultHandler); + } + } + public static class get_all_related_paths<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, get_all_related_paths_args, Map<String,List<String>>> { public get_all_related_paths() { super("get_all_related_paths"); @@ -2791,6 +2923,732 @@ public class SentryHDFSService { } + public static class get_authz_updates_args implements org.apache.thrift.TBase<get_authz_updates_args, get_authz_updates_args._Fields>, java.io.Serializable, Cloneable, Comparable<get_authz_updates_args> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("get_authz_updates_args"); + + private static final org.apache.thrift.protocol.TField REQUEST_FIELD_DESC = new org.apache.thrift.protocol.TField("request", org.apache.thrift.protocol.TType.STRUCT, (short)1); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new get_authz_updates_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new get_authz_updates_argsTupleSchemeFactory()); + } + + private TAuthzUpdateRequest request; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + REQUEST((short)1, "request"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // REQUEST + return REQUEST; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.REQUEST, new org.apache.thrift.meta_data.FieldMetaData("request", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TAuthzUpdateRequest.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(get_authz_updates_args.class, metaDataMap); + } + + public get_authz_updates_args() { + } + + public get_authz_updates_args( + TAuthzUpdateRequest request) + { + this(); + this.request = request; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public get_authz_updates_args(get_authz_updates_args other) { + if (other.isSetRequest()) { + this.request = new TAuthzUpdateRequest(other.request); + } + } + + public get_authz_updates_args deepCopy() { + return new get_authz_updates_args(this); + } + + @Override + public void clear() { + this.request = null; + } + + public TAuthzUpdateRequest getRequest() { + return this.request; + } + + public void setRequest(TAuthzUpdateRequest request) { + this.request = request; + } + + public void unsetRequest() { + this.request = null; + } + + /** Returns true if field request is set (has been assigned a value) and false otherwise */ + public boolean isSetRequest() { + return this.request != null; + } + + public void setRequestIsSet(boolean value) { + if (!value) { + this.request = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case REQUEST: + if (value == null) { + unsetRequest(); + } else { + setRequest((TAuthzUpdateRequest)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case REQUEST: + return getRequest(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case REQUEST: + return isSetRequest(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof get_authz_updates_args) + return this.equals((get_authz_updates_args)that); + return false; + } + + public boolean equals(get_authz_updates_args that) { + if (that == null) + return false; + + boolean this_present_request = true && this.isSetRequest(); + boolean that_present_request = true && that.isSetRequest(); + if (this_present_request || that_present_request) { + if (!(this_present_request && that_present_request)) + return false; + if (!this.request.equals(that.request)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_request = true && (isSetRequest()); + list.add(present_request); + if (present_request) + list.add(request); + + return list.hashCode(); + } + + @Override + public int compareTo(get_authz_updates_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetRequest()).compareTo(other.isSetRequest()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetRequest()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.request, other.request); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("get_authz_updates_args("); + boolean first = true; + + sb.append("request:"); + if (this.request == null) { + sb.append("null"); + } else { + sb.append(this.request); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (request != null) { + request.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class get_authz_updates_argsStandardSchemeFactory implements SchemeFactory { + public get_authz_updates_argsStandardScheme getScheme() { + return new get_authz_updates_argsStandardScheme(); + } + } + + private static class get_authz_updates_argsStandardScheme extends StandardScheme<get_authz_updates_args> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, get_authz_updates_args struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // REQUEST + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.request = new TAuthzUpdateRequest(); + struct.request.read(iprot); + struct.setRequestIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, get_authz_updates_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.request != null) { + oprot.writeFieldBegin(REQUEST_FIELD_DESC); + struct.request.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class get_authz_updates_argsTupleSchemeFactory implements SchemeFactory { + public get_authz_updates_argsTupleScheme getScheme() { + return new get_authz_updates_argsTupleScheme(); + } + } + + private static class get_authz_updates_argsTupleScheme extends TupleScheme<get_authz_updates_args> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, get_authz_updates_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetRequest()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetRequest()) { + struct.request.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, get_authz_updates_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.request = new TAuthzUpdateRequest(); + struct.request.read(iprot); + struct.setRequestIsSet(true); + } + } + } + + } + + public static class get_authz_updates_result implements org.apache.thrift.TBase<get_authz_updates_result, get_authz_updates_result._Fields>, java.io.Serializable, Cloneable, Comparable<get_authz_updates_result> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("get_authz_updates_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new get_authz_updates_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new get_authz_updates_resultTupleSchemeFactory()); + } + + private TAuthzUpdateResponse success; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short)0, "success"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TAuthzUpdateResponse.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(get_authz_updates_result.class, metaDataMap); + } + + public get_authz_updates_result() { + } + + public get_authz_updates_result( + TAuthzUpdateResponse success) + { + this(); + this.success = success; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public get_authz_updates_result(get_authz_updates_result other) { + if (other.isSetSuccess()) { + this.success = new TAuthzUpdateResponse(other.success); + } + } + + public get_authz_updates_result deepCopy() { + return new get_authz_updates_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public TAuthzUpdateResponse getSuccess() { + return this.success; + } + + public void setSuccess(TAuthzUpdateResponse success) { + this.success = success; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((TAuthzUpdateResponse)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof get_authz_updates_result) + return this.equals((get_authz_updates_result)that); + return false; + } + + public boolean equals(get_authz_updates_result that) { + if (that == null) + return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) + return false; + if (!this.success.equals(that.success)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) + list.add(success); + + return list.hashCode(); + } + + @Override + public int compareTo(get_authz_updates_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("get_authz_updates_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (success != null) { + success.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class get_authz_updates_resultStandardSchemeFactory implements SchemeFactory { + public get_authz_updates_resultStandardScheme getScheme() { + return new get_authz_updates_resultStandardScheme(); + } + } + + private static class get_authz_updates_resultStandardScheme extends StandardScheme<get_authz_updates_result> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, get_authz_updates_result struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new TAuthzUpdateResponse(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, get_authz_updates_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class get_authz_updates_resultTupleSchemeFactory implements SchemeFactory { + public get_authz_updates_resultTupleScheme getScheme() { + return new get_authz_updates_resultTupleScheme(); + } + } + + private static class get_authz_updates_resultTupleScheme extends TupleScheme<get_authz_updates_result> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, get_authz_updates_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, get_authz_updates_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = new TAuthzUpdateResponse(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + } + } + + } + public static class get_all_related_paths_args implements org.apache.thrift.TBase<get_all_related_paths_args, get_all_related_paths_args._Fields>, java.io.Serializable, Cloneable, Comparable<get_all_related_paths_args> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("get_all_related_paths_args"); http://git-wip-us.apache.org/repos/asf/sentry/blob/688c1166/sentry-hdfs/sentry-hdfs-common/src/gen/thrift/gen-javabean/org/apache/sentry/hdfs/service/thrift/TAuthzUpdateRequest.java ---------------------------------------------------------------------- diff --git a/sentry-hdfs/sentry-hdfs-common/src/gen/thrift/gen-javabean/org/apache/sentry/hdfs/service/thrift/TAuthzUpdateRequest.java b/sentry-hdfs/sentry-hdfs-common/src/gen/thrift/gen-javabean/org/apache/sentry/hdfs/service/thrift/TAuthzUpdateRequest.java new file mode 100644 index 0000000..62fd0bb --- /dev/null +++ b/sentry-hdfs/sentry-hdfs-common/src/gen/thrift/gen-javabean/org/apache/sentry/hdfs/service/thrift/TAuthzUpdateRequest.java @@ -0,0 +1,577 @@ +/** + * Autogenerated by Thrift Compiler (0.9.3) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.sentry.hdfs.service.thrift; + +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; + +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.server.AbstractNonblockingServer.*; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; +import java.util.EnumMap; +import java.util.Set; +import java.util.HashSet; +import java.util.EnumSet; +import java.util.Collections; +import java.util.BitSet; +import java.nio.ByteBuffer; +import java.util.Arrays; +import javax.annotation.Generated; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2017-06-12") +public class TAuthzUpdateRequest implements org.apache.thrift.TBase<TAuthzUpdateRequest, TAuthzUpdateRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TAuthzUpdateRequest> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAuthzUpdateRequest"); + + private static final org.apache.thrift.protocol.TField PERM_SEQ_NUM_FIELD_DESC = new org.apache.thrift.protocol.TField("permSeqNum", org.apache.thrift.protocol.TType.I64, (short)1); + private static final org.apache.thrift.protocol.TField PATH_SEQ_NUM_FIELD_DESC = new org.apache.thrift.protocol.TField("pathSeqNum", org.apache.thrift.protocol.TType.I64, (short)2); + private static final org.apache.thrift.protocol.TField PATH_IMG_NUM_FIELD_DESC = new org.apache.thrift.protocol.TField("pathImgNum", org.apache.thrift.protocol.TType.I64, (short)3); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new TAuthzUpdateRequestStandardSchemeFactory()); + schemes.put(TupleScheme.class, new TAuthzUpdateRequestTupleSchemeFactory()); + } + + private long permSeqNum; // required + private long pathSeqNum; // required + private long pathImgNum; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + PERM_SEQ_NUM((short)1, "permSeqNum"), + PATH_SEQ_NUM((short)2, "pathSeqNum"), + PATH_IMG_NUM((short)3, "pathImgNum"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // PERM_SEQ_NUM + return PERM_SEQ_NUM; + case 2: // PATH_SEQ_NUM + return PATH_SEQ_NUM; + case 3: // PATH_IMG_NUM + return PATH_IMG_NUM; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __PERMSEQNUM_ISSET_ID = 0; + private static final int __PATHSEQNUM_ISSET_ID = 1; + private static final int __PATHIMGNUM_ISSET_ID = 2; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.PERM_SEQ_NUM, new org.apache.thrift.meta_data.FieldMetaData("permSeqNum", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + tmpMap.put(_Fields.PATH_SEQ_NUM, new org.apache.thrift.meta_data.FieldMetaData("pathSeqNum", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + tmpMap.put(_Fields.PATH_IMG_NUM, new org.apache.thrift.meta_data.FieldMetaData("pathImgNum", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAuthzUpdateRequest.class, metaDataMap); + } + + public TAuthzUpdateRequest() { + } + + public TAuthzUpdateRequest( + long permSeqNum, + long pathSeqNum, + long pathImgNum) + { + this(); + this.permSeqNum = permSeqNum; + setPermSeqNumIsSet(true); + this.pathSeqNum = pathSeqNum; + setPathSeqNumIsSet(true); + this.pathImgNum = pathImgNum; + setPathImgNumIsSet(true); + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public TAuthzUpdateRequest(TAuthzUpdateRequest other) { + __isset_bitfield = other.__isset_bitfield; + this.permSeqNum = other.permSeqNum; + this.pathSeqNum = other.pathSeqNum; + this.pathImgNum = other.pathImgNum; + } + + public TAuthzUpdateRequest deepCopy() { + return new TAuthzUpdateRequest(this); + } + + @Override + public void clear() { + setPermSeqNumIsSet(false); + this.permSeqNum = 0; + setPathSeqNumIsSet(false); + this.pathSeqNum = 0; + setPathImgNumIsSet(false); + this.pathImgNum = 0; + } + + public long getPermSeqNum() { + return this.permSeqNum; + } + + public void setPermSeqNum(long permSeqNum) { + this.permSeqNum = permSeqNum; + setPermSeqNumIsSet(true); + } + + public void unsetPermSeqNum() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PERMSEQNUM_ISSET_ID); + } + + /** Returns true if field permSeqNum is set (has been assigned a value) and false otherwise */ + public boolean isSetPermSeqNum() { + return EncodingUtils.testBit(__isset_bitfield, __PERMSEQNUM_ISSET_ID); + } + + public void setPermSeqNumIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PERMSEQNUM_ISSET_ID, value); + } + + public long getPathSeqNum() { + return this.pathSeqNum; + } + + public void setPathSeqNum(long pathSeqNum) { + this.pathSeqNum = pathSeqNum; + setPathSeqNumIsSet(true); + } + + public void unsetPathSeqNum() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PATHSEQNUM_ISSET_ID); + } + + /** Returns true if field pathSeqNum is set (has been assigned a value) and false otherwise */ + public boolean isSetPathSeqNum() { + return EncodingUtils.testBit(__isset_bitfield, __PATHSEQNUM_ISSET_ID); + } + + public void setPathSeqNumIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PATHSEQNUM_ISSET_ID, value); + } + + public long getPathImgNum() { + return this.pathImgNum; + } + + public void setPathImgNum(long pathImgNum) { + this.pathImgNum = pathImgNum; + setPathImgNumIsSet(true); + } + + public void unsetPathImgNum() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PATHIMGNUM_ISSET_ID); + } + + /** Returns true if field pathImgNum is set (has been assigned a value) and false otherwise */ + public boolean isSetPathImgNum() { + return EncodingUtils.testBit(__isset_bitfield, __PATHIMGNUM_ISSET_ID); + } + + public void setPathImgNumIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PATHIMGNUM_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case PERM_SEQ_NUM: + if (value == null) { + unsetPermSeqNum(); + } else { + setPermSeqNum((Long)value); + } + break; + + case PATH_SEQ_NUM: + if (value == null) { + unsetPathSeqNum(); + } else { + setPathSeqNum((Long)value); + } + break; + + case PATH_IMG_NUM: + if (value == null) { + unsetPathImgNum(); + } else { + setPathImgNum((Long)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case PERM_SEQ_NUM: + return getPermSeqNum(); + + case PATH_SEQ_NUM: + return getPathSeqNum(); + + case PATH_IMG_NUM: + return getPathImgNum(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case PERM_SEQ_NUM: + return isSetPermSeqNum(); + case PATH_SEQ_NUM: + return isSetPathSeqNum(); + case PATH_IMG_NUM: + return isSetPathImgNum(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof TAuthzUpdateRequest) + return this.equals((TAuthzUpdateRequest)that); + return false; + } + + public boolean equals(TAuthzUpdateRequest that) { + if (that == null) + return false; + + boolean this_present_permSeqNum = true; + boolean that_present_permSeqNum = true; + if (this_present_permSeqNum || that_present_permSeqNum) { + if (!(this_present_permSeqNum && that_present_permSeqNum)) + return false; + if (this.permSeqNum != that.permSeqNum) + return false; + } + + boolean this_present_pathSeqNum = true; + boolean that_present_pathSeqNum = true; + if (this_present_pathSeqNum || that_present_pathSeqNum) { + if (!(this_present_pathSeqNum && that_present_pathSeqNum)) + return false; + if (this.pathSeqNum != that.pathSeqNum) + return false; + } + + boolean this_present_pathImgNum = true; + boolean that_present_pathImgNum = true; + if (this_present_pathImgNum || that_present_pathImgNum) { + if (!(this_present_pathImgNum && that_present_pathImgNum)) + return false; + if (this.pathImgNum != that.pathImgNum) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_permSeqNum = true; + list.add(present_permSeqNum); + if (present_permSeqNum) + list.add(permSeqNum); + + boolean present_pathSeqNum = true; + list.add(present_pathSeqNum); + if (present_pathSeqNum) + list.add(pathSeqNum); + + boolean present_pathImgNum = true; + list.add(present_pathImgNum); + if (present_pathImgNum) + list.add(pathImgNum); + + return list.hashCode(); + } + + @Override + public int compareTo(TAuthzUpdateRequest other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetPermSeqNum()).compareTo(other.isSetPermSeqNum()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetPermSeqNum()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.permSeqNum, other.permSeqNum); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetPathSeqNum()).compareTo(other.isSetPathSeqNum()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetPathSeqNum()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pathSeqNum, other.pathSeqNum); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetPathImgNum()).compareTo(other.isSetPathImgNum()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetPathImgNum()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pathImgNum, other.pathImgNum); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("TAuthzUpdateRequest("); + boolean first = true; + + sb.append("permSeqNum:"); + sb.append(this.permSeqNum); + first = false; + if (!first) sb.append(", "); + sb.append("pathSeqNum:"); + sb.append(this.pathSeqNum); + first = false; + if (!first) sb.append(", "); + sb.append("pathImgNum:"); + sb.append(this.pathImgNum); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (!isSetPermSeqNum()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'permSeqNum' is unset! Struct:" + toString()); + } + + if (!isSetPathSeqNum()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'pathSeqNum' is unset! Struct:" + toString()); + } + + if (!isSetPathImgNum()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'pathImgNum' is unset! Struct:" + toString()); + } + + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. + __isset_bitfield = 0; + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class TAuthzUpdateRequestStandardSchemeFactory implements SchemeFactory { + public TAuthzUpdateRequestStandardScheme getScheme() { + return new TAuthzUpdateRequestStandardScheme(); + } + } + + private static class TAuthzUpdateRequestStandardScheme extends StandardScheme<TAuthzUpdateRequest> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, TAuthzUpdateRequest struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // PERM_SEQ_NUM + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.permSeqNum = iprot.readI64(); + struct.setPermSeqNumIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // PATH_SEQ_NUM + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.pathSeqNum = iprot.readI64(); + struct.setPathSeqNumIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // PATH_IMG_NUM + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.pathImgNum = iprot.readI64(); + struct.setPathImgNumIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, TAuthzUpdateRequest struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(PERM_SEQ_NUM_FIELD_DESC); + oprot.writeI64(struct.permSeqNum); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(PATH_SEQ_NUM_FIELD_DESC); + oprot.writeI64(struct.pathSeqNum); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(PATH_IMG_NUM_FIELD_DESC); + oprot.writeI64(struct.pathImgNum); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class TAuthzUpdateRequestTupleSchemeFactory implements SchemeFactory { + public TAuthzUpdateRequestTupleScheme getScheme() { + return new TAuthzUpdateRequestTupleScheme(); + } + } + + private static class TAuthzUpdateRequestTupleScheme extends TupleScheme<TAuthzUpdateRequest> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, TAuthzUpdateRequest struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeI64(struct.permSeqNum); + oprot.writeI64(struct.pathSeqNum); + oprot.writeI64(struct.pathImgNum); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, TAuthzUpdateRequest struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.permSeqNum = iprot.readI64(); + struct.setPermSeqNumIsSet(true); + struct.pathSeqNum = iprot.readI64(); + struct.setPathSeqNumIsSet(true); + struct.pathImgNum = iprot.readI64(); + struct.setPathImgNumIsSet(true); + } + } + +} + http://git-wip-us.apache.org/repos/asf/sentry/blob/688c1166/sentry-hdfs/sentry-hdfs-common/src/gen/thrift/gen-javabean/org/apache/sentry/hdfs/service/thrift/TPathsUpdate.java ---------------------------------------------------------------------- diff --git a/sentry-hdfs/sentry-hdfs-common/src/gen/thrift/gen-javabean/org/apache/sentry/hdfs/service/thrift/TPathsUpdate.java b/sentry-hdfs/sentry-hdfs-common/src/gen/thrift/gen-javabean/org/apache/sentry/hdfs/service/thrift/TPathsUpdate.java index f3014be..9fd3924 100644 --- a/sentry-hdfs/sentry-hdfs-common/src/gen/thrift/gen-javabean/org/apache/sentry/hdfs/service/thrift/TPathsUpdate.java +++ b/sentry-hdfs/sentry-hdfs-common/src/gen/thrift/gen-javabean/org/apache/sentry/hdfs/service/thrift/TPathsUpdate.java @@ -34,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2017-04-26") +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2017-06-12") public class TPathsUpdate implements org.apache.thrift.TBase<TPathsUpdate, TPathsUpdate._Fields>, java.io.Serializable, Cloneable, Comparable<TPathsUpdate> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TPathsUpdate"); @@ -42,6 +42,7 @@ public class TPathsUpdate implements org.apache.thrift.TBase<TPathsUpdate, TPath private static final org.apache.thrift.protocol.TField PATHS_DUMP_FIELD_DESC = new org.apache.thrift.protocol.TField("pathsDump", org.apache.thrift.protocol.TType.STRUCT, (short)2); private static final org.apache.thrift.protocol.TField SEQ_NUM_FIELD_DESC = new org.apache.thrift.protocol.TField("seqNum", org.apache.thrift.protocol.TType.I64, (short)3); private static final org.apache.thrift.protocol.TField PATH_CHANGES_FIELD_DESC = new org.apache.thrift.protocol.TField("pathChanges", org.apache.thrift.protocol.TType.LIST, (short)4); + private static final org.apache.thrift.protocol.TField IMG_NUM_FIELD_DESC = new org.apache.thrift.protocol.TField("imgNum", org.apache.thrift.protocol.TType.I64, (short)5); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { @@ -53,13 +54,15 @@ public class TPathsUpdate implements org.apache.thrift.TBase<TPathsUpdate, TPath private TPathsDump pathsDump; // optional private long seqNum; // required private List<TPathChanges> pathChanges; // required + private long imgNum; // optional /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { HAS_FULL_IMAGE((short)1, "hasFullImage"), PATHS_DUMP((short)2, "pathsDump"), SEQ_NUM((short)3, "seqNum"), - PATH_CHANGES((short)4, "pathChanges"); + PATH_CHANGES((short)4, "pathChanges"), + IMG_NUM((short)5, "imgNum"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -82,6 +85,8 @@ public class TPathsUpdate implements org.apache.thrift.TBase<TPathsUpdate, TPath return SEQ_NUM; case 4: // PATH_CHANGES return PATH_CHANGES; + case 5: // IMG_NUM + return IMG_NUM; default: return null; } @@ -124,8 +129,9 @@ public class TPathsUpdate implements org.apache.thrift.TBase<TPathsUpdate, TPath // isset id assignments private static final int __HASFULLIMAGE_ISSET_ID = 0; private static final int __SEQNUM_ISSET_ID = 1; + private static final int __IMGNUM_ISSET_ID = 2; private byte __isset_bitfield = 0; - private static final _Fields optionals[] = {_Fields.PATHS_DUMP}; + private static final _Fields optionals[] = {_Fields.PATHS_DUMP,_Fields.IMG_NUM}; public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); @@ -138,11 +144,15 @@ public class TPathsUpdate implements org.apache.thrift.TBase<TPathsUpdate, TPath tmpMap.put(_Fields.PATH_CHANGES, new org.apache.thrift.meta_data.FieldMetaData("pathChanges", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TPathChanges.class)))); + tmpMap.put(_Fields.IMG_NUM, new org.apache.thrift.meta_data.FieldMetaData("imgNum", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TPathsUpdate.class, metaDataMap); } public TPathsUpdate() { + this.imgNum = -1L; + } public TPathsUpdate( @@ -175,6 +185,7 @@ public class TPathsUpdate implements org.apache.thrift.TBase<TPathsUpdate, TPath } this.pathChanges = __this__pathChanges; } + this.imgNum = other.imgNum; } public TPathsUpdate deepCopy() { @@ -189,6 +200,8 @@ public class TPathsUpdate implements org.apache.thrift.TBase<TPathsUpdate, TPath setSeqNumIsSet(false); this.seqNum = 0; this.pathChanges = null; + this.imgNum = -1L; + } public boolean isHasFullImage() { @@ -296,6 +309,28 @@ public class TPathsUpdate implements org.apache.thrift.TBase<TPathsUpdate, TPath } } + public long getImgNum() { + return this.imgNum; + } + + public void setImgNum(long imgNum) { + this.imgNum = imgNum; + setImgNumIsSet(true); + } + + public void unsetImgNum() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __IMGNUM_ISSET_ID); + } + + /** Returns true if field imgNum is set (has been assigned a value) and false otherwise */ + public boolean isSetImgNum() { + return EncodingUtils.testBit(__isset_bitfield, __IMGNUM_ISSET_ID); + } + + public void setImgNumIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __IMGNUM_ISSET_ID, value); + } + public void setFieldValue(_Fields field, Object value) { switch (field) { case HAS_FULL_IMAGE: @@ -330,6 +365,14 @@ public class TPathsUpdate implements org.apache.thrift.TBase<TPathsUpdate, TPath } break; + case IMG_NUM: + if (value == null) { + unsetImgNum(); + } else { + setImgNum((Long)value); + } + break; + } } @@ -347,6 +390,9 @@ public class TPathsUpdate implements org.apache.thrift.TBase<TPathsUpdate, TPath case PATH_CHANGES: return getPathChanges(); + case IMG_NUM: + return getImgNum(); + } throw new IllegalStateException(); } @@ -366,6 +412,8 @@ public class TPathsUpdate implements org.apache.thrift.TBase<TPathsUpdate, TPath return isSetSeqNum(); case PATH_CHANGES: return isSetPathChanges(); + case IMG_NUM: + return isSetImgNum(); } throw new IllegalStateException(); } @@ -419,6 +467,15 @@ public class TPathsUpdate implements org.apache.thrift.TBase<TPathsUpdate, TPath return false; } + boolean this_present_imgNum = true && this.isSetImgNum(); + boolean that_present_imgNum = true && that.isSetImgNum(); + if (this_present_imgNum || that_present_imgNum) { + if (!(this_present_imgNum && that_present_imgNum)) + return false; + if (this.imgNum != that.imgNum) + return false; + } + return true; } @@ -446,6 +503,11 @@ public class TPathsUpdate implements org.apache.thrift.TBase<TPathsUpdate, TPath if (present_pathChanges) list.add(pathChanges); + boolean present_imgNum = true && (isSetImgNum()); + list.add(present_imgNum); + if (present_imgNum) + list.add(imgNum); + return list.hashCode(); } @@ -497,6 +559,16 @@ public class TPathsUpdate implements org.apache.thrift.TBase<TPathsUpdate, TPath return lastComparison; } } + lastComparison = Boolean.valueOf(isSetImgNum()).compareTo(other.isSetImgNum()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetImgNum()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.imgNum, other.imgNum); + if (lastComparison != 0) { + return lastComparison; + } + } return 0; } @@ -542,6 +614,12 @@ public class TPathsUpdate implements org.apache.thrift.TBase<TPathsUpdate, TPath sb.append(this.pathChanges); } first = false; + if (isSetImgNum()) { + if (!first) sb.append(", "); + sb.append("imgNum:"); + sb.append(this.imgNum); + first = false; + } sb.append(")"); return sb.toString(); } @@ -646,6 +724,14 @@ public class TPathsUpdate implements org.apache.thrift.TBase<TPathsUpdate, TPath org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; + case 5: // IMG_NUM + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.imgNum = iprot.readI64(); + struct.setImgNumIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -684,6 +770,11 @@ public class TPathsUpdate implements org.apache.thrift.TBase<TPathsUpdate, TPath } oprot.writeFieldEnd(); } + if (struct.isSetImgNum()) { + oprot.writeFieldBegin(IMG_NUM_FIELD_DESC); + oprot.writeI64(struct.imgNum); + oprot.writeFieldEnd(); + } oprot.writeFieldStop(); oprot.writeStructEnd(); } @@ -714,10 +805,16 @@ public class TPathsUpdate implements org.apache.thrift.TBase<TPathsUpdate, TPath if (struct.isSetPathsDump()) { optionals.set(0); } - oprot.writeBitSet(optionals, 1); + if (struct.isSetImgNum()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); if (struct.isSetPathsDump()) { struct.pathsDump.write(oprot); } + if (struct.isSetImgNum()) { + oprot.writeI64(struct.imgNum); + } } @Override @@ -739,12 +836,16 @@ public class TPathsUpdate implements org.apache.thrift.TBase<TPathsUpdate, TPath } } struct.setPathChangesIsSet(true); - BitSet incoming = iprot.readBitSet(1); + BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { struct.pathsDump = new TPathsDump(); struct.pathsDump.read(iprot); struct.setPathsDumpIsSet(true); } + if (incoming.get(1)) { + struct.imgNum = iprot.readI64(); + struct.setImgNumIsSet(true); + } } } http://git-wip-us.apache.org/repos/asf/sentry/blob/688c1166/sentry-hdfs/sentry-hdfs-common/src/gen/thrift/gen-javabean/org/apache/sentry/hdfs/service/thrift/sentry_hdfs_serviceConstants.java ---------------------------------------------------------------------- diff --git a/sentry-hdfs/sentry-hdfs-common/src/gen/thrift/gen-javabean/org/apache/sentry/hdfs/service/thrift/sentry_hdfs_serviceConstants.java b/sentry-hdfs/sentry-hdfs-common/src/gen/thrift/gen-javabean/org/apache/sentry/hdfs/service/thrift/sentry_hdfs_serviceConstants.java new file mode 100644 index 0000000..a7fd712 --- /dev/null +++ b/sentry-hdfs/sentry-hdfs-common/src/gen/thrift/gen-javabean/org/apache/sentry/hdfs/service/thrift/sentry_hdfs_serviceConstants.java @@ -0,0 +1,41 @@ +/** + * Autogenerated by Thrift Compiler (0.9.3) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.sentry.hdfs.service.thrift; + +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; + +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.server.AbstractNonblockingServer.*; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; +import java.util.EnumMap; +import java.util.Set; +import java.util.HashSet; +import java.util.EnumSet; +import java.util.Collections; +import java.util.BitSet; +import java.nio.ByteBuffer; +import java.util.Arrays; +import javax.annotation.Generated; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +public class sentry_hdfs_serviceConstants { + + public static final long UNUSED_PATH_UPDATE_IMG_NUM = -1L; + +} http://git-wip-us.apache.org/repos/asf/sentry/blob/688c1166/sentry-hdfs/sentry-hdfs-common/src/main/resources/sentry_hdfs_service.thrift ---------------------------------------------------------------------- diff --git a/sentry-hdfs/sentry-hdfs-common/src/main/resources/sentry_hdfs_service.thrift b/sentry-hdfs/sentry-hdfs-common/src/main/resources/sentry_hdfs_service.thrift index d01841b..b0a1f87 100644 --- a/sentry-hdfs/sentry-hdfs-common/src/main/resources/sentry_hdfs_service.thrift +++ b/sentry-hdfs/sentry-hdfs-common/src/main/resources/sentry_hdfs_service.thrift @@ -60,11 +60,15 @@ struct TPathsDump { 2: required map<i32,TPathEntry> nodeMap; } +# Value used to specify that a path image number is not used on a request or response +const i64 UNUSED_PATH_UPDATE_IMG_NUM = -1; + struct TPathsUpdate { 1: required bool hasFullImage; 2: optional TPathsDump pathsDump; 3: required i64 seqNum; 4: required list<TPathChanges> pathChanges; +5: optional i64 imgNum = UNUSED_PATH_UPDATE_IMG_NUM; } struct TPrivilegeChanges { @@ -105,11 +109,18 @@ struct TAuthzUpdateResponse { 2: optional list<TPermissionsUpdate> authzPermUpdate, } +struct TAuthzUpdateRequest { +1: required i64 permSeqNum; +2: required i64 pathSeqNum; +3: required i64 pathImgNum; +} + service SentryHDFSService { # HMS Path cache void handle_hms_notification(1:TPathsUpdate pathsUpdate); i64 check_hms_seq_num(1:i64 pathSeqNum); TAuthzUpdateResponse get_all_authz_updates_from(1:i64 permSeqNum, 2:i64 pathSeqNum); + TAuthzUpdateResponse get_authz_updates(1:TAuthzUpdateRequest request); map<string, list<string>> get_all_related_paths(1:string path, 2:bool exactMatch); } http://git-wip-us.apache.org/repos/asf/sentry/blob/688c1166/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryHDFSServiceClientDefaultImpl.java ---------------------------------------------------------------------- diff --git a/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryHDFSServiceClientDefaultImpl.java b/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryHDFSServiceClientDefaultImpl.java index 1cdbb85..fc8bf4f 100644 --- a/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryHDFSServiceClientDefaultImpl.java +++ b/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryHDFSServiceClientDefaultImpl.java @@ -24,6 +24,7 @@ import org.apache.sentry.core.common.transport.SentryTransportPool; import org.apache.sentry.core.common.transport.TTransportWrapper; import org.apache.sentry.hdfs.ServiceConstants.ClientConfig; import org.apache.sentry.hdfs.service.thrift.SentryHDFSService.Client; +import org.apache.sentry.hdfs.service.thrift.TAuthzUpdateRequest; import org.apache.sentry.hdfs.service.thrift.TAuthzUpdateResponse; import org.apache.sentry.hdfs.service.thrift.TPathsUpdate; import org.apache.sentry.hdfs.service.thrift.TPermissionsUpdate; @@ -35,6 +36,8 @@ import org.apache.thrift.protocol.TProtocol; import java.io.IOException; import java.util.LinkedList; +import static org.apache.sentry.hdfs.service.thrift.sentry_hdfs_serviceConstants.UNUSED_PATH_UPDATE_IMG_NUM; + /** * Sentry HDFS Service Client * <p> @@ -86,7 +89,8 @@ public class SentryHDFSServiceClientDefaultImpl throws SentryHdfsServiceException { SentryAuthzUpdate retVal = new SentryAuthzUpdate(new LinkedList<PermissionsUpdate>(), new LinkedList<PathsUpdate>()); try { - TAuthzUpdateResponse sentryUpdates = client.get_all_authz_updates_from(permSeqNum, pathSeqNum); + TAuthzUpdateRequest updateRequest = new TAuthzUpdateRequest(permSeqNum, pathSeqNum, UNUSED_PATH_UPDATE_IMG_NUM); + TAuthzUpdateResponse sentryUpdates = client.get_authz_updates(updateRequest); if (sentryUpdates.getAuthzPathUpdate() != null) { for (TPathsUpdate pathsUpdate : sentryUpdates.getAuthzPathUpdate()) { retVal.getPathUpdates().add(new PathsUpdate(pathsUpdate)); http://git-wip-us.apache.org/repos/asf/sentry/blob/688c1166/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryHDFSServiceProcessor.java ---------------------------------------------------------------------- diff --git a/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryHDFSServiceProcessor.java b/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryHDFSServiceProcessor.java index 395618a..28d6f5b 100644 --- a/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryHDFSServiceProcessor.java +++ b/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryHDFSServiceProcessor.java @@ -24,6 +24,7 @@ import java.util.Map; import com.codahale.metrics.Timer; import org.apache.sentry.hdfs.service.thrift.SentryHDFSService; +import org.apache.sentry.hdfs.service.thrift.TAuthzUpdateRequest; import org.apache.sentry.hdfs.service.thrift.TAuthzUpdateResponse; import org.apache.sentry.hdfs.service.thrift.TPathsUpdate; import org.apache.sentry.hdfs.service.thrift.TPermissionsUpdate; @@ -31,12 +32,19 @@ import org.apache.thrift.TException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.apache.sentry.hdfs.service.thrift.sentry_hdfs_serviceConstants.UNUSED_PATH_UPDATE_IMG_NUM; + public class SentryHDFSServiceProcessor implements SentryHDFSService.Iface { private static final Logger LOGGER = LoggerFactory.getLogger(SentryHDFSServiceProcessor.class); @Override - public TAuthzUpdateResponse get_all_authz_updates_from(long permSeqNum, long pathSeqNum) + public TAuthzUpdateResponse get_all_authz_updates_from(long permSeqNum, long pathSeqNum) throws TException { + return get_authz_updates(new TAuthzUpdateRequest(permSeqNum, pathSeqNum, UNUSED_PATH_UPDATE_IMG_NUM)); + } + + @Override + public TAuthzUpdateResponse get_authz_updates(TAuthzUpdateRequest request) throws TException { TAuthzUpdateResponse retVal = new TAuthzUpdateResponse(); retVal.setAuthzPathUpdate(new LinkedList<TPathsUpdate>()); @@ -46,10 +54,10 @@ public class SentryHDFSServiceProcessor implements SentryHDFSService.Iface { SentryHdfsMetricsUtil.getAllAuthzUpdatesTimer.time(); try { List<PermissionsUpdate> permUpdates = - SentryPlugin.instance.getAllPermsUpdatesFrom(permSeqNum); + SentryPlugin.instance.getAllPermsUpdatesFrom(request.getPermSeqNum()); SentryHdfsMetricsUtil.getPermUpdateHistogram.update(permUpdates.size()); List<PathsUpdate> pathUpdates = - SentryPlugin.instance.getAllPathsUpdatesFrom(pathSeqNum); + SentryPlugin.instance.getAllPathsUpdatesFrom(request.getPathSeqNum()); SentryHdfsMetricsUtil.getPathUpdateHistogram.update(pathUpdates.size()); for (PathsUpdate update : pathUpdates) { if (LOGGER.isDebugEnabled()) { @@ -77,8 +85,8 @@ public class SentryHDFSServiceProcessor implements SentryHDFSService.Iface { } pathSeq.append(">"); LOGGER.debug("#### Updates requested from HDFS [" - + "permReq=" + permSeqNum + ", permResp=" + permSeq + "] " - + "[pathReq=" + pathSeqNum + ", pathResp=" + pathSeq + "]"); + + "permReq=" + request.getPermSeqNum() + ", permResp=" + permSeq + "] " + + "[pathReq=" + request.getPathSeqNum() + ", pathResp=" + pathSeq + "]"); } } catch (Exception e) { LOGGER.error("Error Sending updates to downstream Cache", e);
