Ah. TimeUUID.  Not as useful for you then but still something for the toolbox.

On Mar 27, 2013, at 8:42 AM, Lanny Ripple <la...@spotright.com> wrote:

> A type 4 UUID can be created from two Longs.  You could MD5 your strings 
> giving you 128 hashed bits and then make UUIDs out of that.  Using Scala:
> 
>   import java.nio.ByteBuffer
>   import java.security.MessageDigest
>   import java.util.UUID
> 
>   val key = "Hello, World!"
> 
>   val md = MessageDigest.getInstance("MD5")
>   val dig = md.digest(key.getBytes("UTF-8"))
>   val bb = ByteBuffer.wrap(dig)
> 
>   val msb = bb.getLong
>   val lsb = bb.getLong
> 
>   val uuid = new UUID(msb, lsb)
> 
> 
> On Mar 26, 2013, at 3:22 PM, aaron morton <aa...@thelastpickle.com> wrote:
> 
>>> Any idea?
>> Not off the top of my head.
>> 
>> Cheers
>> 
>> -----------------
>> Aaron Morton
>> Freelance Cassandra Consultant
>> New Zealand
>> 
>> @aaronmorton
>> http://www.thelastpickle.com
>> 
>> On 26/03/2013, at 2:13 AM, Carlos Pérez Miguel <cperez...@gmail.com> wrote:
>> 
>>> Yes it does. Thank you Aaron.
>>> 
>>> Now I realized that the system keyspace uses string as keys, like "Ring" or 
>>> "ClusterName", and I don't know how to convert these type of keys into 
>>> UUID. Any idea?
>>> 
>>> 
>>> Carlos Pérez Miguel
>>> 
>>> 
>>> 2013/3/25 aaron morton <aa...@thelastpickle.com>
>>> The best thing to do is start with a look at ByteOrderedPartitoner and 
>>> AbstractByteOrderedPartitioner. 
>>> 
>>> You'll want to create a new TimeUUIDToken extends Token<UUID> and a new 
>>> UUIDPartitioner that extends AbstractPartitioner<>
>>> 
>>> Usual disclaimer that ordered partitioners cause problems with load 
>>> balancing. 
>>> 
>>> Hope that helps. 
>>> 
>>> -----------------
>>> Aaron Morton
>>> Freelance Cassandra Consultant
>>> New Zealand
>>> 
>>> @aaronmorton
>>> http://www.thelastpickle.com
>>> 
>>> On 25/03/2013, at 1:12 AM, Carlos Pérez Miguel <cperez...@gmail.com> wrote:
>>> 
>>>> Hi,
>>>> 
>>>> I store in my system rows where the key is a UUID version1, TimeUUID. I 
>>>> would like to maintain rows ordered by time. I know that in this case, it 
>>>> is recomended to use an external CF where column names are UUID ordered by 
>>>> time. But in my use case this is not possible, so I would like to use a 
>>>> custom Partitioner in order to do this. If I use ByteOrderedPartitioner 
>>>> rows are not correctly ordered because of the way a UUID stores the 
>>>> timestamp. What is needed in order to implement my own Partitioner?
>>>> 
>>>> Thank you.
>>>> 
>>>> Carlos Pérez Miguel
>>> 
>>> 
>> 
> 

Reply via email to