This project has retired. For details please refer to its
Attic page.
MappingReaderWrapper xref
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.giraph.io.iterables;
20
21 import org.apache.giraph.conf.ImmutableClassesGiraphConfiguration;
22 import org.apache.giraph.io.MappingReader;
23 import org.apache.giraph.mapping.MappingEntry;
24 import org.apache.hadoop.io.Writable;
25 import org.apache.hadoop.io.WritableComparable;
26 import org.apache.hadoop.mapreduce.InputSplit;
27 import org.apache.hadoop.mapreduce.TaskAttemptContext;
28
29 import java.io.IOException;
30
31
32
33
34
35
36
37
38
39
40 public class MappingReaderWrapper<I extends WritableComparable,
41 V extends Writable, E extends Writable, B extends Writable>
42 extends MappingReader<I, V, E, B> {
43
44 private GiraphReader<MappingEntry<I, B>> mappingReader;
45
46
47
48
49 private IteratorToReaderWrapper<MappingEntry<I, B>> iterator;
50
51
52
53
54
55
56 public MappingReaderWrapper(GiraphReader<MappingEntry<I, B>> mappingReader) {
57 this.mappingReader = mappingReader;
58 iterator = new IteratorToReaderWrapper<>(mappingReader);
59 }
60
61 @Override
62 public void setConf(
63 ImmutableClassesGiraphConfiguration<I, V, E> conf) {
64 super.setConf(conf);
65 conf.configureIfPossible(mappingReader);
66 }
67
68 @Override
69 public boolean nextEntry() throws IOException, InterruptedException {
70 return iterator.nextObject();
71 }
72
73 @Override
74 public MappingEntry<I, B> getCurrentEntry()
75 throws IOException, InterruptedException {
76 return iterator.getCurrentObject();
77 }
78
79
80 @Override
81 public void initialize(InputSplit inputSplit,
82 TaskAttemptContext context) throws IOException, InterruptedException {
83 mappingReader.initialize(inputSplit, context);
84 }
85
86 @Override
87 public void close() throws IOException {
88 mappingReader.close();
89 }
90
91 @Override
92 public float getProgress() throws IOException, InterruptedException {
93 return mappingReader.getProgress();
94 }
95 }