This project has retired. For details please refer to its Attic page.
WorkerServer 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.comm;
20  
21  import org.apache.giraph.comm.flow_control.FlowControl;
22  import org.apache.hadoop.io.Writable;
23  import org.apache.hadoop.io.WritableComparable;
24  
25  import java.io.Closeable;
26  import java.net.InetSocketAddress;
27  
28  /**
29   * Interface for message communication server.
30   *
31   * @param <I> Vertex id
32   * @param <V> Vertex value
33   * @param <E> Edge value
34   */
35  @SuppressWarnings("rawtypes")
36  public interface WorkerServer<I extends WritableComparable,
37      V extends Writable, E extends Writable>
38      extends NetworkMetrics, Closeable {
39    /**
40     * Get server address
41     *
42     * @return Address used by this server
43     */
44    InetSocketAddress getMyAddress();
45  
46    /**
47     * Get server host name or IP
48     * @return server host name or IP
49     */
50    String getLocalHostOrIp();
51  
52    /**
53     * Prepare incoming messages for computation, and resolve mutation requests.
54     */
55    void prepareSuperstep();
56  
57    /**
58     * Get server data
59     *
60     * @return Server data
61     */
62    ServerData<I, V, E> getServerData();
63  
64    /**
65     * Shuts down.
66     */
67    void close();
68  
69    /**
70     * Inform this server about the flow control used in sending requests
71     *
72     * @param flowControl reference to the flow control policy
73     */
74    void setFlowControl(FlowControl flowControl);
75  }