Commit 0b7d3494 authored by chiaming2000's avatar chiaming2000
Browse files

Support Kinetic protocol 3.0.7: support crc32 and crc32c algorithms.

https://github.com/Kinetic/kinetic-protocol/releases/tag/3.0.7

Use versions that are consistent to Kinetic protocol versions.
parent 38b5f23e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@
	<parent>
		<groupId>com.seagate.kinetic</groupId>
		<artifactId>kinetic-java</artifactId>
		<version>0.8.0.6-SNAPSHOT</version>
		<version>3.0.7-SNAPSHOT</version>
	</parent>
	<artifactId>kinetic-all</artifactId>
	<packaging>jar</packaging>
+1 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
	<parent>
		<groupId>com.seagate.kinetic</groupId>
		<artifactId>kinetic-java</artifactId>
		<version>0.8.0.6-SNAPSHOT</version>
		<version>3.0.7-SNAPSHOT</version>
	</parent>
	<artifactId>kinetic-client</artifactId>
	<name>Kinetic/Client</name>
+1 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
	<parent>
		<groupId>com.seagate.kinetic</groupId>
		<artifactId>kinetic-java</artifactId>
		<version>0.8.0.6-SNAPSHOT</version>
		<version>3.0.7-SNAPSHOT</version>
	</parent>
	<artifactId>kinetic-common</artifactId>
	<name>Kinetic/Common</name>
+12 −6
Original line number Diff line number Diff line
@@ -46,6 +46,9 @@ public class MessageDigestUtil {
    // CRC32 checksum instance
    private static KineticTagCalc crc32 = null;
    
    // CRC32C checksum instance
    private static KineticTagCalc crc32c = null;

    public static ByteString calculateTag(Algorithm algo, byte[] value) {

        ByteString tag = null;
@@ -69,6 +72,7 @@ public class MessageDigestUtil {
        case SHA1:
        case SHA2:
        case CRC32:
        case CRC32C:
            return true;
        default:
            return false;
@@ -155,20 +159,20 @@ public class MessageDigestUtil {
    public static KineticTagCalc getCrc32cInstance() {

        // check if constructed
        if (crc32 != null) {
            return crc32;
        if (crc32c != null) {
            return crc32c;
        }

        // sync
        synchronized (MessageDigestUtil.class) {

            // check if already constructed
            if (crc32 == null) {
                crc32 = new Crc32cTagCalc2();
            if (crc32c == null) {
                crc32c = new Crc32cTagCalc2();
            }
        }

        return crc32;
        return crc32c;
    }


@@ -180,6 +184,8 @@ public class MessageDigestUtil {
        case SHA2:
            return getSha2Instance();
        case CRC32:
            return getCrc32Instance();
        case CRC32C:
        	return getCrc32cInstance();
        default:
            throw new java.lang.UnsupportedOperationException(
+65 −75
Original line number Diff line number Diff line
/**
 * Copyright 2013-2015 Seagate Technology LLC.
 *
 * This Source Code Form is subject to the terms of the Mozilla
 * Public License, v. 2.0. If a copy of the MPL was not
 * distributed with this file, You can obtain one at
 * https://mozilla.org/MP:/2.0/.
 * 
 * This program is distributed in the hope that it will be useful,
 * but is provided AS-IS, WITHOUT ANY WARRANTY; including without 
 * the implied warranty of MERCHANTABILITY, NON-INFRINGEMENT or 
 * FITNESS FOR A PARTICULAR PURPOSE. See the Mozilla Public 
 * License for more details.
 *
 * See www.openkinetic.org for more project information
 */
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: kinetic.proto
package com.seagate.kinetic.proto;
@@ -25,17 +11,17 @@ public final class Kinetic {
  public interface LocalOrBuilder
      extends com.google.protobuf.MessageOrBuilder {
    // optional string protocolVersion = 1 [default = "3.0.6"];
    // optional string protocolVersion = 1 [default = "3.0.7"];
    /**
     * <code>optional string protocolVersion = 1 [default = "3.0.6"];</code>
     * <code>optional string protocolVersion = 1 [default = "3.0.7"];</code>
     */
    boolean hasProtocolVersion();
    /**
     * <code>optional string protocolVersion = 1 [default = "3.0.6"];</code>
     * <code>optional string protocolVersion = 1 [default = "3.0.7"];</code>
     */
    java.lang.String getProtocolVersion();
    /**
     * <code>optional string protocolVersion = 1 [default = "3.0.6"];</code>
     * <code>optional string protocolVersion = 1 [default = "3.0.7"];</code>
     */
    com.google.protobuf.ByteString
        getProtocolVersionBytes();
@@ -142,17 +128,17 @@ public final class Kinetic {
    }
    private int bitField0_;
    // optional string protocolVersion = 1 [default = "3.0.6"];
    // optional string protocolVersion = 1 [default = "3.0.7"];
    public static final int PROTOCOLVERSION_FIELD_NUMBER = 1;
    private java.lang.Object protocolVersion_;
    /**
     * <code>optional string protocolVersion = 1 [default = "3.0.6"];</code>
     * <code>optional string protocolVersion = 1 [default = "3.0.7"];</code>
     */
    public boolean hasProtocolVersion() {
      return ((bitField0_ & 0x00000001) == 0x00000001);
    }
    /**
     * <code>optional string protocolVersion = 1 [default = "3.0.6"];</code>
     * <code>optional string protocolVersion = 1 [default = "3.0.7"];</code>
     */
    public java.lang.String getProtocolVersion() {
      java.lang.Object ref = protocolVersion_;
@@ -169,7 +155,7 @@ public final class Kinetic {
      }
    }
    /**
     * <code>optional string protocolVersion = 1 [default = "3.0.6"];</code>
     * <code>optional string protocolVersion = 1 [default = "3.0.7"];</code>
     */
    public com.google.protobuf.ByteString
        getProtocolVersionBytes() {
@@ -186,7 +172,7 @@ public final class Kinetic {
    }
    private void initFields() {
      protocolVersion_ = "3.0.6";
      protocolVersion_ = "3.0.7";
    }
    private byte memoizedIsInitialized = -1;
    public final boolean isInitialized() {
@@ -338,7 +324,7 @@ public final class Kinetic {
      public Builder clear() {
        super.clear();
        protocolVersion_ = "3.0.6";
        protocolVersion_ = "3.0.7";
        bitField0_ = (bitField0_ & ~0x00000001);
        return this;
      }
@@ -420,16 +406,16 @@ public final class Kinetic {
      }
      private int bitField0_;
      // optional string protocolVersion = 1 [default = "3.0.6"];
      private java.lang.Object protocolVersion_ = "3.0.6";
      // optional string protocolVersion = 1 [default = "3.0.7"];
      private java.lang.Object protocolVersion_ = "3.0.7";
      /**
       * <code>optional string protocolVersion = 1 [default = "3.0.6"];</code>
       * <code>optional string protocolVersion = 1 [default = "3.0.7"];</code>
       */
      public boolean hasProtocolVersion() {
        return ((bitField0_ & 0x00000001) == 0x00000001);
      }
      /**
       * <code>optional string protocolVersion = 1 [default = "3.0.6"];</code>
       * <code>optional string protocolVersion = 1 [default = "3.0.7"];</code>
       */
      public java.lang.String getProtocolVersion() {
        java.lang.Object ref = protocolVersion_;
@@ -443,7 +429,7 @@ public final class Kinetic {
        }
      }
      /**
       * <code>optional string protocolVersion = 1 [default = "3.0.6"];</code>
       * <code>optional string protocolVersion = 1 [default = "3.0.7"];</code>
       */
      public com.google.protobuf.ByteString
          getProtocolVersionBytes() {
@@ -459,7 +445,7 @@ public final class Kinetic {
        }
      }
      /**
       * <code>optional string protocolVersion = 1 [default = "3.0.6"];</code>
       * <code>optional string protocolVersion = 1 [default = "3.0.7"];</code>
       */
      public Builder setProtocolVersion(
          java.lang.String value) {
@@ -472,7 +458,7 @@ public final class Kinetic {
        return this;
      }
      /**
       * <code>optional string protocolVersion = 1 [default = "3.0.6"];</code>
       * <code>optional string protocolVersion = 1 [default = "3.0.7"];</code>
       */
      public Builder clearProtocolVersion() {
        bitField0_ = (bitField0_ & ~0x00000001);
@@ -481,7 +467,7 @@ public final class Kinetic {
        return this;
      }
      /**
       * <code>optional string protocolVersion = 1 [default = "3.0.6"];</code>
       * <code>optional string protocolVersion = 1 [default = "3.0.7"];</code>
       */
      public Builder setProtocolVersionBytes(
          com.google.protobuf.ByteString value) {
@@ -3179,21 +3165,22 @@ public final class Kinetic {
       */
      SHA3(3, 3),
      /**
       * <code>CRC32 = 4;</code>
       *
       * <pre>
       * the CRC32 is the standard Ethernet CRC32. See IEEE
       * </pre>
       * <code>CRC32C = 4;</code>
       */
      CRC32(4, 4),
      CRC32C(4, 4),
      /**
       * <code>CRC64 = 5;</code>
       */
      CRC64(5, 5),
      /**
       * <code>CRC32 = 6;</code>
       *
       * <pre>
       * The CRC is ...
       * 7-99 are reserved.
       * 100-inf are private algorithms.
       * </pre>
       */
      CRC64(5, 5),
      CRC32(6, 6),
      ;
      /**
@@ -3229,21 +3216,22 @@ public final class Kinetic {
       */
      public static final int SHA3_VALUE = 3;
      /**
       * <code>CRC32 = 4;</code>
       *
       * <pre>
       * the CRC32 is the standard Ethernet CRC32. See IEEE
       * </pre>
       * <code>CRC32C = 4;</code>
       */
      public static final int CRC32_VALUE = 4;
      public static final int CRC32C_VALUE = 4;
      /**
       * <code>CRC64 = 5;</code>
       */
      public static final int CRC64_VALUE = 5;
      /**
       * <code>CRC32 = 6;</code>
       *
       * <pre>
       * The CRC is ...
       * 7-99 are reserved.
       * 100-inf are private algorithms.
       * </pre>
       */
      public static final int CRC64_VALUE = 5;
      public static final int CRC32_VALUE = 6;
      public final int getNumber() { return value; }
@@ -3254,8 +3242,9 @@ public final class Kinetic {
          case 1: return SHA1;
          case 2: return SHA2;
          case 3: return SHA3;
          case 4: return CRC32;
          case 4: return CRC32C;
          case 5: return CRC64;
          case 6: return CRC32;
          default: return null;
        }
      }
@@ -31755,7 +31744,7 @@ public final class Kinetic {
    java.lang.String[] descriptorData = {
      "\n\rkinetic.proto\022\031com.seagate.kinetic.pro" +
      "to\"\'\n\005Local\022\036\n\017protocolVersion\030\001 \001(\t:\0053." +
      "0.6\"\374\002\n\007Message\022=\n\010authType\030\004 \001(\0162+.com." +
      "0.7\"\374\002\n\007Message\022=\n\010authType\030\004 \001(\0162+.com." +
      "seagate.kinetic.proto.Message.AuthType\022=" +
      "\n\010hmacAuth\030\005 \001(\0132+.com.seagate.kinetic.p" +
      "roto.Message.HMACauth\022;\n\007pinAuth\030\006 \001(\0132*" +
@@ -31764,7 +31753,7 @@ public final class Kinetic {
      "identity\030\001 \001(\003\022\014\n\004hmac\030\002 \001(\014\032\026\n\007PINauth\022" +
      "\013\n\003pin\030\001 \001(\014\"\\\n\010AuthType\022\036\n\021INVALID_AUTH",
      "_TYPE\020\377\377\377\377\377\377\377\377\377\001\022\014\n\010HMACAUTH\020\001\022\013\n\007PINAUT" +
      "H\020\002\022\025\n\021UNSOLICITEDSTATUS\020\003\"\3632\n\007Command\0229" +
      "H\020\002\022\025\n\021UNSOLICITEDSTATUS\020\003\"\3772\n\007Command\0229" +
      "\n\006header\030\001 \001(\0132).com.seagate.kinetic.pro" +
      "to.Command.Header\0225\n\004body\030\002 \001(\0132\'.com.se" +
      "agate.kinetic.proto.Command.Body\0229\n\006stat" +
@@ -31906,28 +31895,29 @@ public final class Kinetic {
      "\377\377\377\377\377\377\001\022\020\n\014WRITETHROUGH\020\001\022\r\n\tWRITEBACK\020\002" +
      "\022\t\n\005FLUSH\020\003\"F\n\010Priority\022\n\n\006NORMAL\020\005\022\n\n\006L" +
      "OWEST\020\001\022\t\n\005LOWER\020\003\022\n\n\006HIGHER\020\007\022\013\n\007HIGHES" +
      "T\020\t\"_\n\tAlgorithm\022\036\n\021INVALID_ALGORITHM\020\377\377" +
      "\377\377\377\377\377\377\377\001\022\010\n\004SHA1\020\001\022\010\n\004SHA2\020\002\022\010\n\004SHA3\020\003\022\t" +
      "\n\005CRC32\020\004\022\t\n\005CRC64\020\005\"\371\005\n\013MessageType\022!\n\024" +
      "INVALID_MESSAGE_TYPE\020\377\377\377\377\377\377\377\377\377\001\022\007\n\003GET\020\002" +
      "\022\020\n\014GET_RESPONSE\020\001\022\007\n\003PUT\020\004\022\020\n\014PUT_RESPO" +
      "NSE\020\003\022\n\n\006DELETE\020\006\022\023\n\017DELETE_RESPONSE\020\005\022\013" +
      "\n\007GETNEXT\020\010\022\024\n\020GETNEXT_RESPONSE\020\007\022\017\n\013GET",
      "PREVIOUS\020\n\022\030\n\024GETPREVIOUS_RESPONSE\020\t\022\017\n\013" +
      "GETKEYRANGE\020\014\022\030\n\024GETKEYRANGE_RESPONSE\020\013\022" +
      "\016\n\nGETVERSION\020\020\022\027\n\023GETVERSION_RESPONSE\020\017" +
      "\022\t\n\005SETUP\020\026\022\022\n\016SETUP_RESPONSE\020\025\022\n\n\006GETLO" +
      "G\020\030\022\023\n\017GETLOG_RESPONSE\020\027\022\014\n\010SECURITY\020\032\022\025" +
      "\n\021SECURITY_RESPONSE\020\031\022\021\n\rPEER2PEERPUSH\020\034" +
      "\022\032\n\026PEER2PEERPUSH_RESPONSE\020\033\022\010\n\004NOOP\020\036\022\021" +
      "\n\rNOOP_RESPONSE\020\035\022\020\n\014FLUSHALLDATA\020 \022\031\n\025F" +
      "LUSHALLDATA_RESPONSE\020\037\022\t\n\005PINOP\020$\022\022\n\016PIN" +
      "OP_RESPONSE\020#\022\r\n\tMEDIASCAN\020&\022\026\n\022MEDIASCA",
      "N_RESPONSE\020%\022\021\n\rMEDIAOPTIMIZE\020(\022\032\n\026MEDIA" +
      "OPTIMIZE_RESPONSE\020\'\022\017\n\013START_BATCH\020*\022\030\n\024" +
      "START_BATCH_RESPONSE\020)\022\r\n\tEND_BATCH\020,\022\026\n" +
      "\022END_BATCH_RESPONSE\020+\022\017\n\013ABORT_BATCH\020.\022\030" +
      "\n\024ABORT_BATCH_RESPONSE\020-B\tB\007Kinetic"
      "T\020\t\"k\n\tAlgorithm\022\036\n\021INVALID_ALGORITHM\020\377\377" +
      "\377\377\377\377\377\377\377\001\022\010\n\004SHA1\020\001\022\010\n\004SHA2\020\002\022\010\n\004SHA3\020\003\022\n" +
      "\n\006CRC32C\020\004\022\t\n\005CRC64\020\005\022\t\n\005CRC32\020\006\"\371\005\n\013Mes" +
      "sageType\022!\n\024INVALID_MESSAGE_TYPE\020\377\377\377\377\377\377\377" +
      "\377\377\001\022\007\n\003GET\020\002\022\020\n\014GET_RESPONSE\020\001\022\007\n\003PUT\020\004\022" +
      "\020\n\014PUT_RESPONSE\020\003\022\n\n\006DELETE\020\006\022\023\n\017DELETE_" +
      "RESPONSE\020\005\022\013\n\007GETNEXT\020\010\022\024\n\020GETNEXT_RESPO",
      "NSE\020\007\022\017\n\013GETPREVIOUS\020\n\022\030\n\024GETPREVIOUS_RE" +
      "SPONSE\020\t\022\017\n\013GETKEYRANGE\020\014\022\030\n\024GETKEYRANGE" +
      "_RESPONSE\020\013\022\016\n\nGETVERSION\020\020\022\027\n\023GETVERSIO" +
      "N_RESPONSE\020\017\022\t\n\005SETUP\020\026\022\022\n\016SETUP_RESPONS" +
      "E\020\025\022\n\n\006GETLOG\020\030\022\023\n\017GETLOG_RESPONSE\020\027\022\014\n\010" +
      "SECURITY\020\032\022\025\n\021SECURITY_RESPONSE\020\031\022\021\n\rPEE" +
      "R2PEERPUSH\020\034\022\032\n\026PEER2PEERPUSH_RESPONSE\020\033" +
      "\022\010\n\004NOOP\020\036\022\021\n\rNOOP_RESPONSE\020\035\022\020\n\014FLUSHAL" +
      "LDATA\020 \022\031\n\025FLUSHALLDATA_RESPONSE\020\037\022\t\n\005PI" +
      "NOP\020$\022\022\n\016PINOP_RESPONSE\020#\022\r\n\tMEDIASCAN\020&",
      "\022\026\n\022MEDIASCAN_RESPONSE\020%\022\021\n\rMEDIAOPTIMIZ" +
      "E\020(\022\032\n\026MEDIAOPTIMIZE_RESPONSE\020\'\022\017\n\013START" +
      "_BATCH\020*\022\030\n\024START_BATCH_RESPONSE\020)\022\r\n\tEN" +
      "D_BATCH\020,\022\026\n\022END_BATCH_RESPONSE\020+\022\017\n\013ABO" +
      "RT_BATCH\020.\022\030\n\024ABORT_BATCH_RESPONSE\020-B\tB\007" +
      "Kinetic"
    };
    com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
      new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
Loading