Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
MasterGlobalCommUsageAggregators |
|
| 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.master; | |
20 | ||
21 | import org.apache.giraph.reducers.ReduceOperation; | |
22 | import org.apache.hadoop.io.Writable; | |
23 | ||
24 | /** | |
25 | * Master compute can access reduce and broadcast methods | |
26 | * through this interface, from masterCompute method. | |
27 | */ | |
28 | public interface MasterGlobalCommUsageAggregators { | |
29 | /** | |
30 | * Register reducer to be reduced in the next worker computation, | |
31 | * using given name and operations. | |
32 | * @param name Name of the reducer | |
33 | * @param reduceOp Reduce operations | |
34 | * @param <S> Single value type | |
35 | * @param <R> Reduced value type | |
36 | */ | |
37 | <S, R extends Writable> void registerReducer( | |
38 | String name, ReduceOperation<S, R> reduceOp); | |
39 | ||
40 | /** | |
41 | * Register reducer to be reduced in the next worker computation, using | |
42 | * given name and operations, starting globally from globalInitialValue. | |
43 | * (globalInitialValue is reduced only once, each worker will still start | |
44 | * from neutral initial value) | |
45 | * | |
46 | * @param name Name of the reducer | |
47 | * @param reduceOp Reduce operations | |
48 | * @param globalInitialValue Global initial value | |
49 | * @param <S> Single value type | |
50 | * @param <R> Reduced value type | |
51 | */ | |
52 | <S, R extends Writable> void registerReducer( | |
53 | String name, ReduceOperation<S, R> reduceOp, R globalInitialValue); | |
54 | ||
55 | /** | |
56 | * Get reduced value from previous worker computation. | |
57 | * @param name Name of the reducer | |
58 | * @return Reduced value | |
59 | * @param <R> Reduced value type | |
60 | */ | |
61 | <R extends Writable> R getReduced(String name); | |
62 | ||
63 | /** | |
64 | * Broadcast given value to all workers for next computation. | |
65 | * @param name Name of the broadcast object | |
66 | * @param value Value | |
67 | */ | |
68 | void broadcast(String name, Writable value); | |
69 | } |