Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
GiraphReader |
|
| 1.0;1 |
1 | /* | |
2 | * Licensed to the Apache Software Foundation (ASF) under one | |
3 | * or more contributor license agreements. See the NOTICE file | |
4 | * distributed with this work for additional information | |
5 | * regarding copyright ownership. The ASF licenses this file | |
6 | * to you under the Apache License, Version 2.0 (the | |
7 | * "License"); you may not use this file except in compliance | |
8 | * with the License. You may obtain a copy of the License at | |
9 | * | |
10 | * http://www.apache.org/licenses/LICENSE-2.0 | |
11 | * | |
12 | * Unless required by applicable law or agreed to in writing, software | |
13 | * distributed under the License is distributed on an "AS IS" BASIS, | |
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
15 | * See the License for the specific language governing permissions and | |
16 | * limitations under the License. | |
17 | */ | |
18 | ||
19 | package org.apache.giraph.io.iterables; | |
20 | ||
21 | import org.apache.hadoop.mapreduce.InputSplit; | |
22 | import org.apache.hadoop.mapreduce.TaskAttemptContext; | |
23 | ||
24 | import java.io.IOException; | |
25 | import java.util.Iterator; | |
26 | ||
27 | /** | |
28 | * Reader for some kind of data. | |
29 | * | |
30 | * @param <T> Type of data which we are reading (can be vertex, edges, etc) | |
31 | */ | |
32 | public interface GiraphReader<T> extends Iterator<T> { | |
33 | /** | |
34 | * Use the input split and context to setup reading. | |
35 | * Guaranteed to be called prior to any other function. | |
36 | * | |
37 | * @param inputSplit Input split to be used for reading. | |
38 | * @param context Context from the task. | |
39 | */ | |
40 | void initialize(InputSplit inputSplit, TaskAttemptContext context) throws | |
41 | IOException, InterruptedException; | |
42 | ||
43 | /** | |
44 | * Close this {@link GiraphReader} to future operations. | |
45 | * | |
46 | * @throws IOException | |
47 | */ | |
48 | void close() throws IOException; | |
49 | ||
50 | /** | |
51 | * How much of the input has the {@link GiraphReader} consumed i.e. | |
52 | * has been processed by? | |
53 | * | |
54 | * @return Progress from <code>0.0</code> to <code>1.0</code>. | |
55 | * @throws IOException | |
56 | * @throws InterruptedException | |
57 | */ | |
58 | float getProgress() throws IOException, InterruptedException; | |
59 | } |