Permalink
Browse files

Added Index property to VBucket struct

Index property is used to keep track of  the position of a
VBucket in the vbucket map
  • Loading branch information...
1 parent d3e8d65 commit 96fbece92a908d8f19e75a4358b0e16b0faf984a @johnzablocki johnzablocki committed Aug 17, 2012
@@ -21,15 +21,18 @@ public struct VBucket
{
private int master;
private int[] replicas;
+ private int index;
- public VBucket(int master, int[] replicas)
+ public VBucket(int master, int[] replicas, int index)
{
this.master = master;
this.replicas = replicas;
+ this.index = index;
}
public int Master { get { return this.master; } }
public int[] Replicas { get { return this.replicas; } }
+ public int Index { get { return this.index; } }
}
}
@@ -36,7 +36,8 @@ void IProvider.Initialize(Dictionary<string, string> parameters)
var tmp = new JavaScriptSerializer().Deserialize<int[][]>(json);
- this.buckets = tmp.Select(entry => new VBucket(entry[0], entry.Skip(1).ToArray())).ToArray();
+ var i = 0;
+ this.buckets = tmp.Select(entry => new VBucket(entry[0], entry.Skip(1).ToArray(), ++i)).ToArray();
}
IMemcachedNodeLocator IProviderFactory<IMemcachedNodeLocator>.Create()

0 comments on commit 96fbece

Please sign in to comment.