Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
EdgeWriter |
|
| 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; | |
20 | ||
21 | import java.io.IOException; | |
22 | ||
23 | import org.apache.giraph.conf.DefaultImmutableClassesGiraphConfigurable; | |
24 | import org.apache.giraph.edge.Edge; | |
25 | import org.apache.hadoop.io.Writable; | |
26 | import org.apache.hadoop.io.WritableComparable; | |
27 | import org.apache.hadoop.mapreduce.TaskAttemptContext; | |
28 | ||
29 | /** | |
30 | * | |
31 | * @param <I> Vertex id | |
32 | * @param <V> Vertex value | |
33 | * @param <E> Edge value | |
34 | */ | |
35 | @SuppressWarnings("rawtypes") | |
36 | 0 | public abstract class EdgeWriter< |
37 | I extends WritableComparable, V extends Writable, | |
38 | E extends Writable> extends | |
39 | DefaultImmutableClassesGiraphConfigurable<I, V, E> { | |
40 | ||
41 | /** | |
42 | * Writes the next vertex and associated data | |
43 | * | |
44 | * @param sourceId the vertex ID from which the edge originates | |
45 | * @param sourceValue the vertex value; the vertex is the one from which | |
46 | * the edge originates | |
47 | * @param edge edge to be written | |
48 | * @throws IOException | |
49 | * @throws InterruptedException | |
50 | */ | |
51 | public abstract void writeEdge(I sourceId, V sourceValue, Edge<I, E> edge) | |
52 | throws IOException, InterruptedException; | |
53 | ||
54 | /** | |
55 | * Use the context to setup writing the edges. | |
56 | * Guaranteed to be called prior to any other function. | |
57 | * | |
58 | * @param context Context used to write the vertices. | |
59 | * @throws IOException | |
60 | * @throws InterruptedException | |
61 | */ | |
62 | public abstract void initialize(TaskAttemptContext context) | |
63 | throws IOException, InterruptedException; | |
64 | ||
65 | /** | |
66 | * Close this {@link EdgeWriter} to future operations. | |
67 | * | |
68 | * @param context the context of the task | |
69 | * @throws IOException | |
70 | * @throws InterruptedException | |
71 | */ | |
72 | public abstract void close(TaskAttemptContext context) | |
73 | throws IOException, InterruptedException; | |
74 | } |