예제 #1
0
        //for log redaction
        // private Func<object, string> User = RedactableArgument.UserAction;

        public VBucketKeyMapper(BucketConfig config, VBucketServerMap vBucketServerMap, IVBucketFactory vBucketFactory)
        {
            if (config == null)
            {
                ThrowHelper.ThrowArgumentNullException(nameof(config));
            }
            if (vBucketServerMap == null)
            {
                ThrowHelper.ThrowArgumentNullException(nameof(vBucketServerMap));
            }
            if (vBucketFactory == null)
            {
                ThrowHelper.ThrowArgumentNullException(nameof(vBucketFactory));
            }

            _vBucketFactory = vBucketFactory;

            Rev = config.Rev;
            _vBucketServerMap = vBucketServerMap;
            _endPoints        = _vBucketServerMap.EndPoints;
            _bucketName       = config.Name;
            _vBuckets         = CreateVBucketMap();
            _vForwardBuckets  = CreateVBucketMapForwards();

            // Cache the mask for reuse as an optimization
            _mask = VBucketMapper.GetMask(_vBuckets.Count);
        }
예제 #2
0
 public short GetIndex(string key) => VBucketMapper.GetVBucketId(key, _mask);