com.h3c.util.persistence.cassandra.index

## Class HashShardStrategy<C>

- java.lang.Object
- - com.h3c.util.persistence.cassandra.index.HashShardStrategy<C>

- Type Parameters:
    `C` - type of the column name or column key.
  All Implemented Interfaces:
    ShardStrategy<String,C>

      public class HashShardStrategy<C>
      extends Object
      implements ShardStrategy<String,C>

  Shard strategy to distribute column names into several row keys based on a hash function applied to the column value.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `HashShardStrategy(String rowKeyPrefix, int partition)` Creates a shard strategy.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getRowKey(C columnName)` Gets the row key to be used for the given column name.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### HashShardStrategy

          public HashShardStrategy(String rowKeyPrefix,
                           int partition)

      Creates a shard strategy.
      Parameters:
        `rowKeyPrefix` - row key prefix.
        `partition` - the number of rows we want to split the data across.

  - ### Method Detail

    - #### getRowKey

          public String getRowKey(C columnName)

      Description copied from interface: `ShardStrategy`
      Gets the row key to be used for the given column name.
      Specified by:
        `getRowKey` in interface `ShardStrategy<String,C>`
      Parameters:
        `columnName` - column name to fins a sharded key for. This could be part of the column name if the shard strategy is applied to a single component of a composite column name.
      Returns:
        a sharded key for the given column name.

Copyright © 2014. All Rights Reserved.