public IQueryRequest ConsistentWith(MutationState mutationState)
{
#pragma warning disable 618
ScanConsistency(N1QL.ScanConsistency.AtPlus);
#pragma warning restore 618
_scanVectors = new Dictionary<string, Dictionary<string, List<object>>>();
foreach (var token in mutationState)
{
Dictionary<string, List<object>> vector;
if (_scanVectors.TryGetValue(token.BucketRef, out vector))
{
var bucketId = token.VBucketId.ToString();
List<object> bucketRef;
if (vector.TryGetValue(bucketId, out bucketRef))
{
if ((long)bucketRef.First() < token.SequenceNumber)
{
vector[bucketId] = new List<object>
{
token.SequenceNumber,
token.VBucketUUID.ToString()
};
}
}
else
{
vector.Add(token.VBucketId.ToString(),
new List<object>
{
token.SequenceNumber,
token.VBucketUUID.ToString()
});
}
}
else
{
_scanVectors.Add(token.BucketRef, new Dictionary<string, List<object>>
{
{
token.VBucketId.ToString(),
new List<object>
{
token.SequenceNumber,
token.VBucketUUID.ToString()
}
}
});
}
}
return this;
}