Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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;
        }
Esempio n. 5
0
 public Bucket(BucketKey key, IDictionary<string, string> attributes)
 {
     Key = key;
     Attributes = attributes;
 }
Esempio n. 6
0
 public Bucket(BucketKey key, IDictionary <string, string> attributes)
 {
     Key        = key;
     Attributes = attributes;
 }