You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2019/12/19 13:29:49 UTC

[GitHub] [hadoop-ozone] cxorm opened a new pull request #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities

cxorm opened a new pull request #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities
URL: https://github.com/apache/hadoop-ozone/pull/379
 
 
   ## What changes were proposed in this pull request?
   This PR was created to let client probe for ```read(ByteBuffer)``` ability, 
   and it made```OzoneFSInputStream``` support interface ```StreamCapabilities```.
   (Cause the interface ```StreamCapabilities``` doesn't has constant string ```READBYTEBUFFER``` for Hadoop 3.2.0, I use ```in:readbytebuffer``` and this case will be updated after the new version of Hadoop is applied.)
   
   ## What is the link to the Apache JIRA
   https://issues.apache.org/jira/browse/HDDS-2750
   
   ## How was this patch tested?
   UT is updated, and ran.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] cxorm commented on a change in pull request #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities

Posted by GitBox <gi...@apache.org>.
cxorm commented on a change in pull request #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities
URL: https://github.com/apache/hadoop-ozone/pull/379#discussion_r362801884
 
 

 ##########
 File path: hadoop-ozone/ozonefs/src/main/java/org/apache/hadoop/fs/ozone/OzoneStreamCapabilities.java
 ##########
 @@ -0,0 +1,69 @@
+/*
+ * 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.fs.ozone;
+
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
+import org.apache.hadoop.fs.StreamCapabilities;
+/**
+ * Interface to query streams for supported capabilities of Ozone.
+ *
+ * Capability strings must be in lower case.
+ *
+ * Constant strings are chosen over enums in order to allow other file systems
+ * to define their own capabilities.
+ */
+@InterfaceAudience.Public
+@InterfaceStability.Evolving
+public interface OzoneStreamCapabilities extends StreamCapabilities {
+
+
+  /**
+   * Stream read(ByteBuffer) capability implemented by
+   * {@link ByteBufferReadable#read(java.nio.ByteBuffer)}.
+   */
+  String READBYTEBUFFER = "in:readbytebuffer";
+
+
+  /**
+   * Capabilities that a stream can support and be queried for.
+   */
+  @Deprecated
+  enum StreamCapability {
+    READBYTEBUFFER(OzoneStreamCapabilities.READBYTEBUFFER);
+    private final String capability;
+
+    StreamCapability(String value) {
+      this.capability = value;
+    }
+
+    public final String getValue() {
+      return capability;
+    }
+  }
+
+  /**
+   * Query the stream for a specific capability.
+   *
+   * @param capability string to query the stream support for.
+   * @return True if the stream supports capability.
+   */
+  boolean hasCapability(String capability);
 
 Review comment:
   Thanks @adoroszlai for reviewing.
   
   I would violate the ```checkstyle``` with ```[ERROR] src/main/java/org/apache/hadoop/fs/ozone/OzoneStreamCapabilities.java:[30] (design) InterfaceIsType: interfaces should describe a type and hence have methods.```  when removing the method.
   
   I think the we could disable the ```InterfaceIsType``` by removing this [line](https://github.com/apache/hadoop-ozone/blob/master/hadoop-hdds/dev-support/checkstyle/checkstyle.xml#L180), but I don't know whether it is proper to do this.
   
   How do you think about this ?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] cxorm commented on issue #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities

Posted by GitBox <gi...@apache.org>.
cxorm commented on issue #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities
URL: https://github.com/apache/hadoop-ozone/pull/379#issuecomment-573015852
 
 
   Sorry for missing here for a while.
   Thanks @adoroszlai for the suggestion of implementation.
   I’m going to fix this issue soon.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] adoroszlai merged pull request #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities

Posted by GitBox <gi...@apache.org>.
adoroszlai merged pull request #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities
URL: https://github.com/apache/hadoop-ozone/pull/379
 
 
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] adoroszlai commented on a change in pull request #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities

Posted by GitBox <gi...@apache.org>.
adoroszlai commented on a change in pull request #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities
URL: https://github.com/apache/hadoop-ozone/pull/379#discussion_r362385430
 
 

 ##########
 File path: hadoop-ozone/ozonefs/src/main/java/org/apache/hadoop/fs/ozone/OzoneStreamCapabilities.java
 ##########
 @@ -0,0 +1,69 @@
+/*
+ * 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.fs.ozone;
+
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
+import org.apache.hadoop.fs.StreamCapabilities;
+/**
+ * Interface to query streams for supported capabilities of Ozone.
+ *
+ * Capability strings must be in lower case.
+ *
+ * Constant strings are chosen over enums in order to allow other file systems
+ * to define their own capabilities.
+ */
+@InterfaceAudience.Public
+@InterfaceStability.Evolving
+public interface OzoneStreamCapabilities extends StreamCapabilities {
+
+
+  /**
+   * Stream read(ByteBuffer) capability implemented by
+   * {@link ByteBufferReadable#read(java.nio.ByteBuffer)}.
 
 Review comment:
   This `@link` to `ByteBufferReadable` needs an import, since they are not in the same package.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] cxorm edited a comment on issue #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities

Posted by GitBox <gi...@apache.org>.
cxorm edited a comment on issue #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities
URL: https://github.com/apache/hadoop-ozone/pull/379#issuecomment-571118589
 
 
   > One question though: if `OzoneFSInputStream` does not implement `StreamCapabilities`, how will the new method `hasCapability` be used?
   
   Thanks @adoroszlai for the question.
   
   I think that we still should implement interface `StreamCapabilities` or `OzoneStreamCapabilities`, while both cause `NoClassDefFoundError` in CI.
   Sorry for last commit.
   I'm trying to fix it with implementing interface.
   
   How do you think about this solution ?  

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] cxorm commented on a change in pull request #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities

Posted by GitBox <gi...@apache.org>.
cxorm commented on a change in pull request #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities
URL: https://github.com/apache/hadoop-ozone/pull/379#discussion_r363131266
 
 

 ##########
 File path: hadoop-ozone/ozonefs/src/main/java/org/apache/hadoop/fs/ozone/OzoneStreamCapabilities.java
 ##########
 @@ -0,0 +1,69 @@
+/*
+ * 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.fs.ozone;
+
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
+import org.apache.hadoop.fs.StreamCapabilities;
+/**
+ * Interface to query streams for supported capabilities of Ozone.
+ *
+ * Capability strings must be in lower case.
+ *
+ * Constant strings are chosen over enums in order to allow other file systems
+ * to define their own capabilities.
+ */
+@InterfaceAudience.Public
+@InterfaceStability.Evolving
+public interface OzoneStreamCapabilities extends StreamCapabilities {
+
+
+  /**
+   * Stream read(ByteBuffer) capability implemented by
+   * {@link ByteBufferReadable#read(java.nio.ByteBuffer)}.
+   */
+  String READBYTEBUFFER = "in:readbytebuffer";
+
+
+  /**
+   * Capabilities that a stream can support and be queried for.
+   */
+  @Deprecated
+  enum StreamCapability {
+    READBYTEBUFFER(OzoneStreamCapabilities.READBYTEBUFFER);
+    private final String capability;
+
+    StreamCapability(String value) {
+      this.capability = value;
+    }
+
+    public final String getValue() {
+      return capability;
+    }
+  }
+
+  /**
+   * Query the stream for a specific capability.
+   *
+   * @param capability string to query the stream support for.
+   * @return True if the stream supports capability.
+   */
+  boolean hasCapability(String capability);
 
 Review comment:
   Thanks @adoroszlai for helping and reviewing it.
   I converted ```OzoneStreamCapabilities``` to utility class, and updated related string with it.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] adoroszlai commented on issue #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities

Posted by GitBox <gi...@apache.org>.
adoroszlai commented on issue #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities
URL: https://github.com/apache/hadoop-ozone/pull/379#issuecomment-574618906
 
 
   Thanks @cxorm for the contribution.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] adoroszlai commented on a change in pull request #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities

Posted by GitBox <gi...@apache.org>.
adoroszlai commented on a change in pull request #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities
URL: https://github.com/apache/hadoop-ozone/pull/379#discussion_r362386763
 
 

 ##########
 File path: hadoop-ozone/ozonefs/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFSInputStream.java
 ##########
 @@ -152,4 +154,12 @@ public void testO3FSByteBufferRead() throws IOException {
       Assert.assertArrayEquals(value, buffer.array());
     }
   }
+
+  @Test
+  public void testHasCapability() throws IOException {
+    try (OzoneFSInputStream inputStream =
+             new OzoneFSInputStream(fs.open(filePath))) {
 
 Review comment:
   There is a compile error in CI:
   
   ```
   2019-12-23T18:38:08.9765142Z [ERROR] /github/workspace/hadoop-ozone/ozonefs/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFSInputStream.java:[161,14] constructor OzoneFSInputStream in class org.apache.hadoop.fs.ozone.OzoneFSInputStream cannot be applied to given types;
   2019-12-23T18:38:08.9775744Z   required: java.io.InputStream,org.apache.hadoop.fs.FileSystem.Statistics
   2019-12-23T18:38:08.9804410Z   found: org.apache.hadoop.fs.FSDataInputStream
   2019-12-23T18:38:08.9816806Z   reason: actual and formal argument lists differ in length
   ```
   
   To fix it, please merge latest master (which introduced the new `Statistics` parameter in `OzoneFSInputStream` constructor) into the source branch.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] cxorm commented on issue #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities

Posted by GitBox <gi...@apache.org>.
cxorm commented on issue #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities
URL: https://github.com/apache/hadoop-ozone/pull/379#issuecomment-574972352
 
 
   Thanks @adoroszlai for the help and merge.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] cxorm commented on issue #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities

Posted by GitBox <gi...@apache.org>.
cxorm commented on issue #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities
URL: https://github.com/apache/hadoop-ozone/pull/379#issuecomment-574134373
 
 
   Thanks @adoroszlai for the help.
   Fixed and github CI passed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] cxorm commented on a change in pull request #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities

Posted by GitBox <gi...@apache.org>.
cxorm commented on a change in pull request #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities
URL: https://github.com/apache/hadoop-ozone/pull/379#discussion_r363131331
 
 

 ##########
 File path: hadoop-ozone/ozonefs/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFSInputStream.java
 ##########
 @@ -152,4 +154,12 @@ public void testO3FSByteBufferRead() throws IOException {
       Assert.assertArrayEquals(value, buffer.array());
     }
   }
+
+  @Test
+  public void testHasCapability() throws IOException {
+    try (OzoneFSInputStream inputStream =
+             new OzoneFSInputStream(fs.open(filePath))) {
 
 Review comment:
   Thanks @adoroszlai for this info.
   Rebase and fixed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] adoroszlai commented on issue #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities

Posted by GitBox <gi...@apache.org>.
adoroszlai commented on issue #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities
URL: https://github.com/apache/hadoop-ozone/pull/379#issuecomment-571143331
 
 
   @cxorm see 7d204553b31720ce72ae343d55695847a2940e21 for a possible implementation.  I have run all three `ozone-mr` acceptance tests with it successfully.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] adoroszlai commented on a change in pull request #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities

Posted by GitBox <gi...@apache.org>.
adoroszlai commented on a change in pull request #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities
URL: https://github.com/apache/hadoop-ozone/pull/379#discussion_r362385197
 
 

 ##########
 File path: hadoop-ozone/ozonefs/src/main/java/org/apache/hadoop/fs/ozone/OzoneStreamCapabilities.java
 ##########
 @@ -0,0 +1,69 @@
+/*
+ * 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.fs.ozone;
+
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
+import org.apache.hadoop.fs.StreamCapabilities;
+/**
+ * Interface to query streams for supported capabilities of Ozone.
+ *
+ * Capability strings must be in lower case.
+ *
+ * Constant strings are chosen over enums in order to allow other file systems
+ * to define their own capabilities.
+ */
+@InterfaceAudience.Public
+@InterfaceStability.Evolving
+public interface OzoneStreamCapabilities extends StreamCapabilities {
+
+
+  /**
+   * Stream read(ByteBuffer) capability implemented by
+   * {@link ByteBufferReadable#read(java.nio.ByteBuffer)}.
+   */
+  String READBYTEBUFFER = "in:readbytebuffer";
+
+
+  /**
+   * Capabilities that a stream can support and be queried for.
+   */
+  @Deprecated
+  enum StreamCapability {
+    READBYTEBUFFER(OzoneStreamCapabilities.READBYTEBUFFER);
+    private final String capability;
+
+    StreamCapability(String value) {
+      this.capability = value;
+    }
+
+    public final String getValue() {
+      return capability;
+    }
+  }
+
+  /**
+   * Query the stream for a specific capability.
+   *
+   * @param capability string to query the stream support for.
+   * @return True if the stream supports capability.
+   */
+  boolean hasCapability(String capability);
 
 Review comment:
   No need to duplicate the method from parent interface.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] adoroszlai commented on a change in pull request #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities

Posted by GitBox <gi...@apache.org>.
adoroszlai commented on a change in pull request #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities
URL: https://github.com/apache/hadoop-ozone/pull/379#discussion_r362386233
 
 

 ##########
 File path: hadoop-ozone/ozonefs/src/main/java/org/apache/hadoop/fs/ozone/OzoneStreamCapabilities.java
 ##########
 @@ -0,0 +1,69 @@
+/*
+ * 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.fs.ozone;
+
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
+import org.apache.hadoop.fs.StreamCapabilities;
+/**
+ * Interface to query streams for supported capabilities of Ozone.
+ *
+ * Capability strings must be in lower case.
+ *
+ * Constant strings are chosen over enums in order to allow other file systems
+ * to define their own capabilities.
+ */
+@InterfaceAudience.Public
+@InterfaceStability.Evolving
+public interface OzoneStreamCapabilities extends StreamCapabilities {
+
+
+  /**
+   * Stream read(ByteBuffer) capability implemented by
+   * {@link ByteBufferReadable#read(java.nio.ByteBuffer)}.
+   */
+  String READBYTEBUFFER = "in:readbytebuffer";
 
 Review comment:
   Please mention in the doc that this is from newer Hadoop, can be removed if dependency is upgraded.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] adoroszlai commented on a change in pull request #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities

Posted by GitBox <gi...@apache.org>.
adoroszlai commented on a change in pull request #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities
URL: https://github.com/apache/hadoop-ozone/pull/379#discussion_r362817986
 
 

 ##########
 File path: hadoop-ozone/ozonefs/src/main/java/org/apache/hadoop/fs/ozone/OzoneStreamCapabilities.java
 ##########
 @@ -0,0 +1,69 @@
+/*
+ * 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.fs.ozone;
+
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
+import org.apache.hadoop.fs.StreamCapabilities;
+/**
+ * Interface to query streams for supported capabilities of Ozone.
+ *
+ * Capability strings must be in lower case.
+ *
+ * Constant strings are chosen over enums in order to allow other file systems
+ * to define their own capabilities.
+ */
+@InterfaceAudience.Public
+@InterfaceStability.Evolving
+public interface OzoneStreamCapabilities extends StreamCapabilities {
+
+
+  /**
+   * Stream read(ByteBuffer) capability implemented by
+   * {@link ByteBufferReadable#read(java.nio.ByteBuffer)}.
+   */
+  String READBYTEBUFFER = "in:readbytebuffer";
+
+
+  /**
+   * Capabilities that a stream can support and be queried for.
+   */
+  @Deprecated
+  enum StreamCapability {
+    READBYTEBUFFER(OzoneStreamCapabilities.READBYTEBUFFER);
+    private final String capability;
+
+    StreamCapability(String value) {
+      this.capability = value;
+    }
+
+    public final String getValue() {
+      return capability;
+    }
+  }
+
+  /**
+   * Query the stream for a specific capability.
+   *
+   * @param capability string to query the stream support for.
+   * @return True if the stream supports capability.
+   */
+  boolean hasCapability(String capability);
 
 Review comment:
   Nice catch.  In that case I think it can be a class (only for holding the constant), referencing the Hadoop `StreamCapabilities` interface in javadoc.  Or we can drop the idea and define the constant directly in `OzoneFSInputStream` (in that case sorry about the dead-end suggestion).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] adoroszlai commented on a change in pull request #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities

Posted by GitBox <gi...@apache.org>.
adoroszlai commented on a change in pull request #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities
URL: https://github.com/apache/hadoop-ozone/pull/379#discussion_r362385806
 
 

 ##########
 File path: hadoop-ozone/ozonefs/src/main/java/org/apache/hadoop/fs/ozone/OzoneStreamCapabilities.java
 ##########
 @@ -0,0 +1,69 @@
+/*
+ * 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.fs.ozone;
+
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
+import org.apache.hadoop.fs.StreamCapabilities;
+/**
+ * Interface to query streams for supported capabilities of Ozone.
+ *
+ * Capability strings must be in lower case.
+ *
+ * Constant strings are chosen over enums in order to allow other file systems
+ * to define their own capabilities.
 
 Review comment:
   No need to duplicate complete doc from parent interface.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] cxorm commented on issue #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities

Posted by GitBox <gi...@apache.org>.
cxorm commented on issue #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities
URL: https://github.com/apache/hadoop-ozone/pull/379#issuecomment-571118589
 
 
   > One question though: if `OzoneFSInputStream` does not implement `StreamCapabilities`, how will the new method `hasCapability` be used?
   
   Thanks @adoroszlai for the question.
   
   I think that we still should implement interface `StreamCapabilities` or `OzoneStreamCapabilities`, while both cause `NoClassDefFoundError` in CI.
   I'm trying to fix it.
   
   How do you think about this solution ?  

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] adoroszlai commented on a change in pull request #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities

Posted by GitBox <gi...@apache.org>.
adoroszlai commented on a change in pull request #379: HDDS-2750. OzoneFSInputStream to support StreamCapabilities
URL: https://github.com/apache/hadoop-ozone/pull/379#discussion_r362385111
 
 

 ##########
 File path: hadoop-ozone/ozonefs/src/main/java/org/apache/hadoop/fs/ozone/OzoneStreamCapabilities.java
 ##########
 @@ -0,0 +1,69 @@
+/*
+ * 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.fs.ozone;
+
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
+import org.apache.hadoop.fs.StreamCapabilities;
+/**
+ * Interface to query streams for supported capabilities of Ozone.
+ *
+ * Capability strings must be in lower case.
+ *
+ * Constant strings are chosen over enums in order to allow other file systems
+ * to define their own capabilities.
+ */
+@InterfaceAudience.Public
+@InterfaceStability.Evolving
+public interface OzoneStreamCapabilities extends StreamCapabilities {
+
+
+  /**
+   * Stream read(ByteBuffer) capability implemented by
+   * {@link ByteBufferReadable#read(java.nio.ByteBuffer)}.
+   */
+  String READBYTEBUFFER = "in:readbytebuffer";
+
+
+  /**
+   * Capabilities that a stream can support and be queried for.
+   */
+  @Deprecated
+  enum StreamCapability {
+    READBYTEBUFFER(OzoneStreamCapabilities.READBYTEBUFFER);
+    private final String capability;
+
+    StreamCapability(String value) {
+      this.capability = value;
+    }
+
+    public final String getValue() {
+      return capability;
+    }
+  }
 
 Review comment:
   No need to add this deprecated enum.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org