Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / java / java / com / ceph / fs / CephFileExtent.java
1 /*
2  * Permission is hereby granted, free of charge, to any person obtaining a
3  * copy of this software and associated documentation files (the "Software"),
4  * to deal in the Software without restriction, including without limitation
5  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
6  * and/or sell copies of the Software, and to permit persons to whom the
7  * Software is furnished to do so, subject to the following conditions:
8  *
9  * The above copyright notice and this permission notice shall be included in
10  * all copies or substantial portions of the Software.
11  *
12  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
17  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18  * DEALINGS IN THE SOFTWARE.
19  */
20 package com.ceph.fs;
21
22 import java.util.Arrays;
23
24 /**
25  * Holds information about a file extent in CephFS.
26  */
27 public class CephFileExtent {
28   private long offset;
29   private long length;
30   private int[] osds;
31
32   CephFileExtent(long offset, long length, int[] osds) {
33     this.offset = offset;
34     this.length = length;
35     this.osds = osds;
36   }
37
38   /**
39    * Get starting offset of extent.
40    */
41   public long getOffset() {
42     return offset;
43   }
44
45   /**
46    * Get length of extent.
47    */
48   public long getLength() {
49     return length;
50   }
51
52   /**
53    * Get list of OSDs with this extent.
54    */
55   public int[] getOSDs() {
56     return osds;
57   }
58
59   /**
60    * Pretty print.
61    */
62   public String toString() {
63     return "extent[" + offset + "," + length + ","
64       + Arrays.toString(osds) + "]";
65   }
66 }