View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  package org.apache.hadoop.hbase.codec.prefixtree;
20  
21  import java.io.IOException;
22  import java.io.InputStream;
23  import java.io.OutputStream;
24  
25  import org.apache.hadoop.hbase.classification.InterfaceAudience;
26  import org.apache.hadoop.hbase.codec.prefixtree.encode.other.LongEncoder;
27  import org.apache.hadoop.hbase.nio.ByteBuff;
28  import org.apache.hadoop.hbase.util.Bytes;
29  import org.apache.hadoop.hbase.util.vint.UVIntTool;
30  import org.apache.hadoop.hbase.util.vint.UVLongTool;
31  
32  /**
33   * Information about the block.  Stored at the beginning of the byte[].  Contains things
34   * like minimum timestamp and width of FInts in the row tree.
35   *
36   * Most fields stored in VInts that get decoded on the first access of each new block.
37   */
38  @InterfaceAudience.Private
39  public class PrefixTreeBlockMeta {
40  
41    /******************* static fields ********************/
42  
43    public static final int VERSION = 0;
44  
45    public static final int MAX_FAMILY_LENGTH = Byte.MAX_VALUE;// hard-coded in KeyValue
46  
47    public static final int
48      NUM_LONGS = 2,
49      NUM_INTS = 28,
50      NUM_SHORTS = 0,//keyValueTypeWidth not persisted
51      NUM_SINGLE_BYTES = 2,
52      MAX_BYTES = Bytes.SIZEOF_LONG * NUM_LONGS
53          + Bytes.SIZEOF_SHORT * NUM_SHORTS
54          + Bytes.SIZEOF_INT * NUM_INTS
55          + NUM_SINGLE_BYTES;
56  
57  
58    /**************** transient fields *********************/
59    protected int bufferOffset;
60  
61  
62    /**************** persisted fields **********************/
63  
64    // PrefixTree version to allow future format modifications
65    protected int version;
66    protected int numMetaBytes;
67    protected int numKeyValueBytes;
68    protected boolean includesMvccVersion;//probably don't need this explicitly, but only 1 byte
69  
70    // split the byte[] into 6 sections for the different data types
71    protected int numRowBytes;
72    protected int numFamilyBytes;
73    protected int numQualifierBytes;
74    protected int numTimestampBytes;
75    protected int numMvccVersionBytes;
76    protected int numValueBytes;
77    protected int numTagsBytes;
78  
79    // number of bytes in each section of fixed width FInts
80    protected int nextNodeOffsetWidth;
81    protected int familyOffsetWidth;
82    protected int qualifierOffsetWidth;
83    protected int timestampIndexWidth;
84    protected int mvccVersionIndexWidth;
85    protected int valueOffsetWidth;
86    protected int valueLengthWidth;
87    protected int tagsOffsetWidth;
88  
89    // used to pre-allocate structures for reading
90    protected int rowTreeDepth;
91    protected int maxRowLength;
92    protected int maxQualifierLength;
93    protected int maxTagsLength;
94  
95    // the timestamp from which the deltas are calculated
96    protected long minTimestamp;
97    protected int timestampDeltaWidth;
98    protected long minMvccVersion;
99    protected int mvccVersionDeltaWidth;
100 
101   protected boolean allSameType;
102   protected byte allTypes;
103 
104   protected int numUniqueRows;
105   protected int numUniqueFamilies;
106   protected int numUniqueQualifiers;
107   protected int numUniqueTags;
108 
109 
110   /***************** constructors ********************/
111 
112   public PrefixTreeBlockMeta() {
113   }
114 
115   public PrefixTreeBlockMeta(InputStream is) throws IOException{
116     this.version = VERSION;
117     this.bufferOffset = 0;
118     readVariableBytesFromInputStream(is);
119   }
120 
121   /**
122    * @param buffer positioned at start of PtBlockMeta
123    */
124   public PrefixTreeBlockMeta(ByteBuff buffer) {
125     initOnBlock(buffer);
126   }
127 
128   public void initOnBlock(ByteBuff buffer) {
129     bufferOffset = buffer.position();
130     readVariableBytesFromBuffer(buffer, bufferOffset);
131   }
132 
133 
134   /**************** operate on each field **********************/
135 
136   public int calculateNumMetaBytes(){
137     int numBytes = 0;
138     numBytes += UVIntTool.numBytes(version);
139     numBytes += UVLongTool.numBytes(numMetaBytes);
140     numBytes += UVIntTool.numBytes(numKeyValueBytes);
141     ++numBytes;//os.write(getIncludesMvccVersion());
142 
143     numBytes += UVIntTool.numBytes(numRowBytes);
144     numBytes += UVIntTool.numBytes(numFamilyBytes);
145     numBytes += UVIntTool.numBytes(numQualifierBytes);
146     numBytes += UVIntTool.numBytes(numTagsBytes);
147     numBytes += UVIntTool.numBytes(numTimestampBytes);
148     numBytes += UVIntTool.numBytes(numMvccVersionBytes);
149     numBytes += UVIntTool.numBytes(numValueBytes);
150 
151     numBytes += UVIntTool.numBytes(nextNodeOffsetWidth);
152     numBytes += UVIntTool.numBytes(familyOffsetWidth);
153     numBytes += UVIntTool.numBytes(qualifierOffsetWidth);
154     numBytes += UVIntTool.numBytes(tagsOffsetWidth);
155     numBytes += UVIntTool.numBytes(timestampIndexWidth);
156     numBytes += UVIntTool.numBytes(mvccVersionIndexWidth);
157     numBytes += UVIntTool.numBytes(valueOffsetWidth);
158     numBytes += UVIntTool.numBytes(valueLengthWidth);
159 
160     numBytes += UVIntTool.numBytes(rowTreeDepth);
161     numBytes += UVIntTool.numBytes(maxRowLength);
162     numBytes += UVIntTool.numBytes(maxQualifierLength);
163     numBytes += UVIntTool.numBytes(maxTagsLength);
164 
165     numBytes += UVLongTool.numBytes(minTimestamp);
166     numBytes += UVIntTool.numBytes(timestampDeltaWidth);
167     numBytes += UVLongTool.numBytes(minMvccVersion);
168     numBytes += UVIntTool.numBytes(mvccVersionDeltaWidth);
169     ++numBytes;//os.write(getAllSameTypeByte());
170     ++numBytes;//os.write(allTypes);
171 
172     numBytes += UVIntTool.numBytes(numUniqueRows);
173     numBytes += UVIntTool.numBytes(numUniqueFamilies);
174     numBytes += UVIntTool.numBytes(numUniqueQualifiers);
175     numBytes += UVIntTool.numBytes(numUniqueTags);
176     return numBytes;
177   }
178 
179   public void writeVariableBytesToOutputStream(OutputStream os) throws IOException{
180       UVIntTool.writeBytes(version, os);
181       UVIntTool.writeBytes(numMetaBytes, os);
182       UVIntTool.writeBytes(numKeyValueBytes, os);
183       os.write(getIncludesMvccVersionByte());
184 
185       UVIntTool.writeBytes(numRowBytes, os);
186       UVIntTool.writeBytes(numFamilyBytes, os);
187       UVIntTool.writeBytes(numQualifierBytes, os);
188       UVIntTool.writeBytes(numTagsBytes, os);
189       UVIntTool.writeBytes(numTimestampBytes, os);
190       UVIntTool.writeBytes(numMvccVersionBytes, os);
191       UVIntTool.writeBytes(numValueBytes, os);
192 
193       UVIntTool.writeBytes(nextNodeOffsetWidth, os);
194       UVIntTool.writeBytes(familyOffsetWidth, os);
195       UVIntTool.writeBytes(qualifierOffsetWidth, os);
196       UVIntTool.writeBytes(tagsOffsetWidth, os);
197       UVIntTool.writeBytes(timestampIndexWidth, os);
198       UVIntTool.writeBytes(mvccVersionIndexWidth, os);
199       UVIntTool.writeBytes(valueOffsetWidth, os);
200       UVIntTool.writeBytes(valueLengthWidth, os);
201 
202       UVIntTool.writeBytes(rowTreeDepth, os);
203       UVIntTool.writeBytes(maxRowLength, os);
204       UVIntTool.writeBytes(maxQualifierLength, os);
205       UVIntTool.writeBytes(maxTagsLength, os);
206 
207       UVLongTool.writeBytes(minTimestamp, os);
208       UVIntTool.writeBytes(timestampDeltaWidth, os);
209       UVLongTool.writeBytes(minMvccVersion, os);
210       UVIntTool.writeBytes(mvccVersionDeltaWidth, os);
211       os.write(getAllSameTypeByte());
212       os.write(allTypes);
213 
214       UVIntTool.writeBytes(numUniqueRows, os);
215       UVIntTool.writeBytes(numUniqueFamilies, os);
216       UVIntTool.writeBytes(numUniqueQualifiers, os);
217       UVIntTool.writeBytes(numUniqueTags, os);
218   }
219 
220   public void readVariableBytesFromInputStream(InputStream is) throws IOException{
221       version = UVIntTool.getInt(is);
222       numMetaBytes = UVIntTool.getInt(is);
223       numKeyValueBytes = UVIntTool.getInt(is);
224       setIncludesMvccVersion((byte) is.read());
225 
226       numRowBytes = UVIntTool.getInt(is);
227       numFamilyBytes = UVIntTool.getInt(is);
228       numQualifierBytes = UVIntTool.getInt(is);
229       numTagsBytes = UVIntTool.getInt(is);
230       numTimestampBytes = UVIntTool.getInt(is);
231       numMvccVersionBytes = UVIntTool.getInt(is);
232       numValueBytes = UVIntTool.getInt(is);
233 
234       nextNodeOffsetWidth = UVIntTool.getInt(is);
235       familyOffsetWidth = UVIntTool.getInt(is);
236       qualifierOffsetWidth = UVIntTool.getInt(is);
237       tagsOffsetWidth = UVIntTool.getInt(is);
238       timestampIndexWidth = UVIntTool.getInt(is);
239       mvccVersionIndexWidth = UVIntTool.getInt(is);
240       valueOffsetWidth = UVIntTool.getInt(is);
241       valueLengthWidth = UVIntTool.getInt(is);
242 
243       rowTreeDepth = UVIntTool.getInt(is);
244       maxRowLength = UVIntTool.getInt(is);
245       maxQualifierLength = UVIntTool.getInt(is);
246       maxTagsLength = UVIntTool.getInt(is);
247 
248       minTimestamp = UVLongTool.getLong(is);
249       timestampDeltaWidth = UVIntTool.getInt(is);
250       minMvccVersion = UVLongTool.getLong(is);
251       mvccVersionDeltaWidth = UVIntTool.getInt(is);
252 
253       setAllSameType((byte) is.read());
254       allTypes = (byte) is.read();
255 
256       numUniqueRows = UVIntTool.getInt(is);
257       numUniqueFamilies = UVIntTool.getInt(is);
258       numUniqueQualifiers = UVIntTool.getInt(is);
259       numUniqueTags = UVIntTool.getInt(is);
260   }
261 
262   public void readVariableBytesFromBuffer(ByteBuff buf, int offset) {
263     int position = offset;
264 
265     version = UVIntTool.getInt(buf, position);
266     position += UVIntTool.numBytes(version);
267     numMetaBytes = UVIntTool.getInt(buf, position);
268     position += UVIntTool.numBytes(numMetaBytes);
269     numKeyValueBytes = UVIntTool.getInt(buf, position);
270     position += UVIntTool.numBytes(numKeyValueBytes);
271     setIncludesMvccVersion(buf.get(position));
272     ++position;
273 
274     numRowBytes = UVIntTool.getInt(buf, position);
275     position += UVIntTool.numBytes(numRowBytes);
276     numFamilyBytes = UVIntTool.getInt(buf, position);
277     position += UVIntTool.numBytes(numFamilyBytes);
278     numQualifierBytes = UVIntTool.getInt(buf, position);
279     position += UVIntTool.numBytes(numQualifierBytes);
280     numTagsBytes = UVIntTool.getInt(buf, position);
281     position += UVIntTool.numBytes(numTagsBytes);
282     numTimestampBytes = UVIntTool.getInt(buf, position);
283     position += UVIntTool.numBytes(numTimestampBytes);
284     numMvccVersionBytes = UVIntTool.getInt(buf, position);
285     position += UVIntTool.numBytes(numMvccVersionBytes);
286     numValueBytes = UVIntTool.getInt(buf, position);
287     position += UVIntTool.numBytes(numValueBytes);
288 
289     nextNodeOffsetWidth = UVIntTool.getInt(buf, position);
290     position += UVIntTool.numBytes(nextNodeOffsetWidth);
291     familyOffsetWidth = UVIntTool.getInt(buf, position);
292     position += UVIntTool.numBytes(familyOffsetWidth);
293     qualifierOffsetWidth = UVIntTool.getInt(buf, position);
294     position += UVIntTool.numBytes(qualifierOffsetWidth);
295     tagsOffsetWidth = UVIntTool.getInt(buf, position);
296     position += UVIntTool.numBytes(tagsOffsetWidth);
297     timestampIndexWidth = UVIntTool.getInt(buf, position);
298     position += UVIntTool.numBytes(timestampIndexWidth);
299     mvccVersionIndexWidth = UVIntTool.getInt(buf, position);
300     position += UVIntTool.numBytes(mvccVersionIndexWidth);
301     valueOffsetWidth = UVIntTool.getInt(buf, position);
302     position += UVIntTool.numBytes(valueOffsetWidth);
303     valueLengthWidth = UVIntTool.getInt(buf, position);
304     position += UVIntTool.numBytes(valueLengthWidth);
305 
306     rowTreeDepth = UVIntTool.getInt(buf, position);
307     position += UVIntTool.numBytes(rowTreeDepth);
308     maxRowLength = UVIntTool.getInt(buf, position);
309     position += UVIntTool.numBytes(maxRowLength);
310     maxQualifierLength = UVIntTool.getInt(buf, position);
311     position += UVIntTool.numBytes(maxQualifierLength);
312     maxTagsLength = UVIntTool.getInt(buf, position);
313     position += UVIntTool.numBytes(maxTagsLength);
314     minTimestamp = UVLongTool.getLong(buf, position);
315     position += UVLongTool.numBytes(minTimestamp);
316     timestampDeltaWidth = UVIntTool.getInt(buf, position);
317     position += UVIntTool.numBytes(timestampDeltaWidth);
318     minMvccVersion = UVLongTool.getLong(buf, position);
319     position += UVLongTool.numBytes(minMvccVersion);
320     mvccVersionDeltaWidth = UVIntTool.getInt(buf, position);
321     position += UVIntTool.numBytes(mvccVersionDeltaWidth);
322 
323     setAllSameType(buf.get(position));
324     ++position;
325     allTypes =  buf.get(position);
326     ++position;
327 
328     numUniqueRows = UVIntTool.getInt(buf, position);
329     position += UVIntTool.numBytes(numUniqueRows);
330     numUniqueFamilies = UVIntTool.getInt(buf, position);
331     position += UVIntTool.numBytes(numUniqueFamilies);
332     numUniqueQualifiers = UVIntTool.getInt(buf, position);
333     position += UVIntTool.numBytes(numUniqueQualifiers);
334     numUniqueTags = UVIntTool.getInt(buf, position);
335     position += UVIntTool.numBytes(numUniqueTags);
336   }
337 
338   //TODO method that can read directly from ByteBuffer instead of InputStream
339 
340 
341   /*************** methods *************************/
342 
343   public int getKeyValueTypeWidth() {
344     return allSameType ? 0 : 1;
345   }
346 
347   public byte getIncludesMvccVersionByte() {
348     return includesMvccVersion ? (byte) 1 : (byte) 0;
349   }
350 
351   public void setIncludesMvccVersion(byte includesMvccVersionByte) {
352     includesMvccVersion = includesMvccVersionByte != 0;
353   }
354 
355   public byte getAllSameTypeByte() {
356     return allSameType ? (byte) 1 : (byte) 0;
357   }
358 
359   public void setAllSameType(byte allSameTypeByte) {
360     allSameType = allSameTypeByte != 0;
361   }
362 
363   public boolean isAllSameTimestamp() {
364     return timestampIndexWidth == 0;
365   }
366 
367   public boolean isAllSameMvccVersion() {
368     return mvccVersionIndexWidth == 0;
369   }
370 
371   public void setTimestampFields(LongEncoder encoder){
372     this.minTimestamp = encoder.getMin();
373     this.timestampIndexWidth = encoder.getBytesPerIndex();
374     this.timestampDeltaWidth = encoder.getBytesPerDelta();
375     this.numTimestampBytes = encoder.getTotalCompressedBytes();
376   }
377 
378   public void setMvccVersionFields(LongEncoder encoder){
379     this.minMvccVersion = encoder.getMin();
380     this.mvccVersionIndexWidth = encoder.getBytesPerIndex();
381     this.mvccVersionDeltaWidth = encoder.getBytesPerDelta();
382     this.numMvccVersionBytes = encoder.getTotalCompressedBytes();
383   }
384 
385 
386   /*************** Object methods *************************/
387 
388   /**
389    * Generated by Eclipse
390    */
391   @Override
392   public boolean equals(Object obj) {
393     if (this == obj)
394       return true;
395     if (obj == null)
396       return false;
397     if (getClass() != obj.getClass())
398       return false;
399     PrefixTreeBlockMeta other = (PrefixTreeBlockMeta) obj;
400     if (allSameType != other.allSameType)
401       return false;
402     if (allTypes != other.allTypes)
403       return false;
404     if (bufferOffset != other.bufferOffset)
405       return false;
406     if (valueLengthWidth != other.valueLengthWidth)
407       return false;
408     if (valueOffsetWidth != other.valueOffsetWidth)
409       return false;
410     if (familyOffsetWidth != other.familyOffsetWidth)
411       return false;
412     if (includesMvccVersion != other.includesMvccVersion)
413       return false;
414     if (maxQualifierLength != other.maxQualifierLength)
415       return false;
416     if (maxTagsLength != other.maxTagsLength)
417       return false;
418     if (maxRowLength != other.maxRowLength)
419       return false;
420     if (mvccVersionDeltaWidth != other.mvccVersionDeltaWidth)
421       return false;
422     if (mvccVersionIndexWidth != other.mvccVersionIndexWidth)
423       return false;
424     if (minMvccVersion != other.minMvccVersion)
425       return false;
426     if (minTimestamp != other.minTimestamp)
427       return false;
428     if (nextNodeOffsetWidth != other.nextNodeOffsetWidth)
429       return false;
430     if (numValueBytes != other.numValueBytes)
431       return false;
432     if (numFamilyBytes != other.numFamilyBytes)
433       return false;
434     if (numMvccVersionBytes != other.numMvccVersionBytes)
435       return false;
436     if (numMetaBytes != other.numMetaBytes)
437       return false;
438     if (numQualifierBytes != other.numQualifierBytes)
439       return false;
440     if (numTagsBytes != other.numTagsBytes)
441       return false;
442     if (numRowBytes != other.numRowBytes)
443       return false;
444     if (numTimestampBytes != other.numTimestampBytes)
445       return false;
446     if (numUniqueFamilies != other.numUniqueFamilies)
447       return false;
448     if (numUniqueQualifiers != other.numUniqueQualifiers)
449       return false;
450     if (numUniqueTags != other.numUniqueTags)
451       return false;
452     if (numUniqueRows != other.numUniqueRows)
453       return false;
454     if (numKeyValueBytes != other.numKeyValueBytes)
455       return false;
456     if (qualifierOffsetWidth != other.qualifierOffsetWidth)
457       return false;
458     if(tagsOffsetWidth !=  other.tagsOffsetWidth) 
459       return false;
460     if (rowTreeDepth != other.rowTreeDepth)
461       return false;
462     if (timestampDeltaWidth != other.timestampDeltaWidth)
463       return false;
464     if (timestampIndexWidth != other.timestampIndexWidth)
465       return false;
466     if (version != other.version)
467       return false;
468     return true;
469   }
470 
471   /**
472    * Generated by Eclipse
473    */
474   @Override
475   public int hashCode() {
476     final int prime = 31;
477     int result = 1;
478     result = prime * result + (allSameType ? 1231 : 1237);
479     result = prime * result + allTypes;
480     result = prime * result + bufferOffset;
481     result = prime * result + valueLengthWidth;
482     result = prime * result + valueOffsetWidth;
483     result = prime * result + familyOffsetWidth;
484     result = prime * result + (includesMvccVersion ? 1231 : 1237);
485     result = prime * result + maxQualifierLength;
486     result = prime * result + maxTagsLength;
487     result = prime * result + maxRowLength;
488     result = prime * result + mvccVersionDeltaWidth;
489     result = prime * result + mvccVersionIndexWidth;
490     result = prime * result + (int) (minMvccVersion ^ (minMvccVersion >>> 32));
491     result = prime * result + (int) (minTimestamp ^ (minTimestamp >>> 32));
492     result = prime * result + nextNodeOffsetWidth;
493     result = prime * result + numValueBytes;
494     result = prime * result + numFamilyBytes;
495     result = prime * result + numMvccVersionBytes;
496     result = prime * result + numMetaBytes;
497     result = prime * result + numQualifierBytes;
498     result = prime * result + numTagsBytes;
499     result = prime * result + numRowBytes;
500     result = prime * result + numTimestampBytes;
501     result = prime * result + numUniqueFamilies;
502     result = prime * result + numUniqueQualifiers;
503     result = prime * result + numUniqueTags;
504     result = prime * result + numUniqueRows;
505     result = prime * result + numKeyValueBytes;
506     result = prime * result + qualifierOffsetWidth;
507     result = prime * result + tagsOffsetWidth;
508     result = prime * result + rowTreeDepth;
509     result = prime * result + timestampDeltaWidth;
510     result = prime * result + timestampIndexWidth;
511     result = prime * result + version;
512     return result;
513   }
514 
515   /**
516    * Generated by Eclipse
517    */
518   @Override
519   public String toString() {
520     StringBuilder builder = new StringBuilder();
521     builder.append("PtBlockMeta [bufferOffset=");
522     builder.append(bufferOffset);
523     builder.append(", version=");
524     builder.append(version);
525     builder.append(", numMetaBytes=");
526     builder.append(numMetaBytes);
527     builder.append(", numKeyValueBytes=");
528     builder.append(numKeyValueBytes);
529     builder.append(", includesMvccVersion=");
530     builder.append(includesMvccVersion);
531     builder.append(", numRowBytes=");
532     builder.append(numRowBytes);
533     builder.append(", numFamilyBytes=");
534     builder.append(numFamilyBytes);
535     builder.append(", numQualifierBytes=");
536     builder.append(numQualifierBytes);
537     builder.append(", numTimestampBytes=");
538     builder.append(numTimestampBytes);
539     builder.append(", numMvccVersionBytes=");
540     builder.append(numMvccVersionBytes);
541     builder.append(", numValueBytes=");
542     builder.append(numValueBytes);
543     builder.append(", numTagBytes=");
544     builder.append(numTagsBytes);
545     builder.append(", nextNodeOffsetWidth=");
546     builder.append(nextNodeOffsetWidth);
547     builder.append(", familyOffsetWidth=");
548     builder.append(familyOffsetWidth);
549     builder.append(", qualifierOffsetWidth=");
550     builder.append(qualifierOffsetWidth);
551     builder.append(", tagOffsetWidth=");
552     builder.append(tagsOffsetWidth);
553     builder.append(", timestampIndexWidth=");
554     builder.append(timestampIndexWidth);
555     builder.append(", mvccVersionIndexWidth=");
556     builder.append(mvccVersionIndexWidth);
557     builder.append(", valueOffsetWidth=");
558     builder.append(valueOffsetWidth);
559     builder.append(", valueLengthWidth=");
560     builder.append(valueLengthWidth);
561     builder.append(", rowTreeDepth=");
562     builder.append(rowTreeDepth);
563     builder.append(", maxRowLength=");
564     builder.append(maxRowLength);
565     builder.append(", maxQualifierLength=");
566     builder.append(maxQualifierLength);
567     builder.append(", maxTagLength=");
568     builder.append(maxTagsLength);
569     builder.append(", minTimestamp=");
570     builder.append(minTimestamp);
571     builder.append(", timestampDeltaWidth=");
572     builder.append(timestampDeltaWidth);
573     builder.append(", minMvccVersion=");
574     builder.append(minMvccVersion);
575     builder.append(", mvccVersionDeltaWidth=");
576     builder.append(mvccVersionDeltaWidth);
577     builder.append(", allSameType=");
578     builder.append(allSameType);
579     builder.append(", allTypes=");
580     builder.append(allTypes);
581     builder.append(", numUniqueRows=");
582     builder.append(numUniqueRows);
583     builder.append(", numUniqueFamilies=");
584     builder.append(numUniqueFamilies);
585     builder.append(", numUniqueQualifiers=");
586     builder.append(numUniqueQualifiers);
587     builder.append(", numUniqueTags=");
588     builder.append(numUniqueTags);
589     builder.append("]");
590     return builder.toString();
591   }
592 
593 
594   /************** absolute getters *******************/
595 
596   public int getAbsoluteRowOffset() {
597     return getBufferOffset() + numMetaBytes;
598   }
599 
600   public int getAbsoluteFamilyOffset() {
601     return getAbsoluteRowOffset() + numRowBytes;
602   }
603 
604   public int getAbsoluteQualifierOffset() {
605     return getAbsoluteFamilyOffset() + numFamilyBytes;
606   }
607 
608   public int getAbsoluteTagsOffset() {
609     return getAbsoluteQualifierOffset() + numQualifierBytes;
610   }
611 
612   public int getAbsoluteTimestampOffset() {
613     return getAbsoluteTagsOffset() + numTagsBytes;
614   }
615 
616   public int getAbsoluteMvccVersionOffset() {
617     return getAbsoluteTimestampOffset() + numTimestampBytes;
618   }
619 
620   public int getAbsoluteValueOffset() {
621     return getAbsoluteMvccVersionOffset() + numMvccVersionBytes;
622   }
623 
624 
625   /*************** get/set ***************************/
626 
627   public int getTimestampDeltaWidth() {
628     return timestampDeltaWidth;
629   }
630 
631   public void setTimestampDeltaWidth(int timestampDeltaWidth) {
632     this.timestampDeltaWidth = timestampDeltaWidth;
633   }
634 
635   public int getValueOffsetWidth() {
636     return valueOffsetWidth;
637   }
638 
639   public int getTagsOffsetWidth() {
640     return tagsOffsetWidth;
641   }
642 
643   public void setValueOffsetWidth(int dataOffsetWidth) {
644     this.valueOffsetWidth = dataOffsetWidth;
645   }
646 
647   public void setTagsOffsetWidth(int dataOffsetWidth) {
648     this.tagsOffsetWidth = dataOffsetWidth;
649   }
650 
651   public int getValueLengthWidth() {
652     return valueLengthWidth;
653   }
654 
655   public void setValueLengthWidth(int dataLengthWidth) {
656     this.valueLengthWidth = dataLengthWidth;
657   }
658 
659   public int getMaxRowLength() {
660     return maxRowLength;
661   }
662 
663   public void setMaxRowLength(int maxRowLength) {
664     this.maxRowLength = maxRowLength;
665   }
666 
667   public long getMinTimestamp() {
668     return minTimestamp;
669   }
670 
671   public void setMinTimestamp(long minTimestamp) {
672     this.minTimestamp = minTimestamp;
673   }
674 
675   public byte getAllTypes() {
676     return allTypes;
677   }
678 
679   public void setAllTypes(byte allTypes) {
680     this.allTypes = allTypes;
681   }
682 
683   public boolean isAllSameType() {
684     return allSameType;
685   }
686 
687   public void setAllSameType(boolean allSameType) {
688     this.allSameType = allSameType;
689   }
690 
691   public int getNextNodeOffsetWidth() {
692     return nextNodeOffsetWidth;
693   }
694 
695   public void setNextNodeOffsetWidth(int nextNodeOffsetWidth) {
696     this.nextNodeOffsetWidth = nextNodeOffsetWidth;
697   }
698 
699   public int getNumRowBytes() {
700     return numRowBytes;
701   }
702 
703   public void setNumRowBytes(int numRowBytes) {
704     this.numRowBytes = numRowBytes;
705   }
706 
707   public int getNumTimestampBytes() {
708     return numTimestampBytes;
709   }
710 
711   public void setNumTimestampBytes(int numTimestampBytes) {
712     this.numTimestampBytes = numTimestampBytes;
713   }
714 
715   public int getNumValueBytes() {
716     return numValueBytes;
717   }
718 
719   public int getNumTagsBytes() {
720     return numTagsBytes;
721   }
722 
723   public void setNumTagsBytes(int numTagBytes){
724     this.numTagsBytes = numTagBytes;
725   }
726 
727   public void setNumValueBytes(int numValueBytes) {
728     this.numValueBytes = numValueBytes;
729   }
730 
731   public int getNumMetaBytes() {
732     return numMetaBytes;
733   }
734 
735   public void setNumMetaBytes(int numMetaBytes) {
736     this.numMetaBytes = numMetaBytes;
737   }
738 
739   public int getBufferOffset() {
740     return bufferOffset;
741   }
742 
743   public void setBufferOffset(int bufferOffset) {
744     this.bufferOffset = bufferOffset;
745   }
746 
747   public int getNumKeyValueBytes() {
748     return numKeyValueBytes;
749   }
750 
751   public void setNumKeyValueBytes(int numKeyValueBytes) {
752     this.numKeyValueBytes = numKeyValueBytes;
753   }
754 
755   public int getRowTreeDepth() {
756     return rowTreeDepth;
757   }
758 
759   public void setRowTreeDepth(int rowTreeDepth) {
760     this.rowTreeDepth = rowTreeDepth;
761   }
762 
763   public int getNumMvccVersionBytes() {
764     return numMvccVersionBytes;
765   }
766 
767   public void setNumMvccVersionBytes(int numMvccVersionBytes) {
768     this.numMvccVersionBytes = numMvccVersionBytes;
769   }
770 
771   public int getMvccVersionDeltaWidth() {
772     return mvccVersionDeltaWidth;
773   }
774 
775   public void setMvccVersionDeltaWidth(int mvccVersionDeltaWidth) {
776     this.mvccVersionDeltaWidth = mvccVersionDeltaWidth;
777   }
778 
779   public long getMinMvccVersion() {
780     return minMvccVersion;
781   }
782 
783   public void setMinMvccVersion(long minMvccVersion) {
784     this.minMvccVersion = minMvccVersion;
785   }
786 
787   public int getNumFamilyBytes() {
788     return numFamilyBytes;
789   }
790 
791   public void setNumFamilyBytes(int numFamilyBytes) {
792     this.numFamilyBytes = numFamilyBytes;
793   }
794 
795   public int getFamilyOffsetWidth() {
796     return familyOffsetWidth;
797   }
798 
799   public void setFamilyOffsetWidth(int familyOffsetWidth) {
800     this.familyOffsetWidth = familyOffsetWidth;
801   }
802 
803   public int getNumUniqueRows() {
804     return numUniqueRows;
805   }
806 
807   public void setNumUniqueRows(int numUniqueRows) {
808     this.numUniqueRows = numUniqueRows;
809   }
810 
811   public int getNumUniqueFamilies() {
812     return numUniqueFamilies;
813   }
814 
815   public void setNumUniqueFamilies(int numUniqueFamilies) {
816     this.numUniqueFamilies = numUniqueFamilies;
817   }
818 
819   public int getNumUniqueQualifiers() {
820     return numUniqueQualifiers;
821   }
822 
823   public void setNumUniqueQualifiers(int numUniqueQualifiers) {
824     this.numUniqueQualifiers = numUniqueQualifiers;
825   }
826 
827   public void setNumUniqueTags(int numUniqueTags) {
828     this.numUniqueTags = numUniqueTags;
829   }
830 
831   public int getNumUniqueTags() {
832     return numUniqueTags;
833   }
834   public int getNumQualifierBytes() {
835     return numQualifierBytes;
836   }
837 
838   public void setNumQualifierBytes(int numQualifierBytes) {
839     this.numQualifierBytes = numQualifierBytes;
840   }
841 
842   public int getQualifierOffsetWidth() {
843     return qualifierOffsetWidth;
844   }
845 
846   public void setQualifierOffsetWidth(int qualifierOffsetWidth) {
847     this.qualifierOffsetWidth = qualifierOffsetWidth;
848   }
849 
850   public int getMaxQualifierLength() {
851     return maxQualifierLength;
852   }
853 
854   // TODO : decide on some max value for this ? INTEGER_MAX?
855   public void setMaxQualifierLength(int maxQualifierLength) {
856     this.maxQualifierLength = maxQualifierLength;
857   }
858 
859   public int getMaxTagsLength() {
860     return this.maxTagsLength;
861   }
862 
863   public void setMaxTagsLength(int maxTagLength) {
864     this.maxTagsLength = maxTagLength;
865   }
866 
867   public int getTimestampIndexWidth() {
868     return timestampIndexWidth;
869   }
870 
871   public void setTimestampIndexWidth(int timestampIndexWidth) {
872     this.timestampIndexWidth = timestampIndexWidth;
873   }
874 
875   public int getMvccVersionIndexWidth() {
876     return mvccVersionIndexWidth;
877   }
878 
879   public void setMvccVersionIndexWidth(int mvccVersionIndexWidth) {
880     this.mvccVersionIndexWidth = mvccVersionIndexWidth;
881   }
882 
883   public int getVersion() {
884     return version;
885   }
886 
887   public void setVersion(int version) {
888     this.version = version;
889   }
890 
891   public boolean isIncludesMvccVersion() {
892     return includesMvccVersion;
893   }
894 
895   public void setIncludesMvccVersion(boolean includesMvccVersion) {
896     this.includesMvccVersion = includesMvccVersion;
897   }
898 
899 }