text:
package com.alachisoft.tayzgrid.common.protobuf;

public final class InsertCommandProtocol {
  private InsertCommandProtocol() {}
  public static void registerAllExtensions(
      com.google.protobuf.ExtensionRegistry registry) {
  }
  public static final class InsertCommand extends
      com.google.protobuf.GeneratedMessage {
    // Use InsertCommand.newBuilder() to construct.
    private InsertCommand() {
      initFields();
    }
    private InsertCommand(boolean noInit) {}

    private static final InsertCommand defaultInstance;
    public static InsertCommand getDefaultInstance() {
      return defaultInstance;
    }

    public InsertCommand getDefaultInstanceForType() {
      return defaultInstance;
    }

    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return com.alachisoft.tayzgrid.common.protobuf.InsertCommandProtocol.internal_static_com_alachisoft_tayzgrid_common_protobuf_InsertCommand_descriptor;
    }

    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.alachisoft.tayzgrid.common.protobuf.InsertCommandProtocol.internal_static_com_alachisoft_tayzgrid_common_protobuf_InsertCommand_fieldAccessorTable;
    }

    // optional bytes key = 1;
    public static final int KEY_FIELD_NUMBER = 1;
    private boolean hasKey;
    private com.google.protobuf.ByteString key_ = com.google.protobuf.ByteString.EMPTY;
    public boolean hasKey() { return hasKey; }
    public com.google.protobuf.ByteString getKey() { return key_; }

    // optional int64 requestId = 2;
    public static final int REQUESTID_FIELD_NUMBER = 2;
    private boolean hasRequestId;
    private long requestId_ = 0L;
    public boolean hasRequestId() { return hasRequestId; }
    public long getRequestId() { return requestId_; }

    // optional sint32 updateCallbackId = 3;
    public static final int UPDATECALLBACKID_FIELD_NUMBER = 3;
    private boolean hasUpdateCallbackId;
    private int updateCallbackId_ = 0;
    public boolean hasUpdateCallbackId() { return hasUpdateCallbackId; }
    public int getUpdateCallbackId() { return updateCallbackId_; }

    // optional sint32 removeCallbackId = 4;
    public static final int REMOVECALLBACKID_FIELD_NUMBER = 4;
    private boolean hasRemoveCallbackId;
    private int removeCallbackId_ = 0;
    public boolean hasRemoveCallbackId() { return hasRemoveCallbackId; }
    public int getRemoveCallbackId() { return removeCallbackId_; }

    // optional sint32 datasourceUpdatedCallbackId = 5;
    public static final int DATASOURCEUPDATEDCALLBACKID_FIELD_NUMBER = 5;
    private boolean hasDatasourceUpdatedCallbackId;
    private int datasourceUpdatedCallbackId_ = 0;
    public boolean hasDatasourceUpdatedCallbackId() { return hasDatasourceUpdatedCallbackId; }
    public int getDatasourceUpdatedCallbackId() { return datasourceUpdatedCallbackId_; }

    // optional bool isAsync = 6;
    public static final int ISASYNC_FIELD_NUMBER = 6;
    private boolean hasIsAsync;
    private boolean isAsync_ = false;
    public boolean hasIsAsync() { return hasIsAsync; }
    public boolean getIsAsync() { return isAsync_; }

    // optional int32 priority = 7;
    public static final int PRIORITY_FIELD_NUMBER = 7;
    private boolean hasPriority;
    private int priority_ = 0;
    public boolean hasPriority() { return hasPriority; }
    public int getPriority() { return priority_; }

    // optional int64 absExpiration = 8;
    public static final int ABSEXPIRATION_FIELD_NUMBER = 8;
    private boolean hasAbsExpiration;
    private long absExpiration_ = 0L;
    public boolean hasAbsExpiration() { return hasAbsExpiration; }
    public long getAbsExpiration() { return absExpiration_; }

    // optional int64 sldExpiration = 9;
    public static final int SLDEXPIRATION_FIELD_NUMBER = 9;
    private boolean hasSldExpiration;
    private long sldExpiration_ = 0L;
    public boolean hasSldExpiration() { return hasSldExpiration; }
    public long getSldExpiration() { return sldExpiration_; }

    // optional bool isResync = 10;
    public static final int ISRESYNC_FIELD_NUMBER = 10;
    private boolean hasIsResync;
    private boolean isResync_ = false;
    public boolean hasIsResync() { return hasIsResync; }
    public boolean getIsResync() { return isResync_; }

    // optional string group = 11;
    public static final int GROUP_FIELD_NUMBER = 11;
    private boolean hasGroup;
    private java.lang.String group_ = "";
    public boolean hasGroup() { return hasGroup; }
    public java.lang.String getGroup() { return group_; }

    // optional string subGroup = 12;
    public static final int SUBGROUP_FIELD_NUMBER = 12;
    private boolean hasSubGroup;
    private java.lang.String subGroup_ = "";
    public boolean hasSubGroup() { return hasSubGroup; }
    public java.lang.String getSubGroup() { return subGroup_; }

    // optional int32 flag = 13;
    public static final int FLAG_FIELD_NUMBER = 13;
    private boolean hasFlag;
    private int flag_ = 0;
    public boolean hasFlag() { return hasFlag; }
    public int getFlag() { return flag_; }

    // optional string providerName = 14;
    public static final int PROVIDERNAME_FIELD_NUMBER = 14;
    private boolean hasProviderName;
    private java.lang.String providerName_ = "";
    public boolean hasProviderName() { return hasProviderName; }
    public java.lang.String getProviderName() { return providerName_; }

    // optional string resyncProviderName = 15;
    public static final int RESYNCPROVIDERNAME_FIELD_NUMBER = 15;
    private boolean hasResyncProviderName;
    private java.lang.String resyncProviderName_ = "";
    public boolean hasResyncProviderName() { return hasResyncProviderName; }
    public java.lang.String getResyncProviderName() { return resyncProviderName_; }

    // optional string lockId = 16;
    public static final int LOCKID_FIELD_NUMBER = 16;
    private boolean hasLockId;
    private java.lang.String lockId_ = "";
    public boolean hasLockId() { return hasLockId; }
    public java.lang.String getLockId() { return lockId_; }

    // optional int32 lockAccessType = 17;
    public static final int LOCKACCESSTYPE_FIELD_NUMBER = 17;
    private boolean hasLockAccessType;
    private int lockAccessType_ = 0;
    public boolean hasLockAccessType() { return hasLockAccessType; }
    public int getLockAccessType() { return lockAccessType_; }

    // optional uint64 itemVersion = 18;
    public static final int ITEMVERSION_FIELD_NUMBER = 18;
    private boolean hasItemVersion;
    private long itemVersion_ = 0L;
    public boolean hasItemVersion() { return hasItemVersion; }
    public long getItemVersion() { return itemVersion_; }

    // optional .com.alachisoft.tayzgrid.common.protobuf.QueryInfo queryInfo = 19;
    public static final int QUERYINFO_FIELD_NUMBER = 19;
    private boolean hasQueryInfo;
    private com.alachisoft.tayzgrid.common.protobuf.QueryInfoProtocol.QueryInfo queryInfo_;
    public boolean hasQueryInfo() { return hasQueryInfo; }
    public com.alachisoft.tayzgrid.common.protobuf.QueryInfoProtocol.QueryInfo getQueryInfo() { return queryInfo_; }

    // optional .com.alachisoft.tayzgrid.common.protobuf.TagInfo tagInfo = 20;
    public static final int TAGINFO_FIELD_NUMBER = 20;
    private boolean hasTagInfo;
    private com.alachisoft.tayzgrid.common.protobuf.TagInfoProtocol.TagInfo tagInfo_;
    public boolean hasTagInfo() { return hasTagInfo; }
    public com.alachisoft.tayzgrid.common.protobuf.TagInfoProtocol.TagInfo getTagInfo() { return tagInfo_; }

    // repeated bytes data = 21;
    public static final int DATA_FIELD_NUMBER = 21;
    private java.util.List<com.google.protobuf.ByteString> data_ =
      java.util.Collections.emptyList();
    public java.util.List<com.google.protobuf.ByteString> getDataList() {
      return data_;
    }
    public int getDataCount() { return data_.size(); }
    public com.google.protobuf.ByteString getData(int index) {
      return data_.get(index);
    }

    // optional .com.alachisoft.tayzgrid.common.protobuf.NamedTagInfo namedTagInfo = 22;
    public static final int NAMEDTAGINFO_FIELD_NUMBER = 22;
    private boolean hasNamedTagInfo;
    private com.alachisoft.tayzgrid.common.protobuf.NamedTagInfoProtocol.NamedTagInfo namedTagInfo_;
    public boolean hasNamedTagInfo() { return hasNamedTagInfo; }
    public com.alachisoft.tayzgrid.common.protobuf.NamedTagInfoProtocol.NamedTagInfo getNamedTagInfo() { return namedTagInfo_; }

    // optional .com.alachisoft.tayzgrid.common.protobuf.ObjectQueryInfo objectQueryInfo = 23;
    public static final int OBJECTQUERYINFO_FIELD_NUMBER = 23;
    private boolean hasObjectQueryInfo;
    private com.alachisoft.tayzgrid.common.protobuf.ObjectQueryInfoProtocol.ObjectQueryInfo objectQueryInfo_;
    public boolean hasObjectQueryInfo() { return hasObjectQueryInfo; }
    public com.alachisoft.tayzgrid.common.protobuf.ObjectQueryInfoProtocol.ObjectQueryInfo getObjectQueryInfo() { return objectQueryInfo_; }

    // repeated bytes objectQueryInfoEncrypted = 24;
    public static final int OBJECTQUERYINFOENCRYPTED_FIELD_NUMBER = 24;
    private java.util.List<com.google.protobuf.ByteString> objectQueryInfoEncrypted_ =
      java.util.Collections.emptyList();
    public java.util.List<com.google.protobuf.ByteString> getObjectQueryInfoEncryptedList() {
      return objectQueryInfoEncrypted_;
    }
    public int getObjectQueryInfoEncryptedCount() { return objectQueryInfoEncrypted_.size(); }
    public com.google.protobuf.ByteString getObjectQueryInfoEncrypted(int index) {
      return objectQueryInfoEncrypted_.get(index);
    }

    // optional sint32 updateDataFilter = 25 [default = -1];
    public static final int UPDATEDATAFILTER_FIELD_NUMBER = 25;
    private boolean hasUpdateDataFilter;
    private int updateDataFilter_ = -1;
    public boolean hasUpdateDataFilter() { return hasUpdateDataFilter; }
    public int getUpdateDataFilter() { return updateDataFilter_; }

    // optional sint32 removeDataFilter = 26 [default = -1];
    public static final int REMOVEDATAFILTER_FIELD_NUMBER = 26;
    private boolean hasRemoveDataFilter;
    private int removeDataFilter_ = -1;
    public boolean hasRemoveDataFilter() { return hasRemoveDataFilter; }
    public int getRemoveDataFilter() { return removeDataFilter_; }

    // optional bool isReplace = 27;
    public static final int ISREPLACE_FIELD_NUMBER = 27;
    private boolean hasIsReplace;
    private boolean isReplace_ = false;
    public boolean hasIsReplace() { return hasIsReplace; }
    public boolean getIsReplace() { return isReplace_; }

    // optional bool returnExisting = 28;
    public static final int RETURNEXISTING_FIELD_NUMBER = 28;
    private boolean hasReturnExisting;
    private boolean returnExisting_ = false;
    public boolean hasReturnExisting() { return hasReturnExisting; }
    public boolean getReturnExisting() { return returnExisting_; }

    // optional bool compareOld = 29;
    public static final int COMPAREOLD_FIELD_NUMBER = 29;
    private boolean hasCompareOld;
    private boolean compareOld_ = false;
    public boolean hasCompareOld() { return hasCompareOld; }
    public boolean getCompareOld() { return compareOld_; }

    // optional int32 oldValueFlag = 30;
    public static final int OLDVALUEFLAG_FIELD_NUMBER = 30;
    private boolean hasOldValueFlag;
    private int oldValueFlag_ = 0;
    public boolean hasOldValueFlag() { return hasOldValueFlag; }
    public int getOldValueFlag() { return oldValueFlag_; }

    // repeated bytes oldValue = 31;
    public static final int OLDVALUE_FIELD_NUMBER = 31;
    private java.util.List<com.google.protobuf.ByteString> oldValue_ =
      java.util.Collections.emptyList();
    public java.util.List<com.google.protobuf.ByteString> getOldValueList() {
      return oldValue_;
    }
    public int getOldValueCount() { return oldValue_.size(); }
    public com.google.protobuf.ByteString getOldValue(int index) {
      return oldValue_.get(index);
    }

    private void initFields() {
      queryInfo_ = com.alachisoft.tayzgrid.common.protobuf.QueryInfoProtocol.QueryInfo.getDefaultInstance();
      tagInfo_ = com.alachisoft.tayzgrid.common.protobuf.TagInfoProtocol.TagInfo.getDefaultInstance();
      namedTagInfo_ = com.alachisoft.tayzgrid.common.protobuf.NamedTagInfoProtocol.NamedTagInfo.getDefaultInstance();
      objectQueryInfo_ = com.alachisoft.tayzgrid.common.protobuf.ObjectQueryInfoProtocol.ObjectQueryInfo.getDefaultInstance();
    }
    public final boolean isInitialized() {
      return true;
    }

    public void writeTo(com.google.protobuf.CodedOutputStream output)
                        throws java.io.IOException {
      getSerializedSize();
      if (hasKey()) {
        output.writeBytes(1, getKey());
      }
      if (hasRequestId()) {
        output.writeInt64(2, getRequestId());
      }
      if (hasUpdateCallbackId()) {
        output.writeSInt32(3, getUpdateCallbackId());
      }
      if (hasRemoveCallbackId()) {
        output.writeSInt32(4, getRemoveCallbackId());
      }
      if (hasDatasourceUpdatedCallbackId()) {
        output.writeSInt32(5, getDatasourceUpdatedCallbackId());
      }
      if (hasIsAsync()) {
        output.writeBool(6, getIsAsync());
      }
      if (hasPriority()) {
        output.writeInt32(7, getPriority());
      }
      if (hasAbsExpiration()) {
        output.writeInt64(8, getAbsExpiration());
      }
      if (hasSldExpiration()) {
        output.writeInt64(9, getSldExpiration());
      }
      if (hasIsResync()) {
        output.writeBool(10, getIsResync());
      }
      if (hasGroup()) {
        output.writeString(11, getGroup());
      }
      if (hasSubGroup()) {
        output.writeString(12, getSubGroup());
      }
      if (hasFlag()) {
        output.writeInt32(13, getFlag());
      }
      if (hasProviderName()) {
        output.writeString(14, getProviderName());
      }
      if (hasResyncProviderName()) {
        output.writeString(15, getResyncProviderName());
      }
      if (hasLockId()) {
        output.writeString(16, getLockId());
      }
      if (hasLockAccessType()) {
        output.writeInt32(17, getLockAccessType());
      }
      if (hasItemVersion()) {
        output.writeUInt64(18, getItemVersion());
      }
      if (hasQueryInfo()) {
        output.writeMessage(19, getQueryInfo());
      }
      if (hasTagInfo()) {
        output.writeMessage(20, getTagInfo());
      }
      for (com.google.protobuf.ByteString element : getDataList()) {
        output.writeBytes(21, element);
      }
      if (hasNamedTagInfo()) {
        output.writeMessage(22, getNamedTagInfo());
      }
      if (hasObjectQueryInfo()) {
        output.writeMessage(23, getObjectQueryInfo());
      }
      for (com.google.protobuf.ByteString element : getObjectQueryInfoEncryptedList()) {
        output.writeBytes(24, element);
      }
      if (hasUpdateDataFilter()) {
        output.writeSInt32(25, getUpdateDataFilter());
      }
      if (hasRemoveDataFilter()) {
        output.writeSInt32(26, getRemoveDataFilter());
      }
      if (hasIsReplace()) {
        output.writeBool(27, getIsReplace());
      }
      if (hasReturnExisting()) {
        output.writeBool(28, getReturnExisting());
      }
      if (hasCompareOld()) {
        output.writeBool(29, getCompareOld());
      }
      if (hasOldValueFlag()) {
        output.writeInt32(30, getOldValueFlag());
      }
      for (com.google.protobuf.ByteString element : getOldValueList()) {
        output.writeBytes(31, element);
      }
      getUnknownFields().writeTo(output);
    }

    private int memoizedSerializedSize = -1;
    public int getSerializedSize() {
      int size = memoizedSerializedSize;
      if (size != -1) return size;

      size = 0;
      if (hasKey()) {
        size += com.google.protobuf.CodedOutputStream
          .computeBytesSize(1, getKey());
      }
      if (hasRequestId()) {
        size += com.google.protobuf.CodedOutputStream
          .computeInt64Size(2, getRequestId());
      }
      if (hasUpdateCallbackId()) {
        size += com.google.protobuf.CodedOutputStream
          .computeSInt32Size(3, getUpdateCallbackId());
      }
      if (hasRemoveCallbackId()) {
        size += com.google.protobuf.CodedOutputStream
          .computeSInt32Size(4, getRemoveCallbackId());
      }
      if (hasDatasourceUpdatedCallbackId()) {
        size += com.google.protobuf.CodedOutputStream
          .computeSInt32Size(5, getDatasourceUpdatedCallbackId());
      }
      if (hasIsAsync()) {
        size += com.google.protobuf.CodedOutputStream
          .computeBoolSize(6, getIsAsync());
      }
      if (hasPriority()) {
        size += com.google.protobuf.CodedOutputStream
          .computeInt32Size(7, getPriority());
      }
      if (hasAbsExpiration()) {
        size += com.google.protobuf.CodedOutputStream
          .computeInt64Size(8, getAbsExpiration());
      }
      if (hasSldExpiration()) {
        size += com.google.protobuf.CodedOutputStream
          .computeInt64Size(9, getSldExpiration());
      }
      if (hasIsResync()) {
        size += com.google.protobuf.CodedOutputStream
          .computeBoolSize(10, getIsResync());
      }
      if (hasGroup()) {
        size += com.google.protobuf.CodedOutputStream
          .computeStringSize(11, getGroup());
      }
      if (hasSubGroup()) {
        size += com.google.protobuf.CodedOutputStream
          .computeStringSize(12, getSubGroup());
      }
      if (hasFlag()) {
        size += com.google.protobuf.CodedOutputStream
          .computeInt32Size(13, getFlag());
      }
      if (hasProviderName()) {
        size += com.google.protobuf.CodedOutputStream
          .computeStringSize(14, getProviderName());
      }
      if (hasResyncProviderName()) {
        size += com.google.protobuf.CodedOutputStream
          .computeStringSize(15, getResyncProviderName());
      }
      if (hasLockId()) {
        size += com.google.protobuf.CodedOutputStream
          .computeStringSize(16, getLockId());
      }
      if (hasLockAccessType()) {
        size += com.google.protobuf.CodedOutputStream
          .computeInt32Size(17, getLockAccessType());
      }
      if (hasItemVersion()) {
        size += com.google.protobuf.CodedOutputStream
          .computeUInt64Size(18, getItemVersion());
      }
      if (hasQueryInfo()) {
        size += com.google.protobuf.CodedOutputStream
          .computeMessageSize(19, getQueryInfo());
      }
      if (hasTagInfo()) {
        size += com.google.protobuf.CodedOutputStream
          .computeMessageSize(20, getTagInfo());
      }
      {
        int dataSize = 0;
        for (com.google.protobuf.ByteString element : getDataList()) {
          dataSize += com.google.protobuf.CodedOutputStream
            .computeBytesSizeNoTag(element);
        }
        size += dataSize;
        size += 2 * getDataList().size();
      }
      if (hasNamedTagInfo()) {
        size += com.google.protobuf.CodedOutputStream
          .computeMessageSize(22, getNamedTagInfo());
      }
      if (hasObjectQueryInfo()) {
        size += com.google.protobuf.CodedOutputStream
          .computeMessageSize(23, getObjectQueryInfo());
      }
      {
        int dataSize = 0;
        for (com.google.protobuf.ByteString element : getObjectQueryInfoEncryptedList()) {
          dataSize += com.google.protobuf.CodedOutputStream
            .computeBytesSizeNoTag(element);
        }
        size += dataSize;
        size += 2 * getObjectQueryInfoEncryptedList().size();
      }
      if (hasUpdateDataFilter()) {
        size += com.google.protobuf.CodedOutputStream
          .computeSInt32Size(25, getUpdateDataFilter());
      }
      if (hasRemoveDataFilter()) {
        size += com.google.protobuf.CodedOutputStream
          .computeSInt32Size(26, getRemoveDataFilter());
      }
      if (hasIsReplace()) {
        size += com.google.protobuf.CodedOutputStream
          .computeBoolSize(27, getIsReplace());
      }
      if (hasReturnExisting()) {
        size += com.google.protobuf.CodedOutputStream
          .computeBoolSize(28, getReturnExisting());
      }
      if (hasCompareOld()) {
        size += com.google.protobuf.CodedOutputStream
          .computeBoolSize(29, getCompareOld());
      }
      if (hasOldValueFlag()) {
        size += com.google.protobuf.CodedOutputStream
          .computeInt32Size(30, getOldValueFlag());
      }
      {
        int dataSize = 0;
        for (com.google.protobuf.ByteString element : getOldValueList()) {
          dataSize += com.google.protobuf.CodedOutputStream
            .computeBytesSizeNoTag(element);
        }
        size += dataSize;
        size += 2 * getOldValueList().size();
      }
      size += getUnknownFields().getSerializedSize();
      memoizedSerializedSize = size;
      return size;
    }

    public static com.alachisoft.tayzgrid.common.protobuf.InsertCommandProtocol.InsertCommand parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return newBuilder().mergeFrom(data).buildParsed();
    }
    public static com.alachisoft.tayzgrid.common.protobuf.InsertCommandProtocol.InsertCommand parseFrom(
        com.google.protobuf.ByteString data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return newBuilder().mergeFrom(data, extensionRegistry)
               .buildParsed();
    }
    public static com.alachisoft.tayzgrid.common.protobuf.InsertCommandProtocol.InsertCommand parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return newBuilder().mergeFrom(data).buildParsed();
    }
    public static com.alachisoft.tayzgrid.common.protobuf.InsertCommandProtocol.InsertCommand parseFrom(
        byte[] data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return newBuilder().mergeFrom(data, extensionRegistry)
               .buildParsed();
    }
    public static com.alachisoft.tayzgrid.common.protobuf.InsertCommandProtocol.InsertCommand parseFrom(java.io.InputStream input)
        throws java.io.IOException {
      return newBuilder().mergeFrom(input).buildParsed();
    }
    public static com.alachisoft.tayzgrid.common.protobuf.InsertCommandProtocol.InsertCommand parseFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return newBuilder().mergeFrom(input, extensionRegistry)
               .buildParsed();
    }
    public static com.alachisoft.tayzgrid.common.protobuf.InsertCommandProtocol.InsertCommand parseDelimitedFrom(java.io.InputStream input)
        throws java.io.IOException {
      Builder builder = newBuilder();
      if (builder.mergeDelimitedFrom(input)) {
        return builder.buildParsed();
      } else {
        return null;
      }
    }
    public static com.alachisoft.tayzgrid.common.protobuf.InsertCommandProtocol.InsertCommand parseDelimitedFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      Builder builder = newBuilder();
      if (builder.mergeDelimitedFrom(input, extensionRegistry)) {
        return builder.buildParsed();
      } else {
        return null;
      }
    }
    public static com.alachisoft.tayzgrid.common.protobuf.InsertCommandProtocol.InsertCommand parseFrom(
        com.google.protobuf.CodedInputStream input)
        throws java.io.IOException {
      return newBuilder().mergeFrom(input).buildParsed();
    }
    public static com.alachisoft.tayzgrid.common.protobuf.InsertCommandProtocol.InsertCommand parseFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return newBuilder().mergeFrom(input, extensionRegistry)
               .buildParsed();
    }

    public static Builder newBuilder() { return Builder.create(); }
    public Builder newBuilderForType() { return newBuilder(); }
    public static Builder newBuilder(com.alachisoft.tayzgrid.common.protobuf.InsertCommandProtocol.InsertCommand prototype) {
      return newBuilder().mergeFrom(prototype);
    }
    public Builder toBuilder() { return newBuilder(this); }

    public static final class Builder extends
        com.google.protobuf.GeneratedMessage.Builder<Builder> {
      private com.alachisoft.tayzgrid.common.protobuf.InsertCommandProtocol.InsertCommand result;

      // Construct using com.alachisoft.tayzgrid.common.protobuf.InsertCommandProtocol.InsertCommand.newBuilder()
      private Builder() {}

      private static Builder create() {
        Builder builder = new Builder();
        builder.result = new com.alachisoft.tayzgrid.common.protobuf.InsertCommandProtocol.InsertCommand();
        return builder;
      }

      protected com.alachisoft.tayzgrid.common.protobuf.InsertCommandProtocol.InsertCommand internalGetResult() {
        return result;
      }

      public Builder clear() {
        if (result == null) {
          throw new IllegalStateException(
            "Cannot call clear() after build().");
        }
        result = new com.alachisoft.tayzgrid.common.protobuf.InsertCommandProtocol.InsertCommand();
        return this;
      }

      public Builder clone() {
        return create().mergeFrom(result);
      }

      public com.google.protobuf.Descriptors.Descriptor
          getDescriptorForType() {
        return com.alachisoft.tayzgrid.common.protobuf.InsertCommandProtocol.InsertCommand.getDescriptor();
      }

      public com.alachisoft.tayzgrid.common.protobuf.InsertCommandProtocol.InsertCommand getDefaultInstanceForType() {
        return com.alachisoft.tayzgrid.common.protobuf.InsertCommandProtocol.InsertCommand.getDefaultInstance();
      }

      public boolean isInitialized() {
        return result.isInitialized();
      }
      public com.alachisoft.tayzgrid.common.protobuf.InsertCommandProtocol.InsertCommand build() {
        if (result != null && !isInitialized()) {
          throw newUninitializedMessageException(result);
        }
        return buildPartial();
      }

      private com.alachisoft.tayzgrid.common.protobuf.InsertCommandProtocol.InsertCommand buildParsed()
          throws com.google.protobuf.InvalidProtocolBufferException {
        if (!isInitialized()) {
          throw newUninitializedMessageException(
            result).asInvalidProtocolBufferException();
        }
        return buildPartial();
      }

      public com.alachisoft.tayzgrid.common.protobuf.InsertCommandProtocol.InsertCommand buildPartial() {
        if (result == null) {
          throw new IllegalStateException(
            "build() has already been called on this Builder.");
        }
        if (result.data_ != java.util.Collections.EMPTY_LIST) {
          result.data_ =
            java.util.Collections.unmodifiableList(result.data_);
        }
        if (result.objectQueryInfoEncrypted_ != java.util.Collections.EMPTY_LIST) {
          result.objectQueryInfoEncrypted_ =
            java.util.Collections.unmodifiableList(result.objectQueryInfoEncrypted_);
        }
        if (result.oldValue_ != java.util.Collections.EMPTY_LIST) {
          result.oldValue_ =
            java.util.Collections.unmodifiableList(result.oldValue_);
        }
        com.alachisoft.tayzgrid.common.protobuf.InsertCommandProtocol.InsertCommand returnMe = result;
        result = null;
        return returnMe;
      }

      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other instanceof com.alachisoft.tayzgrid.common.protobuf.InsertCommandProtocol.InsertCommand) {
          return mergeFrom((com.alachisoft.tayzgrid.common.protobuf.InsertCommandProtocol.InsertCommand)other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(com.alachisoft.tayzgrid.common.protobuf.InsertCommandProtocol.InsertCommand other) {
        if (other == com.alachisoft.tayzgrid.common.protobuf.InsertCommandProtocol.InsertCommand.getDefaultInstance()) return this;
        if (other.hasKey()) {
          setKey(other.getKey());
        }
        if (other.hasRequestId()) {
          setRequestId(other.getRequestId());
        }
        if (other.hasUpdateCallbackId()) {
          setUpdateCallbackId(other.getUpdateCallbackId());
        }
        if (other.hasRemoveCallbackId()) {
          setRemoveCallbackId(other.getRemoveCallbackId());
        }
        if (other.hasDatasourceUpdatedCallbackId()) {
          setDatasourceUpdatedCallbackId(other.getDatasourceUpdatedCallbackId());
        }
        if (other.hasIsAsync()) {
          setIsAsync(other.getIsAsync());
        }
        if (other.hasPriority()) {
          setPriority(other.getPriority());
        }
        if (other.hasAbsExpiration()) {
          setAbsExpiration(other.getAbsExpiration());
        }
        if (other.hasSldExpiration()) {
          setSldExpiration(other.getSldExpiration());
        }
        if (other.hasIsResync()) {
          setIsResync(other.getIsResync());
        }
        if (other.hasGroup()) {
          setGroup(other.getGroup());
        }
        if (other.hasSubGroup()) {
          setSubGroup(other.getSubGroup());
        }
        if (other.hasFlag()) {
          setFlag(other.getFlag());
        }
        if (other.hasProviderName()) {
          setProviderName(other.getProviderName());
        }
        if (other.hasResyncProviderName()) {
          setResyncProviderName(other.getResyncProviderName());
        }
        if (other.hasLockId()) {
          setLockId(other.getLockId());
        }
        if (other.hasLockAccessType()) {
          setLockAccessType(other.getLockAccessType());
        }
        if (other.hasItemVersion()) {
          setItemVersion(other.getItemVersion());
        }
        if (other.hasQueryInfo()) {
          mergeQueryInfo(other.getQueryInfo());
        }
        if (other.hasTagInfo()) {
          mergeTagInfo(other.getTagInfo());
        }
        if (!other.data_.isEmpty()) {
          if (result.data_.isEmpty()) {
            result.data_ = new java.util.ArrayList<com.google.protobuf.ByteString>();
          }
          result.data_.addAll(other.data_);
        }
        if (other.hasNamedTagInfo()) {
          mergeNamedTagInfo(other.getNamedTagInfo());
        }
        if (other.hasObjectQueryInfo()) {
          mergeObjectQueryInfo(other.getObjectQueryInfo());
        }
        if (!other.objectQueryInfoEncrypted_.isEmpty()) {
          if (result.objectQueryInfoEncrypted_.isEmpty()) {
            result.objectQueryInfoEncrypted_ = new java.util.ArrayList<com.google.protobuf.ByteString>();
          }
          result.objectQueryInfoEncrypted_.addAll(other.objectQueryInfoEncrypted_);
        }
        if (other.hasUpdateDataFilter()) {
          setUpdateDataFilter(other.getUpdateDataFilter());
        }
        if (other.hasRemoveDataFilter()) {
          setRemoveDataFilter(other.getRemoveDataFilter());
        }
        if (other.hasIsReplace()) {
          setIsReplace(other.getIsReplace());
        }
        if (other.hasReturnExisting()) {
          setReturnExisting(other.getReturnExisting());
        }
        if (other.hasCompareOld()) {
          setCompareOld(other.getCompareOld());
        }
        if (other.hasOldValueFlag()) {
          setOldValueFlag(other.getOldValueFlag());
        }
        if (!other.oldValue_.isEmpty()) {
          if (result.oldValue_.isEmpty()) {
            result.oldValue_ = new java.util.ArrayList<com.google.protobuf.ByteString>();
          }
          result.oldValue_.addAll(other.oldValue_);
        }
        this.mergeUnknownFields(other.getUnknownFields());
        return this;
      }

      public Builder mergeFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws java.io.IOException {
        com.google.protobuf.UnknownFieldSet.Builder unknownFields =
          com.google.protobuf.UnknownFieldSet.newBuilder(
            this.getUnknownFields());
        while (true) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              this.setUnknownFields(unknownFields.build());
              return this;
            default: {
              if (!parseUnknownField(input, unknownFields,
                                     extensionRegistry, tag)) {
                this.setUnknownFields(unknownFields.build());
                return this;
              }
              break;
            }
            case 10: {
              setKey(input.readBytes());
              break;
            }
            case 16: {
              setRequestId(input.readInt64());
              break;
            }
            case 24: {
              setUpdateCallbackId(input.readSInt32());
              break;
            }
            case 32: {
              setRemoveCallbackId(input.readSInt32());
              break;
            }
            case 40: {
              setDatasourceUpdatedCallbackId(input.readSInt32());
              break;
            }
            case 48: {
              setIsAsync(input.readBool());
              break;
            }
            case 56: {
              setPriority(input.readInt32());
              break;
            }
            case 64: {
              setAbsExpiration(input.readInt64());
              break;
            }
            case 72: {
              setSldExpiration(input.readInt64());
              break;
            }
            case 80: {
              setIsResync(input.readBool());
              break;
            }
            case 90: {
              setGroup(input.readString());
              break;
            }
            case 98: {
              setSubGroup(input.readString());
              break;
            }
            case 104: {
              setFlag(input.readInt32());
              break;
            }
            case 114: {
              setProviderName(input.readString());
              break;
            }
            case 122: {
              setResyncProviderName(input.readString());
              break;
            }
            case 130: {
              setLockId(input.readString());
              break;
            }
            case 136: {
              setLockAccessType(input.readInt32());
              break;
            }
            case 144: {
              setItemVersion(input.readUInt64());
              break;
            }
            case 154: {
              com.alachisoft.tayzgrid.common.protobuf.QueryInfoProtocol.QueryInfo.Builder subBuilder = com.alachisoft.tayzgrid.common.protobuf.QueryInfoProtocol.QueryInfo.newBuilder();
              if (hasQueryInfo()) {
                subBuilder.mergeFrom(getQueryInfo());
              }
              input.readMessage(subBuilder, extensionRegistry);
              setQueryInfo(subBuilder.buildPartial());
              break;
            }
            case 162: {
              com.alachisoft.tayzgrid.common.protobuf.TagInfoProtocol.TagInfo.Builder subBuilder = com.alachisoft.tayzgrid.common.protobuf.TagInfoProtocol.TagInfo.newBuilder();
              if (hasTagInfo()) {
                subBuilder.mergeFrom(getTagInfo());
              }
              input.readMessage(subBuilder, extensionRegistry);
              setTagInfo(subBuilder.buildPartial());
              break;
            }
            case 170: {
              addData(input.readBytes());
              break;
            }
            case 178: {
              com.alachisoft.tayzgrid.common.protobuf.NamedTagInfoProtocol.NamedTagInfo.Builder subBuilder = com.alachisoft.tayzgrid.common.protobuf.NamedTagInfoProtocol.NamedTagInfo.newBuilder();
              if (hasNamedTagInfo()) {
                subBuilder.mergeFrom(getNamedTagInfo());
              }
              input.readMessage(subBuilder, extensionRegistry);
              setNamedTagInfo(subBuilder.buildPartial());
              break;
            }
            case 186: {
              com.alachisoft.tayzgrid.common.protobuf.ObjectQueryInfoProtocol.ObjectQueryInfo.Builder subBuilder = com.alachisoft.tayzgrid.common.protobuf.ObjectQueryInfoProtocol.ObjectQueryInfo.newBuilder();
              if (hasObjectQueryInfo()) {
                subBuilder.mergeFrom(getObjectQueryInfo());
              }
              input.readMessage(subBuilder, extensionRegistry);
              setObjectQueryInfo(subBuilder.buildPartial());
              break;
            }
            case 194: {
              addObjectQueryInfoEncrypted(input.readBytes());
              break;
            }
            case 200: {
              setUpdateDataFilter(input.readSInt32());
              break;
            }
            case 208: {
              setRemoveDataFilter(input.readSInt32());
              break;
            }
            case 216: {
              setIsReplace(input.readBool());
              break;
            }
            case 224: {
              setReturnExisting(input.readBool());
              break;
            }
            case 232: {
              setCompareOld(input.readBool());
              break;
            }
            case 240: {
              setOldValueFlag(input.readInt32());
              break;
            }
            case 250: {
              addOldValue(input.readBytes());
              break;
            }
          }
        }
      }

      // optional bytes key = 1;
      public boolean hasKey() {
        return result.hasKey();
      }
      public com.google.protobuf.ByteString getKey() {
        return result.getKey();
      }
      public Builder setKey(com.google.protobuf.ByteString value) {
        if (value == null) {
    throw new NullPointerException();
  }
  result.hasKey = true;
        result.key_ = value;
        return this;
      }
      public Builder clearKey() {
        result.hasKey = false;
        result.key_ = getDefaultInstance().getKey();
        return this;
      }

      // optional int64 requestId = 2;
      public boolean hasRequestId() {
        return result.hasRequestId();
      }
      public long getRequestId() {
        return result.getRequestId();
      }
      public Builder setRequestId(long value) {
        result.hasRequestId = true;
        result.requestId_ = value;
        return this;
      }
      public Builder clearRequestId() {
        result.hasRequestId = false;
        result.requestId_ = 0L;
        return this;
      }

      // optional sint32 updateCallbackId = 3;
      public boolean hasUpdateCallbackId() {
        return result.hasUpdateCallbackId();
      }
      public int getUpdateCallbackId() {
        return result.getUpdateCallbackId();
      }
      public Builder setUpdateCallbackId(int value) {
        result.hasUpdateCallbackId = true;
        result.updateCallbackId_ = value;
        return this;
      }
      public Builder clearUpdateCallbackId() {
        result.hasUpdateCallbackId = false;
        result.updateCallbackId_ = 0;
        return this;
      }

      // optional sint32 removeCallbackId = 4;
      public boolean hasRemoveCallbackId() {
        return result.hasRemoveCallbackId();
      }
      public int getRemoveCallbackId() {
        return result.getRemoveCallbackId();
      }
      public Builder setRemoveCallbackId(int value) {
        result.hasRemoveCallbackId = true;
        result.removeCallbackId_ = value;
        return this;
      }
      public Builder clearRemoveCallbackId() {
        result.hasRemoveCallbackId = false;
        result.removeCallbackId_ = 0;
        return this;
      }

      // optional sint32 datasourceUpdatedCallbackId = 5;
      public boolean hasDatasourceUpdatedCallbackId() {
        return result.hasDatasourceUpdatedCallbackId();
      }
      public int getDatasourceUpdatedCallbackId() {
        return result.getDatasourceUpdatedCallbackId();
      }
      public Builder setDatasourceUpdatedCallbackId(int value) {
        result.hasDatasourceUpdatedCallbackId = true;
        result.datasourceUpdatedCallbackId_ = value;
        return this;
      }
      public Builder clearDatasourceUpdatedCallbackId() {
        result.hasDatasourceUpdatedCallbackId = false;
        result.datasourceUpdatedCallbackId_ = 0;
        return this;
      }

      // optional bool isAsync = 6;
      public boolean hasIsAsync() {
        return result.hasIsAsync();
      }
      public boolean getIsAsync() {
        return result.getIsAsync();
      }
      public Builder setIsAsync(boolean value) {
        result.hasIsAsync = true;
        result.isAsync_ = value;
        return this;
      }
      public Builder clearIsAsync() {
        result.hasIsAsync = false;
        result.isAsync_ = false;
        return this;
      }

      // optional int32 priority = 7;
      public boolean hasPriority() {
        return result.hasPriority();
      }
      public int getPriority() {
        return result.getPriority();
      }
      public Builder setPriority(int value) {
        result.hasPriority = true;
        result.priority_ = value;
        return this;
      }
      public Builder clearPriority() {
        result.hasPriority = false;
        result.priority_ = 0;
        return this;
      }

      // optional int64 absExpiration = 8;
      public boolean hasAbsExpiration() {
        return result.hasAbsExpiration();
      }
      public long getAbsExpiration() {
        return result.getAbsExpiration();
      }
      public Builder setAbsExpiration(long value) {
        result.hasAbsExpiration = true;
        result.absExpiration_ = value;
        return this;
      }
      public Builder clearAbsExpiration() {
        result.hasAbsExpiration = false;
        result.absExpiration_ = 0L;
        return this;
      }

      // optional int64 sldExpiration = 9;
      public boolean hasSldExpiration() {
        return result.hasSldExpiration();
      }
      public long getSldExpiration() {
        return result.getSldExpiration();
      }
      public Builder setSldExpiration(long value) {
        result.hasSldExpiration = true;
        result.sldExpiration_ = value;
        return this;
      }
      public Builder clearSldExpiration() {
        result.hasSldExpiration = false;
        result.sldExpiration_ = 0L;
        return this;
      }

      // optional bool isResync = 10;
      public boolean hasIsResync() {
        return result.hasIsResync();
      }
      public boolean getIsResync() {
        return result.getIsResync();
      }
      public Builder setIsResync(boolean value) {
        result.hasIsResync = true;
        result.isResync_ = value;
        return this;
      }
      public Builder clearIsResync() {
        result.hasIsResync = false;
        result.isResync_ = false;
        return this;
      }

      // optional string group = 11;
      public boolean hasGroup() {
        return result.hasGroup();
      }
      public java.lang.String getGroup() {
        return result.getGroup();
      }
      public Builder setGroup(java.lang.String value) {
        if (value == null) {
    throw new NullPointerException();
  }
  result.hasGroup = true;
        result.group_ = value;
        return this;
      }
      public Builder clearGroup() {
        result.hasGroup = false;
        result.group_ = getDefaultInstance().getGroup();
        return this;
      }

      // optional string subGroup = 12;
      public boolean hasSubGroup() {
        return result.hasSubGroup();
      }
      public java.lang.String getSubGroup() {
        return result.getSubGroup();
      }
      public Builder setSubGroup(java.lang.String value) {
        if (value == null) {
    throw new NullPointerException();
  }
  result.hasSubGroup = true;
        result.subGroup_ = value;
        return this;
      }
      public Builder clearSubGroup() {
        result.hasSubGroup = false;
        result.subGroup_ = getDefaultInstance().getSubGroup();
        return this;
      }

      // optional int32 flag = 13;
      public boolean hasFlag() {
        return result.hasFlag();
      }
      public int getFlag() {
        return result.getFlag();
      }
      public Builder setFlag(int value) {
        result.hasFlag = true;
        result.flag_ = value;
        return this;
      }
      public Builder clearFlag() {
        result.hasFlag = false;
        result.flag_ = 0;
        return this;
      }

      // optional string providerName = 14;
      public boolean hasProviderName() {
        return result.hasProviderName();
      }
      public java.lang.String getProviderName() {
        return result.getProviderName();
      }
      public Builder setProviderName(java.lang.String value) {
        if (value == null) {
    throw new NullPointerException();
  }
  result.hasProviderName = true;
        result.providerName_ = value;
        return this;
      }
      public Builder clearProviderName() {
        result.hasProviderName = false;
        result.providerName_ = getDefaultInstance().getProviderName();
        return this;
      }

      // optional string resyncProviderName = 15;
      public boolean hasResyncProviderName() {
        return result.hasResyncProviderName();
      }
      public java.lang.String getResyncProviderName() {
        return result.getResyncProviderName();
      }
      public Builder setResyncProviderName(java.lang.String value) {
        if (value == null) {
    throw new NullPointerException();
  }
  result.hasResyncProviderName = true;
        result.resyncProviderName_ = value;
        return this;
      }
      public Builder clearResyncProviderName() {
        result.hasResyncProviderName = false;
        result.resyncProviderName_ = getDefaultInstance().getResyncProviderName();
        return this;
      }

      // optional string lockId = 16;
      public boolean hasLockId() {
        return result.hasLockId();
      }
      public java.lang.String getLockId() {
        return result.getLockId();
      }
      public Builder setLockId(java.lang.String value) {
        if (value == null) {
    throw new NullPointerException();
  }
  result.hasLockId = true;
        result.lockId_ = value;
        return this;
      }
      public Builder clearLockId() {
        result.hasLockId = false;
        result.lockId_ = getDefaultInstance().getLockId();
        return this;
      }

      // optional int32 lockAccessType = 17;
      public boolean hasLockAccessType() {
        return result.hasLockAccessType();
      }
      public int getLockAccessType() {
        return result.getLockAccessType();
      }
      public Builder setLockAccessType(int value) {
        result.hasLockAccessType = true;
        result.lockAccessType_ = value;
        return this;
      }
      public Builder clearLockAccessType() {
        result.hasLockAccessType = false;
        result.lockAccessType_ = 0;
        return this;
      }

      // optional uint64 itemVersion = 18;
      public boolean hasItemVersion() {
        return result.hasItemVersion();
      }
      public long getItemVersion() {
        return result.getItemVersion();
      }
      public Builder setItemVersion(long value) {
        result.hasItemVersion = true;
        result.itemVersion_ = value;
        return this;
      }
      public Builder clearItemVersion() {
        result.hasItemVersion = false;
        result.itemVersion_ = 0L;
        return this;
      }

      // optional .com.alachisoft.tayzgrid.common.protobuf.QueryInfo queryInfo = 19;
      public boolean hasQueryInfo() {
        return result.hasQueryInfo();
      }
      public com.alachisoft.tayzgrid.common.protobuf.QueryInfoProtocol.QueryInfo getQueryInfo() {
        return result.getQueryInfo();
      }
      public Builder setQueryInfo(com.alachisoft.tayzgrid.common.protobuf.QueryInfoProtocol.QueryInfo value) {
        if (value == null) {
          throw new NullPointerException();
        }
        result.hasQueryInfo = true;
        result.queryInfo_ = value;
        return this;
      }
      public Builder setQueryInfo(com.alachisoft.tayzgrid.common.protobuf.QueryInfoProtocol.QueryInfo.Builder builderForValue) {
        result.hasQueryInfo = true;
        result.queryInfo_ = builderForValue.build();
        return this;
      }
      public Builder mergeQueryInfo(com.alachisoft.tayzgrid.common.protobuf.QueryInfoProtocol.QueryInfo value) {
        if (result.hasQueryInfo() &&
            result.queryInfo_ != com.alachisoft.tayzgrid.common.protobuf.QueryInfoProtocol.QueryInfo.getDefaultInstance()) {
          result.queryInfo_ =
            com.alachisoft.tayzgrid.common.protobuf.QueryInfoProtocol.QueryInfo.newBuilder(result.queryInfo_).mergeFrom(value).buildPartial();
        } else {
          result.queryInfo_ = value;
        }
        result.hasQueryInfo = true;
        return this;
      }
      public Builder clearQueryInfo() {
        result.hasQueryInfo = false;
        result.queryInfo_ = com.alachisoft.tayzgrid.common.protobuf.QueryInfoProtocol.QueryInfo.getDefaultInstance();
        return this;
      }

      // optional .com.alachisoft.tayzgrid.common.protobuf.TagInfo tagInfo = 20;
      public boolean hasTagInfo() {
        return result.hasTagInfo();
      }
      public com.alachisoft.tayzgrid.common.protobuf.TagInfoProtocol.TagInfo getTagInfo() {
        return result.getTagInfo();
      }
      public Builder setTagInfo(com.alachisoft.tayzgrid.common.protobuf.TagInfoProtocol.TagInfo value) {
        if (value == null) {
          throw new NullPointerException();
        }
        result.hasTagInfo = true;
        result.tagInfo_ = value;
        return this;
      }
      public Builder setTagInfo(com.alachisoft.tayzgrid.common.protobuf.TagInfoProtocol.TagInfo.Builder builderForValue) {
        result.hasTagInfo = true;
        result.tagInfo_ = builderForValue.build();
        return this;
      }
      public Builder mergeTagInfo(com.alachisoft.tayzgrid.common.protobuf.TagInfoProtocol.TagInfo value) {
        if (result.hasTagInfo() &&
            result.tagInfo_ != com.alachisoft.tayzgrid.common.protobuf.TagInfoProtocol.TagInfo.getDefaultInstance()) {
          result.tagInfo_ =
            com.alachisoft.tayzgrid.common.protobuf.TagInfoProtocol.TagInfo.newBuilder(result.tagInfo_).mergeFrom(value).buildPartial();
        } else {
          result.tagInfo_ = value;
        }
        result.hasTagInfo = true;
        return this;
      }
      public Builder clearTagInfo() {
        result.hasTagInfo = false;
        result.tagInfo_ = com.alachisoft.tayzgrid.common.protobuf.TagInfoProtocol.TagInfo.getDefaultInstance();
        return this;
      }

      // repeated bytes data = 21;
      public java.util.List<com.google.protobuf.ByteString> getDataList() {
        return java.util.Collections.unmodifiableList(result.data_);
      }
      public int getDataCount() {
        return result.getDataCount();
      }
      public com.google.protobuf.ByteString getData(int index) {
        return result.getData(index);
      }
      public Builder setData(int index, com.google.protobuf.ByteString value) {
        if (value == null) {
    throw new NullPointerException();
  }
  result.data_.set(index, value);
        return this;
      }
      public Builder addData(com.google.protobuf.ByteString value) {
        if (value == null) {
    throw new NullPointerException();
  }
  if (result.data_.isEmpty()) {
          result.data_ = new java.util.ArrayList<com.google.protobuf.ByteString>();
        }
        result.data_.add(value);
        return this;
      }
      public Builder addAllData(
          java.lang.Iterable<? extends com.google.protobuf.ByteString> values) {
        if (result.data_.isEmpty()) {
          result.data_ = new java.util.ArrayList<com.google.protobuf.ByteString>();
        }
        super.addAll(values, result.data_);
        return this;
      }
      public Builder clearData() {
        result.data_ = java.util.Collections.emptyList();
        return this;
      }

      // optional .com.alachisoft.tayzgrid.common.protobuf.NamedTagInfo namedTagInfo = 22;
      public boolean hasNamedTagInfo() {
        return result.hasNamedTagInfo();
      }
      public com.alachisoft.tayzgrid.common.protobuf.NamedTagInfoProtocol.NamedTagInfo getNamedTagInfo() {
        return result.getNamedTagInfo();
      }
      public Builder setNamedTagInfo(com.alachisoft.tayzgrid.common.protobuf.NamedTagInfoProtocol.NamedTagInfo value) {
        if (value == null) {
          throw new NullPointerException();
        }
        result.hasNamedTagInfo = true;
        result.namedTagInfo_ = value;
        return this;
      }
      public Builder setNamedTagInfo(com.alachisoft.tayzgrid.common.protobuf.NamedTagInfoProtocol.NamedTagInfo.Builder builderForValue) {
        result.hasNamedTagInfo = true;
        result.namedTagInfo_ = builderForValue.build();
        return this;
      }
      public Builder mergeNamedTagInfo(com.alachisoft.tayzgrid.common.protobuf.NamedTagInfoProtocol.NamedTagInfo value) {
        if (result.hasNamedTagInfo() &&
            result.namedTagInfo_ != com.alachisoft.tayzgrid.common.protobuf.NamedTagInfoProtocol.NamedTagInfo.getDefaultInstance()) {
          result.namedTagInfo_ =
            com.alachisoft.tayzgrid.common.protobuf.NamedTagInfoProtocol.NamedTagInfo.newBuilder(result.namedTagInfo_).mergeFrom(value).buildPartial();
        } else {
          result.namedTagInfo_ = value;
        }
        result.hasNamedTagInfo = true;
        return this;
      }
      public Builder clearNamedTagInfo() {
        result.hasNamedTagInfo = false;
        result.namedTagInfo_ = com.alachisoft.tayzgrid.common.protobuf.NamedTagInfoProtocol.NamedTagInfo.getDefaultInstance();
        return this;
      }

      // optional .com.alachisoft.tayzgrid.common.protobuf.ObjectQueryInfo objectQueryInfo = 23;
      public boolean hasObjectQueryInfo() {
        return result.hasObjectQueryInfo();
      }
      public com.alachisoft.tayzgrid.common.protobuf.ObjectQueryInfoProtocol.ObjectQueryInfo getObjectQueryInfo() {
        return result.getObjectQueryInfo();
      }
      public Builder setObjectQueryInfo(com.alachisoft.tayzgrid.common.protobuf.ObjectQueryInfoProtocol.ObjectQueryInfo value) {
        if (value == null) {
          throw new NullPointerException();
        }
        result.hasObjectQueryInfo = true;
        result.objectQueryInfo_ = value;
        return this;
      }
      public Builder setObjectQueryInfo(com.alachisoft.tayzgrid.common.protobuf.ObjectQueryInfoProtocol.ObjectQueryInfo.Builder builderForValue) {
        result.hasObjectQueryInfo = true;
        result.objectQueryInfo_ = builderForValue.build();
        return this;
      }
      public Builder mergeObjectQueryInfo(com.alachisoft.tayzgrid.common.protobuf.ObjectQueryInfoProtocol.ObjectQueryInfo value) {
        if (result.hasObjectQueryInfo() &&
            result.objectQueryInfo_ != com.alachisoft.tayzgrid.common.protobuf.ObjectQueryInfoProtocol.ObjectQueryInfo.getDefaultInstance()) {
          result.objectQueryInfo_ =
            com.alachisoft.tayzgrid.common.protobuf.ObjectQueryInfoProtocol.ObjectQueryInfo.newBuilder(result.objectQueryInfo_).mergeFrom(value).buildPartial();
        } else {
          result.objectQueryInfo_ = value;
        }
        result.hasObjectQueryInfo = true;
        return this;
      }
      public Builder clearObjectQueryInfo() {
        result.hasObjectQueryInfo = false;
        result.objectQueryInfo_ = com.alachisoft.tayzgrid.common.protobuf.ObjectQueryInfoProtocol.ObjectQueryInfo.getDefaultInstance();
        return this;
      }

      // repeated bytes objectQueryInfoEncrypted = 24;
      public java.util.List<com.google.protobuf.ByteString> getObjectQueryInfoEncryptedList() {
        return java.util.Collections.unmodifiableList(result.objectQueryInfoEncrypted_);
      }
      public int getObjectQueryInfoEncryptedCount() {
        return result.getObjectQueryInfoEncryptedCount();
      }
      public com.google.protobuf.ByteString getObjectQueryInfoEncrypted(int index) {
        return result.getObjectQueryInfoEncrypted(index);
      }
      public Builder setObjectQueryInfoEncrypted(int index, com.google.protobuf.ByteString value) {
        if (value == null) {
    throw new NullPointerException();
  }
  result.objectQueryInfoEncrypted_.set(index, value);
        return this;
      }
      public Builder addObjectQueryInfoEncrypted(com.google.protobuf.ByteString value) {
        if (value == null) {
    throw new NullPointerException();
  }
  if (result.objectQueryInfoEncrypted_.isEmpty()) {
          result.objectQueryInfoEncrypted_ = new java.util.ArrayList<com.google.protobuf.ByteString>();
        }
        result.objectQueryInfoEncrypted_.add(value);
        return this;
      }
      public Builder addAllObjectQueryInfoEncrypted(
          java.lang.Iterable<? extends com.google.protobuf.ByteString> values) {
        if (result.objectQueryInfoEncrypted_.isEmpty()) {
          result.objectQueryInfoEncrypted_ = new java.util.ArrayList<com.google.protobuf.ByteString>();
        }
        super.addAll(values, result.objectQueryInfoEncrypted_);
        return this;
      }
      public Builder clearObjectQueryInfoEncrypted() {
        result.objectQueryInfoEncrypted_ = java.util.Collections.emptyList();
        return this;
      }

      // optional sint32 updateDataFilter = 25 [default = -1];
      public boolean hasUpdateDataFilter() {
        return result.hasUpdateDataFilter();
      }
      public int getUpdateDataFilter() {
        return result.getUpdateDataFilter();
      }
      public Builder setUpdateDataFilter(int value) {
        result.hasUpdateDataFilter = true;
        result.updateDataFilter_ = value;
        return this;
      }
      public Builder clearUpdateDataFilter() {
        result.hasUpdateDataFilter = false;
        result.updateDataFilter_ = -1;
        return this;
      }

      // optional sint32 removeDataFilter = 26 [default = -1];
      public boolean hasRemoveDataFilter() {
        return result.hasRemoveDataFilter();
      }
      public int getRemoveDataFilter() {
        return result.getRemoveDataFilter();
      }
      public Builder setRemoveDataFilter(int value) {
        result.hasRemoveDataFilter = true;
        result.removeDataFilter_ = value;
        return this;
      }
      public Builder clearRemoveDataFilter() {
        result.hasRemoveDataFilter = false;
        result.removeDataFilter_ = -1;
        return this;
      }

      // optional bool isReplace = 27;
      public boolean hasIsReplace() {
        return result.hasIsReplace();
      }
      public boolean getIsReplace() {
        return result.getIsReplace();
      }
      public Builder setIsReplace(boolean value) {
        result.hasIsReplace = true;
        result.isReplace_ = value;
        return this;
      }
      public Builder clearIsReplace() {
        result.hasIsReplace = false;
        result.isReplace_ = false;
        return this;
      }

      // optional bool returnExisting = 28;
      public boolean hasReturnExisting() {
        return result.hasReturnExisting();
      }
      public boolean getReturnExisting() {
        return result.getReturnExisting();
      }
      public Builder setReturnExisting(boolean value) {
        result.hasReturnExisting = true;
        result.returnExisting_ = value;
        return this;
      }
      public Builder clearReturnExisting() {
        result.hasReturnExisting = false;
        result.returnExisting_ = false;
        return this;
      }

      // optional bool compareOld = 29;
      public boolean hasCompareOld() {
        return result.hasCompareOld();
      }
      public boolean getCompareOld() {
        return result.getCompareOld();
      }
      public Builder setCompareOld(boolean value) {
        result.hasCompareOld = true;
        result.compareOld_ = value;
        return this;
      }
      public Builder clearCompareOld() {
        result.hasCompareOld = false;
        result.compareOld_ = false;
        return this;
      }

      // optional int32 oldValueFlag = 30;
      public boolean hasOldValueFlag() {
        return result.hasOldValueFlag();
      }
      public int getOldValueFlag() {
        return result.getOldValueFlag();
      }
      public Builder setOldValueFlag(int value) {
        result.hasOldValueFlag = true;
        result.oldValueFlag_ = value;
        return this;
      }
      public Builder clearOldValueFlag() {
        result.hasOldValueFlag = false;
        result.oldValueFlag_ = 0;
        return this;
      }

      // repeated bytes oldValue = 31;
      public java.util.List<com.google.protobuf.ByteString> getOldValueList() {
        return java.util.Collections.unmodifiableList(result.oldValue_);
      }
      public int getOldValueCount() {
        return result.getOldValueCount();
      }
      public com.google.protobuf.ByteString getOldValue(int index) {
        return result.getOldValue(index);
      }
      public Builder setOldValue(int index, com.google.protobuf.ByteString value) {
        if (value == null) {
    throw new NullPointerException();
  }
  result.oldValue_.set(index, value);
        return this;
      }
      public Builder addOldValue(com.google.protobuf.ByteString value) {
        if (value == null) {
    throw new NullPointerException();
  }
  if (result.oldValue_.isEmpty()) {
          result.oldValue_ = new java.util.ArrayList<com.google.protobuf.ByteString>();
        }
        result.oldValue_.add(value);
        return this;
      }
      public Builder addAllOldValue(
          java.lang.Iterable<? extends com.google.protobuf.ByteString> values) {
        if (result.oldValue_.isEmpty()) {
          result.oldValue_ = new java.util.ArrayList<com.google.protobuf.ByteString>();
        }
        super.addAll(values, result.oldValue_);
        return this;
      }
      public Builder clearOldValue() {
        result.oldValue_ = java.util.Collections.emptyList();
        return this;
      }

      // @@protoc_insertion_point(builder_scope:com.alachisoft.tayzgrid.common.protobuf.InsertCommand)
    }

    static {
      defaultInstance = new InsertCommand(true);
      com.alachisoft.tayzgrid.common.protobuf.InsertCommandProtocol.internalForceInit();
      defaultInstance.initFields();
    }

    // @@protoc_insertion_point(class_scope:com.alachisoft.tayzgrid.common.protobuf.InsertCommand)
  }

  private static com.google.protobuf.Descriptors.Descriptor
    internal_static_com_alachisoft_tayzgrid_common_protobuf_InsertCommand_descriptor;
  private static
    com.google.protobuf.GeneratedMessage.FieldAccessorTable
      internal_static_com_alachisoft_tayzgrid_common_protobuf_InsertCommand_fieldAccessorTable;

  public static com.google.protobuf.Descriptors.FileDescriptor
      getDescriptor() {
    return descriptor;
  }
  private static com.google.protobuf.Descriptors.FileDescriptor
      descriptor;
  static {
    java.lang.String[] descriptorData = {
      "\n\023InsertCommand.proto\022\'com.alachisoft.ta" +
      "yzgrid.common.protobuf\032\017QueryInfo.proto\032" +
      "\rTagInfo.proto\032\022NamedTagInfo.proto\032\025Obje" +
      "ctQueryInfo.proto\"\206\007\n\rInsertCommand\022\013\n\003k" +
      "ey\030\001 \001(\014\022\021\n\trequestId\030\002 \001(\003\022\030\n\020updateCal" +
      "lbackId\030\003 \001(\021\022\030\n\020removeCallbackId\030\004 \001(\021\022" +
      "#\n\033datasourceUpdatedCallbackId\030\005 \001(\021\022\017\n\007" +
      "isAsync\030\006 \001(\010\022\020\n\010priority\030\007 \001(\005\022\025\n\rabsEx" +
      "piration\030\010 \001(\003\022\025\n\rsldExpiration\030\t \001(\003\022\020\n" +
      "\010isResync\030\n \001(\010\022\r\n\005group\030\013 \001(\t\022\020\n\010subGro",
      "up\030\014 \001(\t\022\014\n\004flag\030\r \001(\005\022\024\n\014providerName\030\016" +
      " \001(\t\022\032\n\022resyncProviderName\030\017 \001(\t\022\016\n\006lock" +
      "Id\030\020 \001(\t\022\026\n\016lockAccessType\030\021 \001(\005\022\023\n\013item" +
      "Version\030\022 \001(\004\022E\n\tqueryInfo\030\023 \001(\01322.com.a" +
      "lachisoft.tayzgrid.common.protobuf.Query" +
      "Info\022A\n\007tagInfo\030\024 \001(\01320.com.alachisoft.t" +
      "ayzgrid.common.protobuf.TagInfo\022\014\n\004data\030" +
      "\025 \003(\014\022K\n\014namedTagInfo\030\026 \001(\01325.com.alachi" +
      "soft.tayzgrid.common.protobuf.NamedTagIn" +
      "fo\022Q\n\017objectQueryInfo\030\027 \001(\01328.com.alachi",
      "soft.tayzgrid.common.protobuf.ObjectQuer" +
      "yInfo\022 \n\030objectQueryInfoEncrypted\030\030 \003(\014\022" +
      "\034\n\020updateDataFilter\030\031 \001(\021:\002-1\022\034\n\020removeD" +
      "ataFilter\030\032 \001(\021:\002-1\022\021\n\tisReplace\030\033 \001(\010\022\026" +
      "\n\016returnExisting\030\034 \001(\010\022\022\n\ncompareOld\030\035 \001" +
      "(\010\022\024\n\014oldValueFlag\030\036 \001(\005\022\020\n\010oldValue\030\037 \003" +
      "(\014B\027B\025InsertCommandProtocol"
    };
    com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
      new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
        public com.google.protobuf.ExtensionRegistry assignDescriptors(
            com.google.protobuf.Descriptors.FileDescriptor root) {
          descriptor = root;
          internal_static_com_alachisoft_tayzgrid_common_protobuf_InsertCommand_descriptor =
            getDescriptor().getMessageTypes().get(0);
          internal_static_com_alachisoft_tayzgrid_common_protobuf_InsertCommand_fieldAccessorTable = new
            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
              internal_static_com_alachisoft_tayzgrid_common_protobuf_InsertCommand_descriptor,
              new java.lang.String[] { "Key", "RequestId", "UpdateCallbackId", "RemoveCallbackId", "DatasourceUpdatedCallbackId", "IsAsync", "Priority", "AbsExpiration", "SldExpiration", "IsResync", "Group", "SubGroup", "Flag", "ProviderName", "ResyncProviderName", "LockId", "LockAccessType", "ItemVersion", "QueryInfo", "TagInfo", "Data", "NamedTagInfo", "ObjectQueryInfo", "ObjectQueryInfoEncrypted", "UpdateDataFilter", "RemoveDataFilter", "IsReplace", "ReturnExisting", "CompareOld", "OldValueFlag", "OldValue", },
              com.alachisoft.tayzgrid.common.protobuf.InsertCommandProtocol.InsertCommand.class,
              com.alachisoft.tayzgrid.common.protobuf.InsertCommandProtocol.InsertCommand.Builder.class);
          return null;
        }
      };
    com.google.protobuf.Descriptors.FileDescriptor
      .internalBuildGeneratedFileFrom(descriptorData,
        new com.google.protobuf.Descriptors.FileDescriptor[] {
          com.alachisoft.tayzgrid.common.protobuf.QueryInfoProtocol.getDescriptor(),
          com.alachisoft.tayzgrid.common.protobuf.TagInfoProtocol.getDescriptor(),
          com.alachisoft.tayzgrid.common.protobuf.NamedTagInfoProtocol.getDescriptor(),
          com.alachisoft.tayzgrid.common.protobuf.ObjectQueryInfoProtocol.getDescriptor(),
        }, assigner);
  }

  public static void internalForceInit() {}

  // @@protoc_insertion_point(outer_class_scope)
}


text:
export SRCROOT="<%= compileDir %>" &&
mkdir -p $SRCROOT &&
cd $SRCROOT &&

### Set versions and directories
export PVERSION_LIBICONV="<%= packageSoftwareVersion %>" &&

### libIconv
# CheckURI: http://ftp.gnu.org/pub/gnu/libiconv/
cd $SRCROOT && . ../build_functions.sh &&
export PNAME="libiconv" &&
export PVERSION="$PVERSION_LIBICONV" &&
export PDIR="$PNAME-$PVERSION" &&
export PFILE="$PDIR.tar.gz" &&
export PURI="http://ftp.gnu.org/pub/gnu/libiconv/$PFILE" &&
rm -rf $PDIR &&
GetUnpackCd &&
./configure &&
make -j 2 &&
make install &&
ldconfig &&
cd $SRCROOT &&
rm -rf $PDIR &&

exit 0

redpajama_set_name: RedPajamaGithub


text:
import { parse } from './modules/parse.js';
import enginesImport from './modules/engines.js';
import _ from 'lodash';
import generic from './modules/engines/generic.js'
import fieldCodesObject from "./data/fieldCodesObject.js"

import global from "./modules/global.js";
export { fieldCodesObject, global };

let polyglot;
export default polyglot = {

	/**
	* Translate the given query using the given engine ID
	* This is really just a wrapper for the parse() + engine[ENGINE].compile() pipeline
	* Output will be run via preProcess() + postProcess()
	* @param {string} query The query to translate
	* @param {string} engine The ID of the engine to use
	* @param {Object} options Optional options structure to pass to the engine
	* @return {string} The translated search query
	*/
	translate: (query, engine, options) => {
		var tree = parse(query, options);
		return polyglot.postProcess(generic.compile(_.cloneDeep(tree), options, engine), options);
	},

	/**
	* Translate the given query using all the supported engines
	* Calling this function instead of individual 'translate()' calls is much more efficient as the tree needs to be compiled only once
	* Output will be run via preProcess() + postProcess()
	* @param {string} query The query to translate
	* @param {Object} options Optional options structure to pass to each engine
	* @return {Object} The translated search query in each case where the engine ID is the key of the object and the value is the translated string
	*/
	translateAll: (query, options) => {
		var output = {};
		var tree = parse(query, options);
		const engines = Object.keys(fieldCodesObject);
		engines.forEach(engine => {
			output[engine] = polyglot.postProcess(generic.compile(_.cloneDeep(tree), options, engine), options);
		})
		output['lexicalTreeJSON'] = enginesImport.lexicalTreeJSON.compile(tree, options), options
		return output;
	},

	/**
	* Pre-proess the compile tree before it gets handed to each engines compile function
	* @param {Object} tree The tree to compile
	* @param {Object} [options] Additional options - these are provided downstream from the parent 'parse()' function
	* @return {Object} The mutated tree
	* @see parse()
	*/
	preProcess: (tree, options) => {
		var settings = _.defaults(options, {
		});

		// NOTE: THIS FUNCTION IS CURRENTLY ONLY A STUB

		return tree;
	},

	/**
	* Post process the data from an engine
	* This function applies the following behaviours:
	* - If HTML is true all `\n` characters are replaced with `<br/>`
	* - If HTML is false all  item wrappers are removed
	* @param {string} text The output from the engine - called from translate() / translateAll()
	* @param {Object} options Options provided during post-processing - these are provided downstream from the parent 'parse()' function
	* @param {boolean} [options.forceString] Force the output to be a string even if the module returns something unusual (e.g. mongodb driver returns an object)
	* @param {boolean} [options.html=true] Provide HTML output
	* @param {boolean} [options.trim=true] Trim all output lines
	* @returns {string} The post processed text
	* @see parse()
	*/
	postProcess: (text, options) => {
		var settings = _.defaults(options, {
			forceString: true,
			html: true,
			highlighting: false,
			trim: false,
			transposeLines: true,
		});

		if (settings.forceString && !_.isString(text)) text = JSON.stringify(text, null, '\t');

		if (settings.highlighting) {
			// Highlight logical operators purple
			text = text
				.replace(/(\sOR\s|\sAND\s|\sNOT\s)/g, (a, b) => `<font color="purple">${b}</font>`)
		}

		if (settings.html) {
			text = text
				.replace(/\n/g, '
')
				.replace(/\t/g, '')
		} else if (_.isString(text)) { // Flatten HTML - Yes this is a horrible method, but its quick
			for (var i = 0; i < 10; i ++) {
				text = text.replace(/<(.+)(\s.*)>(.*)<\/\1>/g, '$3');
			}
		}

		if (settings.trim) {
			text = text
				.replace(/^\s+/gm, '')
				.replace(/\s+$/gm, '')
		}

		return text;
	},
};


text:
// flowlint ambiguous-object-type:error

'use strict';

const RelayFeatureFlags = require('../../util/RelayFeatureFlags');
const RelayModernEnvironment = require('../RelayModernEnvironment');
const RelayModernStore = require('../RelayModernStore');
const RelayNetwork = require('../../network/RelayNetwork');
const RelayObservable = require('../../network/RelayObservable');
const RelayRecordSource = require('../RelayRecordSource');

const nullthrows = require('nullthrows');

const {graphql, getFragment, getRequest} = require('../../query/GraphQLTag');
const {
  createOperationDescriptor,
} = require('../RelayModernOperationDescriptor');
const {getSingularSelector} = require('../RelayModernSelector');
const {disallowWarnings} = require('relay-test-utils-internal');

disallowWarnings();

describe('@connection with dynamic key', () => {
  let callbacks;
  let complete;
  let dataSource;
  let environment;
  let error;
  let fetch;
  let fragment;
  let next;
  let operation;
  let paginationQuery;
  let query;
  let source;
  let store;

  beforeEach(() => {
    RelayFeatureFlags.ENABLE_VARIABLE_CONNECTION_KEY = true;

    query = getRequest(graphql`
      query RelayModernEnvironmentDynamicConnectionKeyTestFeedbackQuery(
        $id: ID!
        $commentsKey: String
      ) {
        node(id: $id) {
          ...RelayModernEnvironmentDynamicConnectionKeyTestFeedbackFragment
        }
      }
    `);
    paginationQuery = getRequest(graphql`
      query RelayModernEnvironmentDynamicConnectionKeyTestPaginationQuery(
        $id: ID!
        $commentsKey: String
        $count: Int!
        $cursor: ID!
      ) {
        node(id: $id) {
          ...RelayModernEnvironmentDynamicConnectionKeyTestFeedbackFragment
            @arguments(count: $count, cursor: $cursor)
        }
      }
    `);
    fragment = getFragment(graphql`
      fragment RelayModernEnvironmentDynamicConnectionKeyTestFeedbackFragment on Feedback
        @argumentDefinitions(
          count: {type: "Int", defaultValue: 2}
          cursor: {type: "ID"}
        ) {
        id
        comments(after: $cursor, first: $count, orderby: "date")
          @connection(
            key: "RelayModernEnvironmentDynamicConnectionKeyTestFeedbackFragment_comments"
            dynamicKey_UNSTABLE: $commentsKey
            filters: ["orderby"]
          ) {
          edges {
            node {
              id
            }
          }
        }
      }
    `);
    const variables = {
      id: '<feedbackid>',
      commentsKey: '<comments>',
    };
    operation = createOperationDescriptor(query, variables);

    complete = jest.fn();
    error = jest.fn();
    next = jest.fn();
    callbacks = {complete, error, next};
    fetch = jest.fn((_query, _variables, _cacheConfig) => {
      return RelayObservable.create(sink => {
        dataSource = sink;
      });
    });
    source = RelayRecordSource.create();
    store = new RelayModernStore(source);
    environment = new RelayModernEnvironment({
      network: RelayNetwork.create(fetch),
      store,
    });
  });

  afterEach(() => {
    RelayFeatureFlags.ENABLE_VARIABLE_CONNECTION_KEY = false;
  });

  it('publishes initial results to the store', () => {
    const operationSnapshot = environment.lookup(operation.fragment);
    const operationCallback = jest.fn();
    environment.subscribe(operationSnapshot, operationCallback);

    environment.execute({operation}).subscribe(callbacks);
    const payload = {
      data: {
        node: {
          __typename: 'Feedback',
          id: '<feedbackid>',
          comments: {
            edges: [
              {
                cursor: 'cursor-1',
                node: {
                  __typename: 'Comment',
                  id: 'node-1',
                },
              },
              {
                cursor: 'cursor-2',
                node: {
                  __typename: 'Comment',
                  id: 'node-2',
                },
              },
            ],
            pageInfo: {
              hasNextPage: true,
              endCursor: 'cursor-2',
            },
          },
        },
      },
    };
    dataSource.next(payload);
    jest.runAllTimers();

    expect(operationCallback).toBeCalledTimes(1);
    const nextOperationSnapshot = operationCallback.mock.calls[0][0];
    expect(nextOperationSnapshot.isMissingData).toBe(false);
    expect(nextOperationSnapshot.data).toEqual({
      node: {
        __id: '<feedbackid>',

        __fragments: {
          RelayModernEnvironmentDynamicConnectionKeyTestFeedbackFragment: {},
        },

        __fragmentOwner: operation.request,
      },
    });

    const selector = nullthrows(
      getSingularSelector(fragment, nextOperationSnapshot.data?.node),
    );
    const snapshot = environment.lookup(selector);
    expect(snapshot.isMissingData).toBe(false);
    expect(snapshot.data).toEqual({
      id: '<feedbackid>',
      comments: {
        edges: [
          {cursor: 'cursor-1', node: {id: 'node-1', __typename: 'Comment'}},
          {cursor: 'cursor-2', node: {id: 'node-2', __typename: 'Comment'}},
        ],
        pageInfo: {
          hasNextPage: true,
          endCursor: 'cursor-2',
        },
      },
    });
  });

  describe('after initial data has been fetched and subscribed', () => {
    let callback;

    beforeEach(() => {
      environment.execute({operation}).subscribe(callbacks);
      const payload = {
        data: {
          node: {
            __typename: 'Feedback',
            id: '<feedbackid>',
            comments: {
              edges: [
                {
                  cursor: 'cursor-1',
                  node: {
                    __typename: 'Comment',
                    id: 'node-1',
                  },
                },
                {
                  cursor: 'cursor-2',
                  node: {
                    __typename: 'Comment',
                    id: 'node-2',
                  },
                },
              ],
              pageInfo: {
                hasNextPage: true,
                endCursor: 'cursor-2',
              },
            },
          },
        },
      };
      dataSource.next(payload);
      dataSource.complete();
      fetch.mockClear();
      jest.runAllTimers();

      const operationSnapshot = environment.lookup(operation.fragment);

      const selector = nullthrows(
        getSingularSelector(fragment, operationSnapshot.data?.node),
      );
      const snapshot = environment.lookup(selector);
      callback = jest.fn();
      environment.subscribe(snapshot, callback);
    });

    it('updates when paginated with the same dynamic key value', () => {
      const paginationOperation = createOperationDescriptor(paginationQuery, {
        id: '<feedbackid>',
        commentsKey: '<comments>',
        count: 2,
        cursor: 'cursor-2',
      });
      environment.execute({operation: paginationOperation}).subscribe({});
      const paginationPayload = {
        data: {
          node: {
            __typename: 'Feedback',
            id: '<feedbackid>',
            comments: {
              edges: [
                {
                  cursor: 'cursor-3',
                  node: {
                    __typename: 'Comment',
                    id: 'node-3',
                  },
                },
                {
                  cursor: 'cursor-4',
                  node: {
                    __typename: 'Comment',
                    id: 'node-4',
                  },
                },
              ],
              pageInfo: {
                hasNextPage: true,
                endCursor: 'cursor-4',
              },
            },
          },
        },
      };
      dataSource.next(paginationPayload);
      jest.runAllTimers();

      expect(callback).toBeCalledTimes(1);
      const nextSnapshot = callback.mock.calls[0][0];
      expect(nextSnapshot.isMissingData).toBe(false);
      expect(nextSnapshot.data).toEqual({
        id: '<feedbackid>',
        comments: {
          edges: [
            {cursor: 'cursor-1', node: {id: 'node-1', __typename: 'Comment'}},
            {cursor: 'cursor-2', node: {id: 'node-2', __typename: 'Comment'}},
            {cursor: 'cursor-3', node: {id: 'node-3', __typename: 'Comment'}},
            {cursor: 'cursor-4', node: {id: 'node-4', __typename: 'Comment'}},
          ],
          pageInfo: {
            hasNextPage: true,
            endCursor: 'cursor-4',
          },
        },
      });
    });

    it('does not update when paginated with a different dynamic key', () => {
      const paginationOperation = createOperationDescriptor(paginationQuery, {
        id: '<feedbackid>',
        commentsKey: '<other-comments>', // different key
        count: 2,
        cursor: 'cursor-2',
      });
      environment.execute({operation: paginationOperation}).subscribe({});
      const paginationPayload = {
        data: {
          node: {
            __typename: 'Feedback',
            id: '<feedbackid>',
            comments: {
              edges: [
                {
                  cursor: 'cursor-3',
                  node: {
                    __typename: 'Comment',
                    id: 'node-3',
                  },
                },
                {
                  cursor: 'cursor-4',
                  node: {
                    __typename: 'Comment',
                    id: 'node-4',
                  },
                },
              ],
              pageInfo: {
                hasNextPage: true,
                endCursor: 'cursor-4',
              },
            },
          },
        },
      };
      dataSource.next(paginationPayload);
      jest.runAllTimers();

      expect(callback).toBeCalledTimes(0);
    });
  });
});


text:
//
// Created by thuanqin on 16/5/24.
//
#include "service/agent.h"

#include <cstdint>
#include <thread>
#include <vector>

#include "boost/asio.hpp"
#include "boost/bind.hpp"

#include "common/config.h"
#include "common/log.h"
#include "common/utils.h"

void ControllerSession::send_msg(msg_ptr msg) {
    /*
     * 发送消息。该方法会将消息放到发送队列中,然后判断目前是否正在发送消息,如果是则直接返回,否则开始发送。
     * 发送开始后,每发送完一个消息都会去检查发送队列是否是空的,如果是则结束发送,否则继续发送并重复此过程。
     * */
    if (!valid()) return;
    auto take_care_of_send = false;
    msg_lock.lock();
    messages.push(msg);
    if (!sending) {
        take_care_of_send = true;
        sending = true;
    } else {
        take_care_of_send = false;
    }
    msg_lock.unlock();
    if (!take_care_of_send) {
        // 已经有worker在负责发送消息了
        return;
    }
    // 需要负责发送消息
    agent_service->begin_write(shared_from_this());
}

void ControllerSession::invalid_sess() {
    if (!valid()) return;
    stop();
}

AgentService::AgentService(unsigned int thread_num, const std::string &controller_address,
                           unsigned int controller_port,
                           BaseController *controller,
                           MsgType srv_msg_id_type):thread_num(thread_num),
                                                    controller_address(controller_address),
                                                    controller_port(controller_port),
                                                    controller(controller),
                                                    srv_msg_id_type(srv_msg_id_type){
    controller->init();

    start_connect();
}

void AgentService::invalid_and_remove_sess(controller_sess_ptr controller_sess) {
    sess_lock.lock();
    if (controller_sess->valid()) {
        // 通知controller移除此session相关的信息
        controller->invalid_sess(controller_sess);
        // 通知session清理相关资源
        controller_sess->invalid_sess();
    }
    // 删除对session的引用
    for (auto k=controller_sessions.begin(); k!=controller_sessions.end(); k++) {
        if ((*k)->get_address() == controller_sess->get_address()
            && (*k)->get_port() == controller_sess->get_port()) {
            controller_sessions.erase(k);
            break;
        }
    }
    sess_lock.unlock();
}

void AgentService::handle_connect(controller_sess_ptr controller_sess, boost::system::error_code error) {
    if (!error) {
        auto controller_remote_address = controller_sess->get_socket().remote_endpoint().address().to_string();
        auto controller_remote_port = controller_sess->get_socket().remote_endpoint().port();
        controller_sess->set_address(controller_remote_address);
        controller_sess->set_port(controller_remote_port);
        LOG_INFO("Connected to controller: " << controller_remote_address << ":" << controller_remote_port);

        try {
            controller->associate_sess(controller_sess);
            // 通知Controller我是什么类型
            controller_sess->send_msg(std::make_shared<Message>(
                                        srv_msg_id_type,
                                        new char[0],
                                        0
                                ));
        } catch (...) {
            LOG_ERROR("Session association Exception!!!")
            invalid_and_remove_sess(controller_sess);
            reconnect();
        }
        start_read(controller_sess);
    } else {
        LOG_ERROR("Connect to controller error: " << error)
        invalid_and_remove_sess(controller_sess);
        reconnect();
    }
}

void AgentService::reconnect() {
    sess_lock.lock();
    std::this_thread::sleep_for(std::chrono::seconds(3));
    if (controller_sessions.size() == 0) {
        LOG_INFO("Reconnect to controller/sdp now.")
        start_connect();
    }
    sess_lock.unlock();
}

void AgentService::start_connect() {
    auto new_controller_info = controller->get_new_controller_and_reset();
    boost::asio::ip::tcp::endpoint ep;
    if (new_controller_info.port == -1) {
        LOG_INFO("connect to controller with config from file")
        ep = boost::asio::ip::tcp::endpoint(boost::asio::ip::address::from_string(controller_address), controller_port);
    } else {
        LOG_INFO("connect to sdp by config from controller")
        ep = boost::asio::ip::tcp::endpoint(boost::asio::ip::address::from_string(new_controller_info.ip),
                                            new_controller_info.port);
    }
    controller_sess_ptr controller_sess = std::make_shared<ControllerSession>(io_service, this, controller);
    controller_sess->set_read_timeout(static_cast<unsigned int>(config_mgr.get_item("agent_read_timeout")->get_int()));
    controller_sess->set_write_timeout(static_cast<unsigned int>(config_mgr.get_item("agent_write_timeout")->get_int()));
    controller_sessions.push_back(controller_sess);
    boost::asio::ip::tcp::endpoint cep(boost::asio::ip::address::from_string(
            config_mgr.get_item("agent_bind_address")->get_str()), 0);
    controller_sess->get_socket().open(boost::asio::ip::tcp::v4());
    controller_sess->get_socket().bind(cep);
    controller_sess->get_socket().async_connect(ep,
                                                boost::bind(&AgentService::handle_connect, this,
                                                            controller_sess, boost::asio::placeholders::error));
}

void AgentService::run() {
    LOG_INFO("AgentService run. Thread num: " << thread_num
             << " Controller Address: " << controller_address << " Port: " << controller_port)
    // 监听线程
    for (unsigned int i=0; i<thread_num; i++) {
        std::thread t([this](){this->io_service.run();});
        controller->add_thread(std::move(t));
    }
    controller->wait();
}

size_t AgentService::read_completion_handler(controller_sess_ptr controller_sess, boost::system::error_code const &error,
                                                  size_t bytes_transferred) {
    if (!error) {
        if (controller_sess->get_cmsg_length() == 0) {
            if (controller_sess->get_read_buf().size() >= msg_length_hdr_size) {
                return 0;
            }
        } else {
            if (controller_sess->get_read_buf().size() >= controller_sess->get_cmsg_length()) {
                return 0;
            }
        }
        return 1024;
    } else if (error == boost::asio::error::eof || error == boost::asio::error::connection_reset) {
        // 对端中断了连接
        invalid_and_remove_sess(controller_sess);
        reconnect();
        return 0;
    } else {
        LOG_ERROR("read_completion_handler error: " << error)
        invalid_and_remove_sess(controller_sess);
        reconnect();
        return 0;
    }
}

void AgentService::start_read(controller_sess_ptr controller_sess) {
    if (!controller_sess->valid()) return;
    // 设置新的超时器
    controller_sess->get_read_deadline_timer().expires_from_now(
            boost::posix_time::seconds(controller_sess->get_read_timeout()));
    controller_sess->get_read_deadline_timer().async_wait(
            controller_sess->get_strand().wrap(
                    boost::bind(&AgentService::handle_read_timeout,
                                this, controller_sess,
                                boost::asio::placeholders::error)));
    // 将读取的socket放入poll中
    boost::asio::async_read(
            controller_sess->get_socket(),
            controller_sess->get_read_buf(),
            boost::bind(&AgentService::read_completion_handler,
                        this,
                        controller_sess,
                        boost::asio::placeholders::error,
                        boost::asio::placeholders::bytes_transferred),
            controller_sess->get_strand().wrap(
                    boost::bind(&AgentService::handle_read,
                                this,
                                controller_sess,
                                boost::asio::placeholders::error,
                                boost::asio::placeholders::bytes_transferred))
    );
}

void AgentService::handle_read_timeout(controller_sess_ptr controller_sess, boost::system::error_code const &error) {
    if (!error) {
        if (controller_sess->get_read_deadline_timer().expires_at() >= boost::asio::deadline_timer::traits_type::now()) {
            // 计时器时间被重置过,因此没有超时.此超时器被调用是由于其在read函数处理期间排队在队列中

        } else {
            LOG_WARN("Agent read time out")
            // 针对读取超时进行相关操作
            invalid_and_remove_sess(controller_sess);
            reconnect();
        }
    } else if (error == boost::asio::error::operation_aborted) {
        // 定时器被重置超时时间
        ;
    } else {
        LOG_ERROR("Read time out error: " << error)
        invalid_and_remove_sess(controller_sess);
        reconnect();
    }

}

void AgentService::handle_write_timeout(controller_sess_ptr controller_sess, boost::system::error_code const &error) {
    if (!error) {
        if (controller_sess->get_write_deadline_timer().expires_at() >= boost::asio::deadline_timer::traits_type::now()) {
            // 计时器时间被重置过,因此没有超时.此超时器被调用是由于其在read函数处理期间排队在队列中

        } else {
            LOG_WARN("Agent write time out")
            // 针对写入超时进行相关操作
            invalid_and_remove_sess(controller_sess);
            reconnect();
        }
    } else if (error == boost::asio::error::operation_aborted) {
        // 定时器被重置超时时间
        ;
    } else {
        LOG_ERROR("Write time out error: " << error)
        // 如果必要要对socket进行关闭操作,否则socket会一直在poll中write
        invalid_and_remove_sess(controller_sess);
        reconnect();
    }

}

void AgentService::handle_write(controller_sess_ptr controller_sess, boost::system::error_code const &error,
                                     size_t bytes_transferred) {
    if (!error) {
        if (!controller_sess->valid()) {
            LOG_WARN("Agent not valid")
            return;
        }

        // 继续发送队列中的消息
        start_write(controller_sess);
    } else if (error == boost::asio::error::eof || error == boost::asio::error::connection_reset) {
        // 对端中断了连接
        invalid_and_remove_sess(controller_sess);
        reconnect();
    } else {
        LOG_ERROR("Write data error: " << error)
        invalid_and_remove_sess(controller_sess);
        reconnect();
    }
}

void AgentService::handle_read(controller_sess_ptr controller_sess, boost::system::error_code const &error,
                                    size_t bytes_transferred) {
    if (!error) {
        if (!controller_sess->valid()) {
            LOG_WARN("Agent not valid")
            return;
        }

        bool enough_data = true;
        while (enough_data) {
            /*
             * 报文格式为: 4字节余下部分总长度 + 2字节msg类型 + protobuf报文
             * 例如收到一个10字节的报文,则开始的4个字节为0x00000006,接着是2字节的类型,如0x0001,在接着是4字节的profobuf内容
             * */

            // 获取长度信息
            if (controller_sess->get_cmsg_length() == 0) {
                char ld[msg_length_hdr_size];
                // 该操作会consume read_buf的字节
                controller_sess->get_read_buf().sgetn(ld, msg_length_hdr_size);
                auto dl = get_u32_from_4_u8(uint8_t(ld[0]), uint8_t(ld[1]), uint8_t(ld[2]), uint8_t(ld[3]));
                controller_sess->set_cmsg_length(dl);
            }
            // 根据长度信息判断该报文是否包含了完整的数据部分,如果不是则不处理,否则处理这部分数据
            if (controller_sess->get_read_buf().size() >= controller_sess->get_cmsg_length()) {
                char msg_type_[msg_type_hdr_size];
                controller_sess->get_read_buf().sgetn(msg_type_, msg_type_hdr_size);
                char *msg_body = new char[controller_sess->get_cmsg_length()-msg_type_hdr_size];
                controller_sess->get_read_buf().sgetn(msg_body, controller_sess->get_cmsg_length()-msg_type_hdr_size);
                // 处理消息
                auto msg_type = static_cast<unsigned int>(get_u32_from_2_u8(uint8_t(
                        msg_type_[0]), uint8_t(msg_type_[1])));

                // 交由controller处理消息
                auto msg = std::make_shared<Message>(static_cast<MsgType>(msg_type), msg_body,
                                                     controller_sess->get_cmsg_length()-msg_type_hdr_size);
                try {
                    controller->handle_msg(controller_sess, msg);
                } catch (...) {
                    // controller处理消息异常
                }
                controller_sess->set_cmsg_length(0);

                if (!controller_sess->valid()) {
                    enough_data = false;
                }

                if (controller_sess->get_read_buf().size() < msg_length_hdr_size) {
                    enough_data = false;
                }
            } else {
                enough_data = false;
            }
        }

        // 继续监听
        start_read(controller_sess);
    } else if (error == boost::asio::error::eof || error == boost::asio::error::connection_reset) {
        // 对端中断了连接
        invalid_and_remove_sess(controller_sess);
        reconnect();
    } else {
        LOG_ERROR("Read data error: " << error)
        invalid_and_remove_sess(controller_sess);
        reconnect();
    }
}

void AgentService::begin_write(controller_sess_ptr controller_sess) {
    start_write(controller_sess);
}

void AgentService::start_write(controller_sess_ptr controller_sess) {
    if (!controller_sess->valid()) return;
    msg_ptr msg = nullptr;
    controller_sess->get_msg_lock().lock();
    if (controller_sess->get_messages().empty()) {
        // 没有要发的消息了
        controller_sess->set_sending(false);
        controller_sess->get_msg_lock().unlock();
        controller_sess->get_write_deadline_timer().expires_at(boost::posix_time::pos_infin);
        return;
    }
    msg = controller_sess->get_messages().front();
    controller_sess->get_messages().pop();
    controller_sess->get_msg_lock().unlock();

    // 构建发送的write_buf
    if (controller_sess->get_write_buf().size() != 0) {
        LOG_WARN("Controller write buf is not empty!")
        controller_sess->get_write_buf().consume(controller_sess->get_write_buf().size());
    }

    auto msg_size = get_4_u8_from_u32(static_cast<uint32_t>(msg_type_hdr_size + msg->get_msg_body_size()));
    auto msg_type = get_2_u8_from_u32(static_cast<uint32_t>(msg->get_msg_type()));
    std::ostream os(&(controller_sess->get_write_buf()));
    os.write(msg_size, msg_length_hdr_size);
    os.write(msg_type, msg_type_hdr_size);
    os.write(msg->get_msg_body(), msg->get_msg_body_size());
    delete[] msg_size;
    delete[] msg_type;

    // 设置新的超时器
    controller_sess->get_write_deadline_timer().expires_from_now(
            boost::posix_time::seconds(controller_sess->get_write_timeout()));
    controller_sess->get_write_deadline_timer().async_wait(
            controller_sess->get_strand().wrap(
                    boost::bind(&AgentService::handle_write_timeout,
                                this, controller_sess,
                                boost::asio::placeholders::error)));
    // 将写入的socket放入poll中
    boost::asio::async_write(
            controller_sess->get_socket(),
            controller_sess->get_write_buf(),
            controller_sess->get_strand().wrap(
                    boost::bind(&AgentService::handle_write,
                                this,
                                controller_sess,
                                boost::asio::placeholders::error,
                                boost::asio::placeholders::bytes_transferred))
    );
}