Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
BlockWorkerSendApi |
|
| 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 | package org.apache.giraph.block_app.framework.api; | |
19 | ||
20 | import java.util.Iterator; | |
21 | ||
22 | import org.apache.giraph.conf.ImmutableClassesGiraphConfiguration; | |
23 | import org.apache.giraph.edge.Edge; | |
24 | import org.apache.giraph.edge.OutEdges; | |
25 | import org.apache.giraph.graph.Vertex; | |
26 | import org.apache.giraph.worker.WorkerAggregatorUsage; | |
27 | import org.apache.giraph.worker.WorkerReduceUsage; | |
28 | import org.apache.hadoop.io.Writable; | |
29 | import org.apache.hadoop.io.WritableComparable; | |
30 | ||
31 | /** | |
32 | * Block computation API available for worker send methods. | |
33 | * | |
34 | * Interface to the Computation methods. | |
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 | */ | |
41 | @SuppressWarnings("rawtypes") | |
42 | public interface BlockWorkerSendApi<I extends WritableComparable, | |
43 | V extends Writable, E extends Writable, M extends Writable> | |
44 | extends BlockWorkerApi<I>, WorkerAggregatorUsage, WorkerReduceUsage { | |
45 | @Override | |
46 | ImmutableClassesGiraphConfiguration<I, V, E> getConf(); | |
47 | ||
48 | /** | |
49 | * Send a message to a vertex id. | |
50 | * | |
51 | * @param id Vertex id to send the message to | |
52 | * @param message Message data to send | |
53 | */ | |
54 | void sendMessage(I id, M message); | |
55 | ||
56 | /** | |
57 | * Send a message to all edges. | |
58 | * | |
59 | * @param vertex Vertex whose edges to send the message to. | |
60 | * @param message Message sent to all edges. | |
61 | */ | |
62 | void sendMessageToAllEdges(Vertex<I, V, E> vertex, M message); | |
63 | ||
64 | /** | |
65 | * Send a message to multiple target vertex ids in the iterator. | |
66 | * | |
67 | * @param vertexIdIterator An iterator to multiple target vertex ids. | |
68 | * @param message Message sent to all targets in the iterator. | |
69 | */ | |
70 | void sendMessageToMultipleEdges(Iterator<I> vertexIdIterator, M message); | |
71 | ||
72 | /** | |
73 | * Sends a request to create a vertex that will be available | |
74 | * in the receive phase. | |
75 | * | |
76 | * @param id Vertex id | |
77 | * @param value Vertex value | |
78 | * @param edges Initial edges | |
79 | */ | |
80 | void addVertexRequest(I id, V value, OutEdges<I, E> edges); | |
81 | ||
82 | /** | |
83 | * Sends a request to create a vertex that will be available | |
84 | * in the receive phase. | |
85 | * | |
86 | * @param id Vertex id | |
87 | * @param value Vertex value | |
88 | */ | |
89 | void addVertexRequest(I id, V value); | |
90 | ||
91 | /** | |
92 | * Request to remove a vertex from the graph | |
93 | * (applied just prior to the next receive phase). | |
94 | * | |
95 | * @param vertexId Id of the vertex to be removed. | |
96 | */ | |
97 | void removeVertexRequest(I vertexId); | |
98 | ||
99 | /** | |
100 | * Request to add an edge of a vertex in the graph | |
101 | * (processed just prior to the next receive phase) | |
102 | * | |
103 | * @param sourceVertexId Source vertex id of edge | |
104 | * @param edge Edge to add | |
105 | */ | |
106 | void addEdgeRequest(I sourceVertexId, Edge<I, E> edge); | |
107 | ||
108 | /** | |
109 | * Request to remove all edges from a given source vertex to a given target | |
110 | * vertex (processed just prior to the next receive phase). | |
111 | * | |
112 | * @param sourceVertexId Source vertex id | |
113 | * @param targetVertexId Target vertex id | |
114 | */ | |
115 | void removeEdgesRequest(I sourceVertexId, I targetVertexId); | |
116 | } |