Tabnine Logo
PartitionPosition.compareTo
Code IndexAdd Tabnine to your IDE (free)

How to use
compareTo
method
in
org.apache.cassandra.db.PartitionPosition

Best Java code snippets using org.apache.cassandra.db.PartitionPosition.compareTo (Showing top 20 results out of 315)

origin: jsevellec/cassandra-unit

public int compareCustom(ByteBuffer o1, ByteBuffer o2)
{
  // o1 and o2 can be empty so we need to use PartitionPosition, not DecoratedKey
  return PartitionPosition.ForKey.get(o1, partitioner).compareTo(PartitionPosition.ForKey.get(o2, partitioner));
}
origin: com.strapdata.cassandra/cassandra-all

/**
 * Gets the position in the index file to start scanning to find the given key (at most indexInterval keys away,
 * modulo downsampling of the index summary). Always returns a {@code value >= 0}
 */
public long getIndexScanPosition(PartitionPosition key)
{
  if (openReason == OpenReason.MOVED_START && key.compareTo(first) < 0)
    key = first;
  return getIndexScanPositionFromBinarySearchResult(indexSummary.binarySearch(key), indexSummary);
}
origin: com.netflix.sstableadaptor/sstable-adaptor-cassandra

/**
 * Gets the position in the index file to start scanning to find the given key (at most indexInterval keys away,
 * modulo downsampling of the index summary). Always returns a {@code value >= 0}
 */
public long getIndexScanPosition(PartitionPosition key)
{
  if (openReason == OpenReason.MOVED_START && key.compareTo(first) < 0)
    key = first;
  return getIndexScanPositionFromBinarySearchResult(indexSummary.binarySearch(key), indexSummary);
}
origin: com.netflix.sstableadaptor/sstable-adaptor-cassandra

public int compareCustom(ByteBuffer o1, ByteBuffer o2)
{
  // o1 and o2 can be empty so we need to use PartitionPosition, not DecoratedKey
  return PartitionPosition.ForKey.get(o1, partitioner).compareTo(PartitionPosition.ForKey.get(o2, partitioner));
}
origin: org.apache.cassandra/cassandra-all

/**
 * Gets the position in the index file to start scanning to find the given key (at most indexInterval keys away,
 * modulo downsampling of the index summary). Always returns a {@code value >= 0}
 */
public long getIndexScanPosition(PartitionPosition key)
{
  if (openReason == OpenReason.MOVED_START && key.compareTo(first) < 0)
    key = first;
  return getIndexScanPositionFromBinarySearchResult(indexSummary.binarySearch(key), indexSummary);
}
origin: org.apache.cassandra/cassandra-all

public int compareCustom(ByteBuffer o1, ByteBuffer o2)
{
  // o1 and o2 can be empty so we need to use PartitionPosition, not DecoratedKey
  return PartitionPosition.ForKey.get(o1, partitioner).compareTo(PartitionPosition.ForKey.get(o2, partitioner));
}
origin: jsevellec/cassandra-unit

/**
 * Gets the position in the index file to start scanning to find the given key (at most indexInterval keys away,
 * modulo downsampling of the index summary). Always returns a {@code value >= 0}
 */
public long getIndexScanPosition(PartitionPosition key)
{
  if (openReason == OpenReason.MOVED_START && key.compareTo(first) < 0)
    key = first;
  return getIndexScanPositionFromBinarySearchResult(indexSummary.binarySearch(key), indexSummary);
}
origin: com.strapdata.cassandra/cassandra-all

public int compareCustom(ByteBuffer o1, ByteBuffer o2)
{
  // o1 and o2 can be empty so we need to use PartitionPosition, not DecoratedKey
  return PartitionPosition.ForKey.get(o1, partitioner).compareTo(PartitionPosition.ForKey.get(o2, partitioner));
}
origin: jsevellec/cassandra-unit

public static int compareTo(IPartitioner partitioner, ByteBuffer key, PartitionPosition position)
{
  // delegate to Token.KeyBound if needed
  if (!(position instanceof DecoratedKey))
    return -position.compareTo(partitioner.decorateKey(key));
  DecoratedKey otherKey = (DecoratedKey) position;
  int cmp = partitioner.getToken(key).compareTo(otherKey.getToken());
  return cmp == 0 ? ByteBufferUtil.compareUnsigned(key, otherKey.getKey()) : cmp;
}
origin: com.netflix.sstableadaptor/sstable-adaptor-cassandra

public static int compareTo(IPartitioner partitioner, ByteBuffer key, PartitionPosition position)
{
  // delegate to Token.KeyBound if needed
  if (!(position instanceof DecoratedKey))
    return -position.compareTo(partitioner.decorateKey(key));
  DecoratedKey otherKey = (DecoratedKey) position;
  int cmp = partitioner.getToken(key).compareTo(otherKey.getToken());
  return cmp == 0 ? ByteBufferUtil.compareUnsigned(key, otherKey.getKey()) : cmp;
}
origin: org.apache.cassandra/cassandra-all

public int compareTo(PartitionPosition pos)
{
  if (this == pos)
    return 0;
  // delegate to Token.KeyBound if needed
  if (!(pos instanceof DecoratedKey))
    return -pos.compareTo(this);
  DecoratedKey otherKey = (DecoratedKey) pos;
  int cmp = getToken().compareTo(otherKey.getToken());
  return cmp == 0 ? ByteBufferUtil.compareUnsigned(getKey(), otherKey.getKey()) : cmp;
}
origin: org.apache.cassandra/cassandra-all

public static int compareTo(IPartitioner partitioner, ByteBuffer key, PartitionPosition position)
{
  // delegate to Token.KeyBound if needed
  if (!(position instanceof DecoratedKey))
    return -position.compareTo(partitioner.decorateKey(key));
  DecoratedKey otherKey = (DecoratedKey) position;
  int cmp = partitioner.getToken(key).compareTo(otherKey.getToken());
  return cmp == 0 ? ByteBufferUtil.compareUnsigned(key, otherKey.getKey()) : cmp;
}
origin: jsevellec/cassandra-unit

public int compareTo(PartitionPosition pos)
{
  if (this == pos)
    return 0;
  // delegate to Token.KeyBound if needed
  if (!(pos instanceof DecoratedKey))
    return -pos.compareTo(this);
  DecoratedKey otherKey = (DecoratedKey) pos;
  int cmp = getToken().compareTo(otherKey.getToken());
  return cmp == 0 ? ByteBufferUtil.compareUnsigned(getKey(), otherKey.getKey()) : cmp;
}
origin: com.strapdata.cassandra/cassandra-all

public int compareTo(PartitionPosition pos)
{
  if (this == pos)
    return 0;
  // delegate to Token.KeyBound if needed
  if (!(pos instanceof DecoratedKey))
    return -pos.compareTo(this);
  DecoratedKey otherKey = (DecoratedKey) pos;
  int cmp = getToken().compareTo(otherKey.getToken());
  return cmp == 0 ? ByteBufferUtil.compareUnsigned(getKey(), otherKey.getKey()) : cmp;
}
origin: com.netflix.sstableadaptor/sstable-adaptor-cassandra

public int compareTo(PartitionPosition pos)
{
  if (this == pos)
    return 0;
  // delegate to Token.KeyBound if needed
  if (!(pos instanceof DecoratedKey))
    return -pos.compareTo(this);
  DecoratedKey otherKey = (DecoratedKey) pos;
  int cmp = getToken().compareTo(otherKey.getToken());
  return cmp == 0 ? ByteBufferUtil.compareUnsigned(getKey(), otherKey.getKey()) : cmp;
}
origin: com.strapdata.cassandra/cassandra-all

public static int compareTo(IPartitioner partitioner, ByteBuffer key, PartitionPosition position)
{
  // delegate to Token.KeyBound if needed
  if (!(position instanceof DecoratedKey))
    return -position.compareTo(partitioner.decorateKey(key));
  DecoratedKey otherKey = (DecoratedKey) position;
  int cmp = partitioner.getToken(key).compareTo(otherKey.getToken());
  return cmp == 0 ? ByteBufferUtil.compareUnsigned(key, otherKey.getKey()) : cmp;
}
origin: org.apache.cassandra/cassandra-all

  private Set<SSTableIndex> applyScope(Set<SSTableIndex> indexes)
  {
    return Sets.filter(indexes, index -> {
      SSTableReader sstable = index.getSSTable();
      return range.startKey().compareTo(sstable.last) <= 0 && (range.stopKey().isMinimum() || sstable.first.compareTo(range.stopKey()) <= 0);
    });
  }
}
origin: com.strapdata.cassandra/cassandra-all

  private Set<SSTableIndex> applyScope(Set<SSTableIndex> indexes)
  {
    return Sets.filter(indexes, index -> {
      SSTableReader sstable = index.getSSTable();
      return range.startKey().compareTo(sstable.last) <= 0 && (range.stopKey().isMinimum() || sstable.first.compareTo(range.stopKey()) <= 0);
    });
  }
}
origin: jsevellec/cassandra-unit

  private Set<SSTableIndex> applyScope(Set<SSTableIndex> indexes)
  {
    return Sets.filter(indexes, index -> {
      SSTableReader sstable = index.getSSTable();
      return range.startKey().compareTo(sstable.last) <= 0 && (range.stopKey().isMinimum() || sstable.first.compareTo(range.stopKey()) <= 0);
    });
  }
}
origin: jsevellec/cassandra-unit

private AbstractBounds<PartitionPosition> getPartitionKeyBounds(IPartitioner p,
                                QueryOptions options)
{
  // Deal with unrestricted partition key components (special-casing is required to deal with 2i queries on the
  // first component of a composite partition key) queries that filter on the partition key.
  if (partitionKeyRestrictions.needFiltering(cfm))
    return new Range<>(p.getMinimumToken().minKeyBound(), p.getMinimumToken().maxKeyBound());
  ByteBuffer startKeyBytes = getPartitionKeyBound(Bound.START, options);
  ByteBuffer finishKeyBytes = getPartitionKeyBound(Bound.END, options);
  PartitionPosition startKey = PartitionPosition.ForKey.get(startKeyBytes, p);
  PartitionPosition finishKey = PartitionPosition.ForKey.get(finishKeyBytes, p);
  if (startKey.compareTo(finishKey) > 0 && !finishKey.isMinimum())
    return null;
  if (partitionKeyRestrictions.isInclusive(Bound.START))
  {
    return partitionKeyRestrictions.isInclusive(Bound.END)
        ? new Bounds<>(startKey, finishKey)
        : new IncludingExcludingBounds<>(startKey, finishKey);
  }
  return partitionKeyRestrictions.isInclusive(Bound.END)
      ? new Range<>(startKey, finishKey)
      : new ExcludingBounds<>(startKey, finishKey);
}
org.apache.cassandra.dbPartitionPositioncompareTo

Popular methods of PartitionPosition

  • isMinimum
  • getToken
  • kind

Popular in Java

  • Running tasks concurrently on multiple threads
  • setContentView (Activity)
  • setRequestProperty (URLConnection)
  • runOnUiThread (Activity)
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • Reference (javax.naming)
  • JComboBox (javax.swing)
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now