Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
AggregatorUsage |
|
| 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 | ||
19 | package org.apache.giraph.graph; | |
20 | ||
21 | import org.apache.hadoop.io.Writable; | |
22 | ||
23 | /** | |
24 | * Vertex classes can use this interface to register and use aggregators | |
25 | */ | |
26 | public interface AggregatorUsage { | |
27 | /** | |
28 | * Register an aggregator in preSuperstep() and/or preApplication(). | |
29 | * | |
30 | * @param <A> Aggregator type | |
31 | * @param name of aggregator | |
32 | * @param aggregatorClass Class type of the aggregator | |
33 | * @return created Aggregator or null when already registered | |
34 | */ | |
35 | <A extends Writable> Aggregator<A> registerAggregator( | |
36 | String name, | |
37 | Class<? extends Aggregator<A>> aggregatorClass) | |
38 | throws InstantiationException, IllegalAccessException; | |
39 | ||
40 | /** | |
41 | * Get a registered aggregator. | |
42 | * | |
43 | * @param name Name of aggregator | |
44 | * @return Aggregator (null when not registered) | |
45 | */ | |
46 | Aggregator<? extends Writable> getAggregator(String name); | |
47 | ||
48 | /** | |
49 | * Use a registered aggregator in current superstep. | |
50 | * Even when the same aggregator should be used in the next | |
51 | * superstep, useAggregator needs to be called at the beginning | |
52 | * of that superstep in preSuperstep(). | |
53 | * | |
54 | * @param name Name of aggregator | |
55 | * @return boolean (false when not registered) | |
56 | */ | |
57 | boolean useAggregator(String name); | |
58 | } |