You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by zh...@apache.org on 2016/06/23 22:53:00 UTC
hadoop git commit: HADOOP-13019. Implement ErasureCodec for
HitchHiker XOR coding. Contributed by Kai Sasaki.
Repository: hadoop
Updated Branches:
refs/heads/trunk dca298d79 -> 0b9edf6e0
HADOOP-13019. Implement ErasureCodec for HitchHiker XOR coding. Contributed by Kai Sasaki.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/0b9edf6e
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/0b9edf6e
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/0b9edf6e
Branch: refs/heads/trunk
Commit: 0b9edf6e0f19e9d94f57f6dca41812ce8c1cc81f
Parents: dca298d
Author: Zhe Zhang <zh...@apache.org>
Authored: Thu Jun 23 15:52:51 2016 -0700
Committer: Zhe Zhang <zh...@apache.org>
Committed: Thu Jun 23 15:52:51 2016 -0700
----------------------------------------------------------------------
.../io/erasurecode/codec/HHXORErasureCodec.java | 45 ++++++++++++++++++++
.../codec/TestHHXORErasureCodec.java | 40 +++++++++++++++++
2 files changed, 85 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/0b9edf6e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/codec/HHXORErasureCodec.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/codec/HHXORErasureCodec.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/codec/HHXORErasureCodec.java
new file mode 100644
index 0000000..3c8061d
--- /dev/null
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/codec/HHXORErasureCodec.java
@@ -0,0 +1,45 @@
+/**
+ * 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.hadoop.io.erasurecode.codec;
+
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.io.erasurecode.ECSchema;
+import org.apache.hadoop.io.erasurecode.coder.ErasureCoder;
+import org.apache.hadoop.io.erasurecode.coder.HHXORErasureDecoder;
+import org.apache.hadoop.io.erasurecode.coder.HHXORErasureEncoder;
+
+/**
+ * A Hitchhiker-XOR erasure codec.
+ */
+@InterfaceAudience.Private
+public class HHXORErasureCodec extends AbstractErasureCodec {
+
+ public HHXORErasureCodec(ECSchema schema) {
+ super(schema);
+ }
+
+ @Override
+ public ErasureCoder createEncoder() {
+ return new HHXORErasureEncoder(getSchema());
+ }
+
+ @Override
+ public ErasureCoder createDecoder() {
+ return new HHXORErasureDecoder(getSchema());
+ }
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/0b9edf6e/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/erasurecode/codec/TestHHXORErasureCodec.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/erasurecode/codec/TestHHXORErasureCodec.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/erasurecode/codec/TestHHXORErasureCodec.java
new file mode 100644
index 0000000..c980b87
--- /dev/null
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/erasurecode/codec/TestHHXORErasureCodec.java
@@ -0,0 +1,40 @@
+/**
+ * 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.hadoop.io.erasurecode.codec;
+
+import org.apache.hadoop.io.erasurecode.ECSchema;
+import org.apache.hadoop.io.erasurecode.coder.ErasureCoder;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class TestHHXORErasureCodec {
+ private ECSchema schema = new ECSchema("hhxor", 10, 4);
+
+ @Test
+ public void testGoodCodec() {
+ HHXORErasureCodec codec = new HHXORErasureCodec(schema);
+ ErasureCoder encoder = codec.createEncoder();
+ assertEquals(10, encoder.getNumDataUnits());
+ assertEquals(4, encoder.getNumParityUnits());
+
+ ErasureCoder decoder = codec.createDecoder();
+ assertEquals(10, decoder.getNumDataUnits());
+ assertEquals(4, decoder.getNumParityUnits());
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org