This project has retired. For details please refer to its Attic page.
MasterAggregatorUsage 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.master;
20  
21  import org.apache.giraph.aggregators.Aggregator;
22  import org.apache.giraph.aggregators.AggregatorUsage;
23  import org.apache.hadoop.io.Writable;
24  
25  /**
26   * Master compute can access and change aggregators through this interface
27   */
28  public interface MasterAggregatorUsage extends AggregatorUsage {
29    /**
30     * Register an aggregator in preSuperstep() and/or preApplication(). This
31     * aggregator will have its value reset at the end of each super step.
32     *
33     * @param name of aggregator
34     * @param aggregatorClass Class type of the aggregator
35     * @param <A> Aggregator type
36     * @return True iff aggregator wasn't already registered
37     * @throws InstantiationException
38     * @throws IllegalAccessException
39     */
40    <A extends Writable> boolean registerAggregator(String name,
41        Class<? extends Aggregator<A>> aggregatorClass) throws
42        InstantiationException, IllegalAccessException;
43  
44    /**
45     * Register persistent aggregator in preSuperstep() and/or
46     * preApplication(). This aggregator will not reset value at the end of
47     * super step.
48     *
49     * @param name of aggregator
50     * @param aggregatorClass Class type of the aggregator
51     * @param <A> Aggregator type
52     * @return True iff aggregator wasn't already registered
53     * @throws InstantiationException
54     * @throws IllegalAccessException
55     */
56    <A extends Writable> boolean registerPersistentAggregator(String name,
57        Class<? extends Aggregator<A>> aggregatorClass) throws
58        InstantiationException, IllegalAccessException;
59  
60    /**
61     * Sets value of an aggregator.
62     *
63     * @param name Name of aggregator
64     * @param value Value to set
65     * @param <A> Aggregated value
66     */
67    <A extends Writable> void setAggregatedValue(String name, A value);
68  }