Examples of BlockLocation


Examples of me.vudu.Conflict.util.BlockLocation

                                    // drunter
        // wenn einer davon die untere H�lfte einer T�r ist
        if (a.getTypeId() == 64 || b.getTypeId() == 64 || a.getTypeId() == 71 || b.getTypeId() == 71) {

          SpoutPlayer p = (SpoutPlayer) event.getPlayer();
          BlockLocation aLoc = new BlockLocation(a.getLocation());
          BlockLocation bLoc = new BlockLocation(b.getLocation());

          for (BlockLocation bl : ConflictPlugin.doorsRed) {
            if (bl.equals(aLoc) || bl.equals(bLoc)) { // doors is red
              if (ConflictPlugin.playerIsInTeam(p).equals("red")) {
                p.sendMessage("Herzlich willkommen");
View Full Code Here

Examples of org.apache.flink.core.fs.BlockLocation

      assertNull(blockLocations);

      blockLocations = fs.getFileBlockLocations(fileStatus, 0, SMALL_FILE_SIZE);
      assertEquals(1, blockLocations.length);

      final BlockLocation bl = blockLocations[0];
      assertNotNull(bl.getHosts());
      assertEquals(1, bl.getHosts().length);
      assertEquals(SMALL_FILE_SIZE, bl.getLength());
      assertEquals(0, bl.getOffset());
      final URI s3Uri = fs.getUri();
      assertNotNull(s3Uri);
      assertEquals(s3Uri.getHost(), bl.getHosts()[0]);

      fs.delete(dir, true);

    } catch (IOException ioe) {
      fail(ioe.getMessage());
View Full Code Here

Examples of org.apache.hadoop.fs.BlockLocation

    for (int i = 0; i < blocks.length; i++) {
      if ((blocks[i].getOffset() <= offset) && (offset < blocks[i].getOffset() + blocks[i].getLength())) {
        return i;
      }
    }
    BlockLocation block = blocks[blocks.length - 1];
    long length = block.getOffset() + block.getLength() - 1;
    throw new IllegalArgumentException("Offset " + offset + " is outside of file with length=" + length);
  }
View Full Code Here

Examples of org.apache.hadoop.fs.BlockLocation

  protected static Path mockWithFileSystem(int blockCount, long blockSize, long extraBlockSize) throws Exception {
    final ArrayList<BlockLocation> blocks = new ArrayList<BlockLocation>();
    long offset = 0;
    int i = 0;
    for (; i < blockCount; i++) {
      blocks.add(new BlockLocation(new String[]{"names"+i}, new String[]{"hosts"+i}, offset, blockSize));
      offset += blockSize;
    }

    // extra just means that we add a non full last block
    if (extraBlockSize > 0 && extraBlockSize < blockSize) {
      blocks.add(new BlockLocation(new String[]{"names"+i}, new String[]{"hosts"+i}, offset, extraBlockSize));
      offset += extraBlockSize;
    }

    FileStatus mStatus = mock(FileStatus.class);
    Path mPath = mock(Path.class);
View Full Code Here

Examples of org.apache.hadoop.fs.BlockLocation

      if ((blkLocations[i].getOffset() <= offset) &&
          (offset < blkLocations[i].getOffset() + blkLocations[i].getLength())){
        return i;
      }
    }
    BlockLocation last = blkLocations[blkLocations.length -1];
    long fileLength = last.getOffset() + last.getLength() -1;
    throw new IllegalArgumentException("Offset " + offset +
                                       " is outside of file (0.." +
                                       fileLength + ")");
  }
View Full Code Here

Examples of org.apache.hadoop.fs.BlockLocation

      if ((blkLocations[i].getOffset() <= offset) &&
          (offset < blkLocations[i].getOffset() + blkLocations[i].getLength())){
        return i;
      }
    }
    BlockLocation last = blkLocations[blkLocations.length -1];
    long fileLength = last.getOffset() + last.getLength() -1;
    throw new IllegalArgumentException("Offset " + offset +
                                       " is outside of file (0.." +
                                       fileLength + ")");
  }
View Full Code Here

Examples of org.apache.hadoop.fs.BlockLocation

  public static void waitReplication(FileSystem fs, Path fileName,
      short replFactorthrows IOException {
    boolean good;
    do {
      good = true;
      BlockLocation locs[] = fs.getFileBlockLocations(
        fs.getFileStatus(fileName), 0, Long.MAX_VALUE);
      for (int j = 0; j < locs.length; j++) {
        String[] loc = locs[j].getHosts();
        if (loc.length != replFactor) {
          System.out.println("File " + fileName + " has replication factor " +
View Full Code Here

Examples of org.apache.hadoop.fs.BlockLocation

                if (diff < 0) return -1;
                if (diff > 0) return 1;
                return 0;
              }
            });
            BlockLocation firstBlock = locations[0];
            BlockLocation lastBlock = locations[locations.length - 1];
            long lastBlockOffsetBegin = lastBlock.getOffset();
            long lastBlockOffsetEnd =
                lastBlockOffsetBegin + lastBlock.getLength();
            if ((firstBlock.getOffset() > offsetBegin)
                || (lastBlockOffsetEnd < offsetEnd)) {
              throw new AssertionError(
                  "Block locations returned by getFileBlockLocations do not cover requested range");
            }
View Full Code Here

Examples of org.apache.hadoop.fs.BlockLocation

      if (locations == null) {
        blocks = new OneBlockInfo[0];
      } else {

        if(locations.length == 0) {
          locations = new BlockLocation[] { new BlockLocation() };
        }

        if (!isSplitable) {
          // if the file is not splitable, just create the one block with
          // full file length
View Full Code Here

Examples of org.apache.hadoop.fs.BlockLocation

        xferAddrs[hCnt] = locations[hCnt].getXferAddr();
        NodeBase node = new NodeBase(xferAddrs[hCnt],
                                     locations[hCnt].getNetworkLocation());
        racks[hCnt] = node.toString();
      }
      blkLocations[idx] = new BlockLocation(xferAddrs, hosts, racks,
                                            blk.getStartOffset(),
                                            blk.getBlockSize(),
                                            blk.isCorrupt());
      idx++;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.