Coverage Report - org.apache.giraph.block_app.framework.api.giraph.BlockWorkerContextApiWrapper
 
Classes in this File Line Coverage Branch Coverage Complexity
BlockWorkerContextApiWrapper
0%
0/21
N/A
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.giraph;
 19  
 
 20  
 import org.apache.giraph.block_app.framework.api.BlockWorkerContextReceiveApi;
 21  
 import org.apache.giraph.block_app.framework.api.BlockWorkerContextSendApi;
 22  
 import org.apache.giraph.block_app.framework.api.Counter;
 23  
 import org.apache.giraph.block_app.framework.internal.BlockCounters;
 24  
 import org.apache.giraph.conf.ImmutableClassesGiraphConfiguration;
 25  
 import org.apache.giraph.worker.WorkerContext;
 26  
 import org.apache.hadoop.io.Writable;
 27  
 import org.apache.hadoop.io.WritableComparable;
 28  
 
 29  
 /**
 30  
  * Giraph implementation of BlockWorkerContextReceiveApi and
 31  
  * BlockWorkerContextSendApi, passing all calls to WorkerContext.
 32  
  *
 33  
  * @param <I> vertex Id type.
 34  
  * @param <WM> Worker message type
 35  
  */
 36  0
 final class BlockWorkerContextApiWrapper
 37  
     <I extends WritableComparable, WM extends Writable> implements
 38  
     BlockWorkerContextReceiveApi<I>, BlockWorkerContextSendApi<I, WM> {
 39  
   private final WorkerContext workerContext;
 40  
 
 41  0
   public BlockWorkerContextApiWrapper(WorkerContext workerContext) {
 42  0
     this.workerContext = workerContext;
 43  0
   }
 44  
 
 45  
   @Override
 46  
   public ImmutableClassesGiraphConfiguration<?, ?, ?> getConf() {
 47  0
     return workerContext.getConf();
 48  
   }
 49  
 
 50  
   @Override
 51  
   public int getWorkerCount() {
 52  0
     return workerContext.getWorkerCount();
 53  
   }
 54  
 
 55  
   @Override
 56  
   public int getMyWorkerIndex() {
 57  0
     return workerContext.getMyWorkerIndex();
 58  
   }
 59  
 
 60  
   @Override
 61  
   public int getWorkerForVertex(I vertexId) {
 62  0
     return workerContext.getWorkerForVertex(vertexId);
 63  
   }
 64  
 
 65  
   @Override
 66  
   public <A extends Writable> A getAggregatedValue(String name) {
 67  0
     return workerContext.getAggregatedValue(name);
 68  
   }
 69  
 
 70  
   @Override
 71  
   public <A extends Writable> void aggregate(String name, A value) {
 72  0
     workerContext.aggregate(name, value);
 73  0
   }
 74  
 
 75  
   @Override
 76  
   public void sendMessageToWorker(WM message, int workerIndex) {
 77  0
     workerContext.sendMessageToWorker(message, workerIndex);
 78  0
   }
 79  
 
 80  
   @Override
 81  
   public <B extends Writable> B getBroadcast(String name) {
 82  0
     return workerContext.getBroadcast(name);
 83  
   }
 84  
 
 85  
   @Override
 86  
   public long getTotalNumEdges() {
 87  0
     return workerContext.getTotalNumEdges();
 88  
   }
 89  
 
 90  
   @Override
 91  
   public long getTotalNumVertices() {
 92  0
     return workerContext.getTotalNumVertices();
 93  
   }
 94  
 
 95  
   @Override
 96  
   public Counter getCounter(String group, String name) {
 97  0
     return BlockCounters.getCounter(workerContext.getContext(), group, name);
 98  
   }
 99  
 
 100  
   @Override
 101  
   public void progress() {
 102  0
     workerContext.getContext().progress();
 103  0
   }
 104  
 
 105  
   @Override
 106  
   public void setStatus(String status) {
 107  0
     workerContext.getContext().setStatus(status);
 108  0
   }
 109  
 }