-
Notifications
You must be signed in to change notification settings - Fork 9.1k
HADOOP-13327. Specify Output Stream and Syncable #2102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
steveloughran
wants to merge
8
commits into
apache:trunk
from
steveloughran:filesystem/HADOOP-13327-outputstream-spec-lean
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
486b78a
HADOOP-13327 Output Stream Specification.
steveloughran 7452ea1
HADOOP-13327 review usages of "must" in lower case
steveloughran f89118d
HADOOP-13327 review of more of Sean Busbey's comments
steveloughran af42347
HADOOP-13327 output stream spec.
steveloughran 0271da2
HADOOP-13327 add RawLocalFileystem Syncable
steveloughran 16a8b25
HADOOP-13327 Josh's comments
steveloughran 2bf9ab4
HADOOP-13327. Stream capabilities
steveloughran e7a1212
HADOOP-13327 review feedback and a bit of rereading myself
steveloughran File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
...oject/hadoop-common/src/main/java/org/apache/hadoop/fs/impl/StoreImplementationUtils.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| /* | ||
| * 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.impl; | ||
|
|
||
| import java.io.InputStream; | ||
| import java.io.OutputStream; | ||
|
|
||
| import org.apache.hadoop.classification.InterfaceAudience; | ||
| import org.apache.hadoop.classification.InterfaceStability; | ||
| import org.apache.hadoop.fs.StreamCapabilities; | ||
|
|
||
| import static org.apache.hadoop.fs.StreamCapabilities.HFLUSH; | ||
| import static org.apache.hadoop.fs.StreamCapabilities.HSYNC; | ||
|
|
||
| /** | ||
| * Utility classes to help implementing filesystems and streams. | ||
| */ | ||
| @InterfaceAudience.Private | ||
| @InterfaceStability.Unstable | ||
| public final class StoreImplementationUtils { | ||
|
|
||
| private StoreImplementationUtils() { | ||
| } | ||
|
|
||
| /** | ||
| * Check the probe capability being for {@link StreamCapabilities#HSYNC} | ||
| * or {@link StreamCapabilities#HFLUSH} | ||
| * {@code Syncable.hsync()} and {@code Syncable.hflush()} functionality. | ||
| * @param capability capability string. | ||
| * @return true if either refers to one of the Syncable operations. | ||
| */ | ||
| public static boolean isProbeForSyncable(String capability) { | ||
| return capability.equalsIgnoreCase(HSYNC) || | ||
| capability.equalsIgnoreCase(HFLUSH); | ||
| } | ||
|
|
||
| /** | ||
| * Probe for an object having a capability; returns true | ||
| * if the stream implements {@link StreamCapabilities} and its | ||
| * {@code hasCapabilities()} method returns true for the capability. | ||
| * This is a package private method intended to provided a common | ||
| * implementation for input and output streams. | ||
| * {@link StreamCapabilities#hasCapability(String)} call is for public use. | ||
| * @param object object to probe. | ||
| * @param capability capability to probe for | ||
| * @return true if the object implements stream capabilities and | ||
| * declares that it supports the capability. | ||
| */ | ||
| static boolean objectHasCapability(Object object, String capability) { | ||
| if (object instanceof StreamCapabilities) { | ||
| return ((StreamCapabilities) object).hasCapability(capability); | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| /** | ||
| * Probe for an output stream having a capability; returns true | ||
| * if the stream implements {@link StreamCapabilities} and its | ||
| * {@code hasCapabilities()} method returns true for the capability. | ||
| * @param out output stream | ||
| * @param capability capability to probe for | ||
| * @return true if the stream declares that it supports the capability. | ||
| */ | ||
| public static boolean hasCapability(OutputStream out, String capability) { | ||
| return objectHasCapability(out, capability); | ||
| } | ||
|
|
||
| /** | ||
| * Probe for an input stream having a capability; returns true | ||
| * if the stream implements {@link StreamCapabilities} and its | ||
| * {@code hasCapabilities()} method returns true for the capability. | ||
| * @param out output stream | ||
| * @param capability capability to probe for | ||
| * @return true if the stream declares that it supports the capability. | ||
| */ | ||
| public static boolean hasCapability(InputStream out, String capability) { | ||
| return objectHasCapability(out, capability); | ||
| } | ||
|
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.