-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #85 from coderplay/minzhou
- Loading branch information
Showing
34 changed files
with
1,225 additions
and
1,154 deletions.
There are no files selected for viewing
This file contains 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 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 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 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
92 changes: 92 additions & 0 deletions
92
hadoop-dragon-core/src/main/java/org/apache/hadoop/realtime/child/Context.java
This file contains 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,92 @@ | ||
/** | ||
* 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.realtime.child; | ||
|
||
import java.io.IOException; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
import org.apache.hadoop.classification.InterfaceAudience; | ||
import org.apache.hadoop.classification.InterfaceStability; | ||
import org.apache.hadoop.realtime.conf.DragonConfiguration; | ||
import org.apache.hadoop.realtime.event.Event; | ||
import org.apache.hadoop.realtime.mr.Mapper; | ||
import org.apache.hadoop.realtime.mr.Reducer; | ||
import org.apache.hadoop.realtime.records.TaskAttemptId; | ||
import org.apache.hadoop.realtime.records.TaskType; | ||
|
||
/** | ||
* A context object that allows input and output from the task. It is only | ||
* supplied to the {@link Mapper} or {@link Reducer}. | ||
* @param <KEYIN> the input key type for the task | ||
* @param <VALUEIN> the input value type for the task | ||
* @param <KEYOUT> the output key type for the task | ||
* @param <VALUEOUT> the output value type for the task | ||
*/ | ||
@InterfaceAudience.Public | ||
@InterfaceStability.Evolving | ||
public interface Context<KEYIN,VALUEIN,KEYOUT,VALUEOUT> { | ||
|
||
DragonConfiguration getConfiguration(); | ||
|
||
TaskAttemptId getTaskAttemptId(); | ||
|
||
/** | ||
* return the partition number of this task | ||
* @return | ||
*/ | ||
int getPartition(); | ||
|
||
String getUser(); | ||
|
||
|
||
TaskType getTaskType(); | ||
|
||
/** | ||
* take a event from the queue. | ||
* | ||
* @return the current key object or null if there isn't one | ||
* @throws IOException | ||
* @throws InterruptedException | ||
*/ | ||
public Event<KEYIN, VALUEIN> pollEvent() throws IOException, | ||
InterruptedException; | ||
|
||
/** | ||
* take a event from event producer | ||
* | ||
* @return the current key object or null if there isn't one | ||
* @throws IOException | ||
* @throws InterruptedException | ||
*/ | ||
public Event<KEYIN, VALUEIN> pollEvent(long timeout, TimeUnit unit) | ||
throws IOException, InterruptedException; | ||
|
||
/** | ||
* Generate an output event | ||
*/ | ||
public boolean emitEvent(Event<KEYOUT, VALUEOUT> event) throws IOException, | ||
InterruptedException; | ||
|
||
/** | ||
* Generate an output event | ||
*/ | ||
public boolean emitEvent(Event<KEYOUT, VALUEOUT> event, long timeout, | ||
TimeUnit unit) throws IOException, InterruptedException; | ||
|
||
} |
Oops, something went wrong.