Created
September 14, 2011 17:42
-
-
Save tylerflint/1217217 to your computer and use it in GitHub Desktop.
erlang function to add a shard
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_shard(Master, Slave) -> | |
ShardId = ?NEW_SHARD_KEY, | |
ShardKey = ?SHARD_KEY_FOR_MEMBERS(ShardId), | |
Members = ?ENCODE_MASTER_SLAVE(Master,Slave), | |
?REDIS(["SET",ShardKey,Members]), | |
{ok,ShardId}. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment