Examples of BlockId


Examples of com.nitnelave.CreeperHeal.block.BlockId

     *            The block to test.
     * @return Whether the block's type is protected.
     */
    public boolean isProtected(Block block)
    {
        return protectList.getValue().contains(new BlockId(block))
               || (block.getState() instanceof InventoryHolder
                   && CreeperConfig.getBool(CfgVal.REPLACE_PROTECTED_CHESTS) && PluginHandler
                               .isProtected(block));
    }
View Full Code Here

Examples of com.nitnelave.CreeperHeal.block.BlockId

     *            The block to test.
     * @return Whether the block is blacklisted.
     */
    public boolean isGriefBlackListed(Block block)
    {
        return griefPlaceList.getValue().contains(new BlockId(block));
    }
View Full Code Here

Examples of com.nitnelave.CreeperHeal.block.BlockId

        try
        {
            String tmp_str1 = config.getString(name + ".restrict-list", "").trim();
            String[] split = tmp_str1.split(",");
            for (String elem : split)
                restrict_list.add(new BlockId(elem));
        } catch (NumberFormatException e)
        {
            CreeperLog.warning("[CreeperHeal] Wrong values for restrict-list field for world "
                               + name);
            restrict_list.clear();
            restrict_list.add(new BlockId(0));
        }
    }
View Full Code Here

Examples of com.nitnelave.CreeperHeal.block.BlockId

        String[] split = tmp_str1.split(",");
        try
        {
            for (String elem : split)
            {
                BlockId bId = new BlockId(elem);
                if (bId.getId() != 0)
                    set.add(bId);
            }
            return set;
        } catch (NumberFormatException e)
        {
View Full Code Here

Examples of com.nitnelave.CreeperHeal.block.BlockId

        String[] split = tmp_str1.split(",");
        try
        {
            for (String elem : split)
            {
                BlockId bId = new BlockId(elem);
                if (bId.getId() != 0)
                    set.add(bId);
            }
            setValue(set);
        } catch (NumberFormatException e)
        {
View Full Code Here

Examples of org.apache.spark.storage.BlockId

    this.pResolver = pResolver;
  }

  @Override
  public void channelRead0(ChannelHandlerContext ctx, String blockIdString) {
    BlockId blockId = BlockId.apply(blockIdString);
    FileSegment fileSegment = pResolver.getBlockLocation(blockId);
    // if getBlockLocation returns null, close the channel
    if (fileSegment == null) {
      //ctx.close();
      return;
View Full Code Here

Examples of org.jcoredb.fs.BlockId

  public void create() {

   
    IFileSystem fs = FileSystemRegistry.get(new FileSystemRegKey(Constants.HOST, Configs.getFSConfig().getRootDir()));
   
    BlockId blockId = new BlockId(containerId, segmentId, id);
   
    try
    {
      Block block = fs.read(blockId);
     
      JSONNode root = JSONHelper.createSuccessNode();
      JSONAttribute containerId = new JSONAttribute("containerId", ""+blockId.getContainerId(), AttrType.Number);
      JSONAttribute segmentId = new JSONAttribute("segmentId", ""+blockId.getSegmentId(), AttrType.Number);
      JSONAttribute id = new JSONAttribute("blockId", ""+blockId.getId(), AttrType.Number);
      JSONAttribute data = new JSONAttribute("data", Base64.encodeBase64String(block.getBytes()),AttrType.String);
      root.add(containerId);
      root.add(segmentId);
      root.add(id);
      root.add(data);
View Full Code Here

Examples of org.jcoredb.fs.BlockId

    String testStr = "<test> <content> Hello world! </content> </test>";
    byte[] content = testStr.getBytes();
   
    for (int i = 0; i < NUM_OF_BLOCKS_TO_APPEND; i++) {

      Block b = new Block(new BlockId(0));
      b.setBytes(content);     
      blocks[i] = b;
    }

    long startMs = System.currentTimeMillis();
View Full Code Here

Examples of org.jcoredb.fs.BlockId

    String testStr = "<test> <content> Hello world! </content> </test>";
    byte[] content = testStr.getBytes();
   
    for (int i = 0; i < NUM_OF_BLOCKS_TO_APPEND; i++) {

      Block b = new Block(new BlockId(0));
      b.setBytes(content);     
      blocks[i] = b;
    }

    long startMs = System.currentTimeMillis();
View Full Code Here

Examples of org.jcoredb.fs.BlockId

          numOfBlocksLeft = cntBlocks.length;
        }
        else
        {
          //Get the last segment
          BlockId idOfLastFreeBlock = cnt.findLastFreeBlock();
          DataSegment lastSegOfCnt = cnt.getSegment(idOfLastFreeBlock.getSegmentId());
          int freeInLastSeg = SEGSIZE - idOfLastFreeBlock.getId();
         
          for (int i=idOfLastFreeBlock.getContainerId(); i < SEGSIZE; i++)
          {
            BlockId currFullBlockId = new BlockId(cntId, lastSegOfCnt.getId(), i);
            blockIds.add(currFullBlockId);
            cntBlocks[i].setId(currFullBlockId);
          }
         
          numOfBlocksLeft = cntBlocks.length - freeInLastSeg;
         
        }
       
        //Reserve somme Id-s for the blocks
        int currBlockId = 0;
        DataSegment currSeg = null;
   
        int startIdx = (cntBlocks.length - numOfBlocksLeft);
       
        for (int i = startIdx ; i < cntBlocks.length; i++)
        {
          if (i == startIdx || i % SEGSIZE == 0)
          {
            //Extend
            currBlockId = 0;
            currSeg = cnt.extend();
            currSeg.open();
          }
         
          BlockId currFullBlockId = new BlockId(cntId, currSeg.getId(), currBlockId);
          blockIds.add(currFullBlockId);
          cntBlocks[i].setId(currFullBlockId);

          currBlockId++;
        }
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.