public void Add(string id, IDictionary<string, string> attributes, string version) { // Find the bucket name for each of attributes var partitions = new Dictionary<string, string>(attributes); foreach (var kv in attributes.Where(kv => _functions.ContainsKey(kv.Key))) { var attributeValue = attributes[kv.Key]; var categoryFunction = _functions[kv.Key]; partitions[kv.Key] = categoryFunction.OwningPartition(attributeValue); } var key = new BucketKey(partitions); if(!_digestBuckets.ContainsKey(key)) { var bucket = new Bucket(key, partitions); _digestBuckets[key] = bucket; } _digestBuckets[key].Add(version); }
public void Add(string id, IDictionary <string, string> attributes, string version) { // Find the bucket name for each of attributes var partitions = new Dictionary <string, string>(attributes); foreach (var kv in attributes.Where(kv => _functions.ContainsKey(kv.Key))) { var attributeValue = attributes[kv.Key]; var categoryFunction = _functions[kv.Key]; partitions[kv.Key] = categoryFunction.OwningPartition(attributeValue); } var key = new BucketKey(partitions); if (!_digestBuckets.ContainsKey(key)) { var bucket = new Bucket(key, partitions); _digestBuckets[key] = bucket; } _digestBuckets[key].Add(version); }
public bool Equals(BucketKey other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } if (_attributes.Count != other._attributes.Count) { return(false); } if (other._attributes.Intersect(_attributes).Count() != _attributes.Count()) { return(false); } return(true); }
public bool Equals(BucketKey other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; if (_attributes.Count != other._attributes.Count) return false; if (other._attributes.Intersect(_attributes).Count() != _attributes.Count()) return false; return true; }
public Bucket(BucketKey key, IDictionary<string, string> attributes) { Key = key; Attributes = attributes; }
public Bucket(BucketKey key, IDictionary <string, string> attributes) { Key = key; Attributes = attributes; }