Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 package org.apache.hadoop.hbase.regionserver;
 
 
Stores the minimum and maximum timestamp values (both are inclusive). Can be used to find if any given time range overlaps with its time range MemStores use this class to track its minimum and maximum timestamps. When writing StoreFiles, this information is stored in meta blocks and used at read time to match against the required TimeRange.
 
 public class TimeRangeTracker implements Writable {
 
   long minimumTimestamp = -1;
   long maximumTimestamp = -1;

  
Default constructor. Initializes TimeRange to be null
 
   public TimeRangeTracker() {
 
   }

  
Copy Constructor

Parameters:
trt source TimeRangeTracker
 
   public TimeRangeTracker(final TimeRangeTracker trt) {
     this. = trt.getMinimumTimestamp();
     this. = trt.getMaximumTimestamp();
   }
 
   public TimeRangeTracker(long minimumTimestamplong maximumTimestamp) {
     this. = minimumTimestamp;
     this. = maximumTimestamp;
   }

  
Update the current TimestampRange to include the timestamp from KeyValue If the Key is of type DeleteColumn or DeleteFamily, it includes the entire time range from 0 to timestamp of the key.

Parameters:
kv the KeyValue to include
 
   public void includeTimestamp(final KeyValue kv) {
     if (kv.isDeleteColumnOrFamily()) {
       includeTimestamp(0);
     }
   }

  
Update the current TimestampRange to include the timestamp from Key. If the Key is of type DeleteColumn or DeleteFamily, it includes the entire time range from 0 to timestamp of the key.

Parameters:
key
 
   public void includeTimestamp(final byte[] key) {
     includeTimestamp(Bytes.toLong(key,key.length-.));
     int type = key[key.length - 1];
     if (type == ..getCode() ||
         type == ..getCode()) {
       includeTimestamp(0);
     }
   }

  
If required, update the current TimestampRange to include timestamp

Parameters:
timestamp the timestamp value to include
 
   private synchronized void includeTimestamp(final long timestamp) {
    if ( == -1) {
       = timestamp;
       = timestamp;
    }
    else if ( > timestamp) {
       = timestamp;
    }
    else if ( < timestamp) {
       = timestamp;
    }
    return;
  }

  
Check if the range has any overlap with TimeRange

Parameters:
tr TimeRange
Returns:
True if there is overlap, false otherwise
  public synchronized boolean includesTimeRange(final TimeRange tr) {
    return (this. < tr.getMax() &&
        this. >= tr.getMin());
  }

  

Returns:
the minimumTimestamp
  public synchronized long getMinimumTimestamp() {
    return ;
  }

  

Returns:
the maximumTimestamp
  public synchronized long getMaximumTimestamp() {
    return ;
  }
  public synchronized void write(final DataOutput outthrows IOException {
  }
  public synchronized void readFields(final DataInput inthrows IOException {
    this. = in.readLong();
    this. = in.readLong();
  }
  public synchronized String toString() {
    return "[" +  + "," +  + "]";
  }
New to GrepCode? Check out our FAQ X