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.requests;
20
21 /**
22 * Type of the request
23 */
24 public enum RequestType {
25 /*if[HADOOP_NON_SECURE]
26 else[HADOOP_NON_SECURE]*/
27 /** Exchange authentication information between clients and servers */
28 SASL_TOKEN_MESSAGE_REQUEST(SaslTokenMessageRequest.class),
29 /**
30 * Used by servers to acknowledge SASL authentication completion with
31 * client, so client can modify its pipeline afterwards.
32 */
33 SASL_COMPLETE_REQUEST(SaslCompleteRequest.class),
34 /*end[HADOOP_NON_SECURE]*/
35 /** Sending vertices request */
36 SEND_VERTEX_REQUEST(SendVertexRequest.class),
37 /** Sending vertices request */
38 SEND_WORKER_VERTICES_REQUEST(SendWorkerVerticesRequest.class),
39 /** Sending a partition of messages for next superstep */
40 SEND_WORKER_MESSAGES_REQUEST(SendWorkerMessagesRequest.class),
41 /** Sending one message to many ids in a single request */
42 SEND_WORKER_ONE_MESSAGE_TO_MANY_REQUEST(
43 SendWorkerOneMessageToManyRequest.class),
44 /**
45 * Sending a partition of messages for current superstep
46 * (used during partition exchange)
47 */
48 SEND_PARTITION_CURRENT_MESSAGES_REQUEST
49 (SendPartitionCurrentMessagesRequest.class),
50 /** Send a partition of edges */
51 SEND_WORKER_EDGES_REQUEST(SendWorkerEdgesRequest.class),
52 /** Send a partition of mutations */
53 SEND_PARTITION_MUTATIONS_REQUEST(SendPartitionMutationsRequest.class),
54 /** Send aggregated values from one worker's vertices */
55 SEND_WORKER_AGGREGATORS_REQUEST(SendWorkerAggregatorsRequest.class),
56 /** Send aggregated values from worker owner to master */
57 SEND_AGGREGATORS_TO_MASTER_REQUEST(SendReducedToMasterRequest.class),
58 /** Send aggregators from master to worker owners */
59 SEND_AGGREGATORS_TO_OWNER_REQUEST(SendAggregatorsToOwnerRequest.class),
60 /** Send aggregators from worker owner to other workers */
61 SEND_AGGREGATORS_TO_WORKER_REQUEST(SendAggregatorsToWorkerRequest.class),
62 /** Send message from worker to worker */
63 SEND_WORKER_TO_WORKER_MESSAGE_REQUEST(SendWorkerToWorkerMessageRequest.class),
64 /** Send request for input split from worker to master */
65 ASK_FOR_INPUT_SPLIT_REQUEST(AskForInputSplitRequest.class),
66 /** Send request with granted input split from master to workers */
67 REPLY_WITH_INPUT_SPLIT_REQUEST(ReplyWithInputSplitRequest.class),
68 /** Send request to resume sending messages (used in flow-control) */
69 SEND_RESUME_REQUEST(SendResumeRequest.class),
70 /** Send addresses and partitions assignments from master to workers */
71 ADDRESSES_AND_PARTITIONS_REQUEST(AddressesAndPartitionsRequest.class),
72 /** Send partition stats from worker to master */
73 PARTITION_STATS_REQUEST(PartitionStatsRequest.class);
74
75 /** Class of request which this type corresponds to */
76 private final Class<? extends WritableRequest> requestClass;
77
78 /**
79 * Constructor
80 *
81 * @param requestClass Class of request which this type corresponds to
82 */
83 private RequestType(Class<? extends WritableRequest> requestClass) {
84 this.requestClass = requestClass;
85 }
86
87 /**
88 * Get class of request which this type corresponds to
89 *
90 * @return Class of request which this type corresponds to
91 */
92 public Class<? extends WritableRequest> getRequestClass() {
93 return requestClass;
94 }
95 }