/**
   * Gets the allocated size.
   *
   * @param share_size the share_size
   * @param block_size the block_size
   * @param num_segments the num_segments
   * @param num_share_hashes the num_share_hashes
   * @param uri_extension_size_max the uri_extension_size_max
   * @return the allocated size
   */
  public static int getAllocatedSize(
      long share_size,
      long block_size,
      int num_segments,
      int num_share_hashes,
      int uri_extension_size_max) {
    int size = 0;

    int effective_segments = MathUtils.next_power_of_k(num_segments, 2);
    int segment_hash_size = (2 * effective_segments - 1) * Hash.HASH_SIZE;

    int share_hashtree_size = num_share_hashes * (2 + Hash.HASH_SIZE);

    int x = 0x24;
    x += share_size + (3 * segment_hash_size) + share_hashtree_size;

    size = x + 4 + uri_extension_size_max;

    return size;
  }
        @Override
        public void handle(NsWriteBucketProxyInit init) {

          logger =
              Slf4jInstantiator.getLogger(
                  NsWriteBucketProxy.class, init.getSelfAddress().getNickname());
          dest = init.getDest();
          self = init.getSelf();
          sharenum = init.getSharenum();

          data_size = init.getFileinfo().getShareSize();
          block_size = init.getFileinfo().getBlockSize();

          int effective_segments =
              MathUtils.next_power_of_k(init.getFileinfo().getNumSegments(), 2);
          segment_hash_size = (2 * effective_segments - 1) * Hash.HASH_SIZE;
          share_hashtree_size = init.getFileinfo().getNumShareHashes() * (2 + Hash.HASH_SIZE);

          logger.debug("({}): initiated", self);
          createOffsets();
        }