Skip to content

Instantly share code, notes, and snippets.

@tylerflint
Created September 14, 2011 17:42
Show Gist options
  • Save tylerflint/1217217 to your computer and use it in GitHub Desktop.
Save tylerflint/1217217 to your computer and use it in GitHub Desktop.
erlang function to add a shard
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