-
Notifications
You must be signed in to change notification settings - Fork 9.2k
HADOOP-16965 Refactor abfs stream configuration. #1956
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| /** | ||
| * 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.azurebfs.services; | ||
|
|
||
| /** | ||
| * Class to hold extra input stream configs. | ||
| */ | ||
| public class AbfsInputStreamContext extends AbfsStreamContext { | ||
|
|
||
| private int readBufferSize; | ||
|
|
||
| private int readAheadQueueDepth; | ||
|
|
||
| private boolean tolerateOobAppends; | ||
|
|
||
| public AbfsInputStreamContext() { | ||
| } | ||
|
|
||
| public AbfsInputStreamContext withReadBufferSize(final int readBufferSize) { | ||
| this.readBufferSize = readBufferSize; | ||
| return this; | ||
| } | ||
|
|
||
| public AbfsInputStreamContext withReadAheadQueueDepth( | ||
| final int readAheadQueueDepth) { | ||
| this.readAheadQueueDepth = (readAheadQueueDepth >= 0) | ||
| ? readAheadQueueDepth | ||
| : Runtime.getRuntime().availableProcessors();; | ||
mukund-thakur marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| return this; | ||
| } | ||
|
|
||
| public AbfsInputStreamContext withTolerateOobAppends( | ||
| final boolean tolerateOobAppends) { | ||
| this.tolerateOobAppends = tolerateOobAppends; | ||
| return this; | ||
| } | ||
|
|
||
| public AbfsInputStreamContext build() { | ||
| // Validation of parameters to be done here. | ||
| return this; | ||
| } | ||
|
|
||
| public int getReadBufferSize() { | ||
| return readBufferSize; | ||
| } | ||
|
|
||
| public int getReadAheadQueueDepth() { | ||
| return readAheadQueueDepth; | ||
| } | ||
|
|
||
| public boolean isTolerateOobAppends() { | ||
| return tolerateOobAppends; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| /** | ||
| * 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.azurebfs.services; | ||
|
|
||
| /** | ||
| * Class to hold extra output stream configs. | ||
| */ | ||
| public class AbfsOutputStreamContext extends AbfsStreamContext { | ||
|
|
||
| private int writeBufferSize; | ||
|
|
||
| private boolean enableFlush; | ||
|
|
||
| private boolean disableOutputStreamFlush; | ||
|
|
||
| public AbfsOutputStreamContext() { | ||
| } | ||
|
|
||
| public AbfsOutputStreamContext withWriteBufferSize( | ||
| final int writeBufferSize) { | ||
| this.writeBufferSize = writeBufferSize; | ||
| return this; | ||
| } | ||
|
|
||
| public AbfsOutputStreamContext enableFlush(final boolean enableFlush) { | ||
| this.enableFlush = enableFlush; | ||
| return this; | ||
| } | ||
|
|
||
| public AbfsOutputStreamContext disableOutputStreamFlush( | ||
| final boolean disableOutputStreamFlush) { | ||
| this.disableOutputStreamFlush = disableOutputStreamFlush; | ||
| return this; | ||
| } | ||
|
|
||
| public AbfsOutputStreamContext build() { | ||
| // Validation of parameters to be done here. | ||
| return this; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need any validators here yet, or is there enough in the code as it is?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now we don't have any validation yet but we can add the new ones here in future if required. |
||
| } | ||
|
|
||
| public int getWriteBufferSize() { | ||
| return writeBufferSize; | ||
| } | ||
|
|
||
| public boolean isEnableFlush() { | ||
| return enableFlush; | ||
| } | ||
|
|
||
| public boolean isDisableOutputStreamFlush() { | ||
| return disableOutputStreamFlush; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| /** | ||
| * 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.azurebfs.services; | ||
|
|
||
| /** | ||
| * Base stream configuration class which is going | ||
| * to store common configs among input and output streams. | ||
| */ | ||
| public abstract class AbfsStreamContext { | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.