Examples of CephFileExtent


Examples of com.ceph.fs.CephFileExtent

    ArrayList<BlockLocation> blocks = new ArrayList<BlockLocation>();

    long curPos = start;
    long endOff = curPos + len;
    do {
      CephFileExtent extent = ceph.get_file_extent(fh, curPos);

      int[] osds = extent.getOSDs();
      String[] names = new String[osds.length];
      String[] hosts = new String[osds.length];
      String[] racks = new String[osds.length];

      for (int i = 0; i < osds.length; i++) {
        InetAddress addr = ceph.get_osd_address(osds[i]);
        names[i] = addr.getHostAddress();

        /*
         * Grab the hostname and rack from the crush hierarchy. Current we
         * hard code the item types. For a more general treatment, we'll need
         * a new configuration option that allows users to map their custom
         * crush types to hosts and topology.
         */
        Bucket[] path = ceph.get_osd_crush_location(osds[i]);
        for (Bucket bucket : path) {
          String type = bucket.getType();
          if (type.compareTo("host") == 0)
            hosts[i] = bucket.getName();
          else if (type.compareTo("rack") == 0)
            racks[i] = bucket.getName();
        }
      }

      blocks.add(new BlockLocation(names, hosts, racks,
            extent.getOffset(), extent.getLength()));

      curPos += extent.getLength();
    } while(curPos < endOff);

    ceph.close(fh);

    BlockLocation[] locations = new BlockLocation[blocks.size()];
View Full Code Here

Examples of com.ceph.fs.CephFileExtent

    ArrayList<BlockLocation> blocks = new ArrayList<BlockLocation>();

    long curPos = start;
    long endOff = curPos + len;
    do {
      CephFileExtent extent = ceph.get_file_extent(fh, curPos);

      int[] osds = extent.getOSDs();
      String[] names = new String[osds.length];
      String[] hosts = new String[osds.length];
      String[] racks = new String[osds.length];

      for (int i = 0; i < osds.length; i++) {
        InetAddress addr = ceph.get_osd_address(osds[i]);
        names[i] = addr.getHostAddress();

        /*
         * Grab the hostname and rack from the crush hierarchy. Current we
         * hard code the item types. For a more general treatment, we'll need
         * a new configuration option that allows users to map their custom
         * crush types to hosts and topology.
         */
        Bucket[] path = ceph.get_osd_crush_location(osds[i]);
        for (Bucket bucket : path) {
          String type = bucket.getType();
          if (type.compareTo("host") == 0)
            hosts[i] = bucket.getName();
          else if (type.compareTo("rack") == 0)
            racks[i] = bucket.getName();
        }
      }

      blocks.add(new BlockLocation(names, hosts, racks,
            extent.getOffset(), extent.getLength()));

      curPos += extent.getLength();
    } while(curPos < endOff);

    ceph.close(fh);

    BlockLocation[] locations = new BlockLocation[blocks.size()];
View Full Code Here

Examples of com.ceph.fs.CephFileExtent

    ArrayList<BlockLocation> blocks = new ArrayList<BlockLocation>();

    long curPos = start;
    long endOff = curPos + len;
    do {
      CephFileExtent extent = ceph.get_file_extent(fh, curPos);

      int[] osds = extent.getOSDs();
      String[] names = new String[osds.length];
      String[] hosts = new String[osds.length];
      String[] racks = new String[osds.length];

      for (int i = 0; i < osds.length; i++) {
        InetAddress addr = ceph.get_osd_address(osds[i]);
        names[i] = addr.getHostAddress();

        /*
         * Grab the hostname and rack from the crush hierarchy. Current we
         * hard code the item types. For a more general treatment, we'll need
         * a new configuration option that allows users to map their custom
         * crush types to hosts and topology.
         */
        Bucket[] path = ceph.get_osd_crush_location(osds[i]);
        for (Bucket bucket : path) {
          String type = bucket.getType();
          if (type.compareTo("host") == 0)
            hosts[i] = bucket.getName();
          else if (type.compareTo("rack") == 0)
            racks[i] = bucket.getName();
        }
      }

      blocks.add(new BlockLocation(names, hosts, racks,
            extent.getOffset(), extent.getLength()));

      curPos += extent.getLength();
    } while(curPos < endOff);

    ceph.close(fh);

    BlockLocation[] locations = new BlockLocation[blocks.size()];
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.