This project has retired. For details please refer to its Attic page.
Piece 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  package org.apache.giraph.block_app.framework.piece;
19  
20  import java.util.List;
21  
22  import org.apache.giraph.block_app.framework.api.BlockWorkerContextReceiveApi;
23  import org.apache.giraph.block_app.framework.api.BlockWorkerContextSendApi;
24  import org.apache.giraph.types.NoMessage;
25  import org.apache.hadoop.io.Writable;
26  import org.apache.hadoop.io.WritableComparable;
27  
28  /**
29   * Piece that should be extended in common usecases, when we want to be:
30   * - sending and then receiving messages from vertices
31   * - sending data to be aggregated from workers to master
32   * - sending values from master, via aggregators, to workers
33   *
34   * (basically - we don't want to use WorkerContext)
35   *
36   * @param <I> Vertex id type
37   * @param <V> Vertex value type
38   * @param <E> Edge value type
39   * @param <M> Message type
40   * @param <S> Execution stage type
41   */
42  @SuppressWarnings("rawtypes")
43  public class Piece<I extends WritableComparable, V extends Writable,
44      E extends Writable, M extends Writable, S>
45      extends DefaultParentPiece<I, V, E, M, Object, NoMessage, S> {
46  
47    // Disallowing use of Worker Context functions:
48    @Override
49    public final void workerContextSend(
50        BlockWorkerContextSendApi<I, NoMessage> workerContextApi,
51        S executionStage, Object workerValue) {
52    }
53  
54    @Override
55    public final void workerContextReceive(
56        BlockWorkerContextReceiveApi workerContextApi,
57        S executionStage, Object workerValue, List<NoMessage> workerMessages) {
58    }
59  }