Java Code Examples for org.apache.cassandra.db.DecoratedKey#comparator()

The following examples show how to use org.apache.cassandra.db.DecoratedKey#comparator() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SkipListMemIndex.java    From sasi with Apache License 2.0 6 votes vote down vote up
@Override
public void add(ByteBuffer value, ByteBuffer key)
{
    final DecoratedKey dk = StorageService.getPartitioner().decorateKey(key);
    ConcurrentSkipListSet<DecoratedKey> keys = index.get(value);

    if (keys == null)
    {
        ConcurrentSkipListSet<DecoratedKey> newKeys = new ConcurrentSkipListSet<>(DecoratedKey.comparator);
        keys = index.putIfAbsent(value, newKeys);
        if (keys == null)
            keys = newKeys;
    }

    keys.add(dk);
}
 
Example 2
Source File: TrieMemIndex.java    From sasi with Apache License 2.0 5 votes vote down vote up
public void add(String value, DecoratedKey key)
{
    ConcurrentSkipListSet<DecoratedKey> keys = get(value);
    if (keys == null)
    {
        ConcurrentSkipListSet<DecoratedKey> newKeys = new ConcurrentSkipListSet<>(DecoratedKey.comparator);
        keys = putIfAbsent(value, newKeys);
        if (keys == null)
            keys = newKeys;
    }

    keys.add(key);
}
 
Example 3
Source File: KeyRangeIterator.java    From sasi with Apache License 2.0 5 votes vote down vote up
public DKToken(final DecoratedKey key)
{
    super((long) key.token.token);

    keys = new TreeSet<DecoratedKey>(DecoratedKey.comparator)
    {{
        add(key);
    }};
}
 
Example 4
Source File: OnDiskIndexTest.java    From sasi with Apache License 2.0 5 votes vote down vote up
private static Set<DecoratedKey> convert(RangeIterator<Long, Token> results)
{
    if (results == null)
        return Collections.emptySet();

    Set<DecoratedKey> keys = new TreeSet<>(DecoratedKey.comparator);

    while (results.hasNext())
    {
        for (DecoratedKey key : results.next())
            keys.add(key);
    }

    return keys;
}