This project has retired. For details please refer to its Attic page.
VertexOutputFormat xref
View Javadoc

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.hadoop.io.Writable;
24  import org.apache.hadoop.io.WritableComparable;
25  import org.apache.hadoop.mapreduce.TaskAttemptContext;
26  
27  /**
28   * Implement to output the graph after the computation.  It is modeled
29   * directly after the Hadoop OutputFormat.
30   * ImmutableClassesGiraphConfiguration is available
31   *
32   * It's guaranteed that whatever parameters are set in the configuration are
33   * also going to be available in all method arguments related to this output
34   * format (context in createVertexWriter, checkOutputSpecs and
35   * getOutputCommitter; methods invoked on VertexWriter and OutputCommitter).
36   * So if backing output format relies on some parameters from configuration,
37   * you can safely set them for example in
38   * {@link #setConf(org.apache.giraph.conf.ImmutableClassesGiraphConfiguration)}.
39   *
40   * @param <I> Vertex index value
41   * @param <V> Vertex value
42   * @param <E> Edge value
43   */
44  @SuppressWarnings("rawtypes")
45  public abstract class VertexOutputFormat<
46      I extends WritableComparable, V extends Writable,
47      E extends Writable> extends
48      OutputFormat<I, V, E> {
49    /**
50     * Create a vertex writer for a given split. The framework will call
51     * {@link VertexWriter#initialize(TaskAttemptContext)} before
52     * the split is used.
53     *
54     * @param context the information about the task
55     * @return a new vertex writer
56     * @throws IOException
57     * @throws InterruptedException
58     */
59    public abstract VertexWriter<I, V, E> createVertexWriter(
60      TaskAttemptContext context) throws IOException, InterruptedException;
61  }