You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2021/09/03 13:51:54 UTC

[GitHub] [accumulo] DomGarguilo commented on a change in pull request #2224: Versioned Properties - refactored to address PR comments

DomGarguilo commented on a change in pull request #2224:
URL: https://github.com/apache/accumulo/pull/2224#discussion_r701908453



##########
File path: server/base/src/main/java/org/apache/accumulo/server/conf/codec/EncodingOptions.java
##########
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.server.conf.codec;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.util.StringJoiner;
+
+/**
+ * Serialization metadata to allow for evolution of the encoding used for property storage. This
+ * info is expected to be stored first in the serialization and uncompressed so that the handling of
+ * subsequent fields and data can be processed correctly and without additional processing.
+ * <p>
+ * Instances of this class are immutable.
+ */
+public class EncodingOptions {
+
+  // Adding an encoding version must be done as an addition. Do not change or delete previous
+  // version numbers
+  public static final int EncodingVersion_1_0 = 1;
+  public static final int EXPERIMENTAL_CIPHER_ENCODING_1_0 = 999;
+
+  private final int encodingVersion;
+  private final boolean compress;
+
+  EncodingOptions(final int encodingVersion, final boolean compress) {
+    this.encodingVersion = encodingVersion;
+    this.compress = compress;
+  }
+
+  /**
+   * Instantiate encoding options to use version 1.0 encoding settings.
+   *
+   * @param compress
+   *          when true compress the property map.
+   * @return the encoding options.
+   */
+  public static EncodingOptions V1_0(final boolean compress) {
+    return new EncodingOptions(EncodingVersion_1_0, compress);
+  }
+
+  /**
+   * Instantiate an instance of EncodingOptions reading the values from an input stream. Typically,
+   * the stream will be obtained from reading a byte array from a data store and then creating a
+   * stream the reads from that array,

Review comment:
       ```suggestion
      * stream that reads from that array,
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org