/*
 * The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
 * (the "License"). You may not use this work except in compliance with the License, which is
 * available at www.apache.org/licenses/LICENSE-2.0
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied, as more fully set forth in the License.
 *
 * See the NOTICE file distributed with this work for information regarding copyright ownership.
 */

package alluxio.master.block;

import alluxio.Constants;
import alluxio.exception.AlluxioException;
import alluxio.thrift.AlluxioTException;
import alluxio.thrift.BlockMasterWorkerService;
import alluxio.thrift.Command;
import alluxio.thrift.WorkerNetAddress;
import alluxio.wire.ThriftUtils;

import com.google.common.base.Preconditions;

import java.util.List;
import java.util.Map;

import javax.annotation.concurrent.NotThreadSafe;

/**
 * This class is a Thrift handler for block master RPCs invoked by an Alluxio worker.
 */
@NotThreadSafe // TODO(jiri): make thread-safe (c.f. ALLUXIO-1664)
public class BlockMasterWorkerServiceHandler implements BlockMasterWorkerService.Iface {
  private final BlockMaster mBlockMaster;

  /**
   * Creates a new instance of {@link BlockMasterWorkerServiceHandler}.
   *
   * @param blockMaster the {@link BlockMaster} the handler uses internally
   */
  public BlockMasterWorkerServiceHandler(BlockMaster blockMaster) {
    Preconditions.checkNotNull(blockMaster);
    mBlockMaster = blockMaster;
  }

  @Override
  public long getServiceVersion() {
    return Constants.BLOCK_MASTER_WORKER_SERVICE_VERSION;
  }

  @Override
  public long getWorkerId(WorkerNetAddress workerNetAddress) {
    return mBlockMaster.getWorkerId(ThriftUtils.fromThrift((workerNetAddress)));
  }

  @Override
  public void registerWorker(long workerId, List<String> storageTiers,
      Map<String, Long> totalBytesOnTiers, Map<String, Long> usedBytesOnTiers,
      Map<String, List<Long>> currentBlocksOnTiers) throws AlluxioTException {
    try {
      mBlockMaster.workerRegister(workerId, storageTiers, totalBytesOnTiers, usedBytesOnTiers,
          currentBlocksOnTiers);
    } catch (AlluxioException e) {
      throw e.toThrift();
    }
  }

  @Override
  public Command heartbeat(long workerId, Map<String, Long> usedBytesOnTiers,
      List<Long> removedBlockIds, Map<String, List<Long>> addedBlocksOnTiers) {
    return mBlockMaster
        .workerHeartbeat(workerId, usedBytesOnTiers, removedBlockIds, addedBlocksOnTiers);
  }

  @Override
  public void commitBlock(long workerId, long usedBytesOnTier, String tierAlias, long blockId,
      long length) throws AlluxioTException {
    try {
      mBlockMaster.commitBlock(workerId, usedBytesOnTier, tierAlias, blockId, length);
    } catch (AlluxioException e) {
      throw e.toThrift();
    }
  }
}


@@ -2151,16 +2151,26 @@
 OnTiers,
+%0A         
  usedByt
@@ -2179,26 +2179,16 @@
 OnTiers,
-%0A         
  current
@@ -2468,25 +2468,16 @@
 ckMaster
-%0A        
 .workerH
@@ -2529,16 +2529,24 @@
 lockIds,
+%0A       
  addedBl

Remove unnecessary changes