//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); }
public short GetIndex(string key) => VBucketMapper.GetVBucketId(key, _mask);