예제 #1
0
        private static async Task GetIdentitiesValues(DocumentDatabase database, ServerStore serverStore, List <string> identities, List <int> positionInListToCommandIndex, CommandData[] cmds)
        {
            var newIds = await serverStore.GenerateClusterIdentitiesBatchAsync(database.Name, identities);

            Debug.Assert(newIds.Count == identities.Count);

            for (var index = 0; index < positionInListToCommandIndex.Count; index++)
            {
                var value = positionInListToCommandIndex[index];
                cmds[value].Id = cmds[value].Id.Substring(0, cmds[value].Id.Length - 1) + "/" +
                                 newIds[index];
            }
        }
예제 #2
0
        private static async Task GetIdentitiesValues(JsonOperationContext ctx, DocumentDatabase database, ServerStore serverStore,
                                                      List <string> identities, List <int> positionInListToCommandIndex, CommandData[] cmds)
        {
            var newIds = await serverStore.GenerateClusterIdentitiesBatchAsync(database.Name, identities);

            Debug.Assert(newIds.Count == identities.Count);

            var emptyChangeVector = ctx.GetLazyString("");

            for (var index = 0; index < positionInListToCommandIndex.Count; index++)
            {
                var value = positionInListToCommandIndex[index];
                cmds[value].Id = cmds[value].Id.Substring(0, cmds[value].Id.Length - 1) + "/" + newIds[index];

                if (string.IsNullOrEmpty(cmds[value].ChangeVector) == false)
                {
                    ThrowInvalidUsageOfChangeVectorWithIdentities(cmds[value]);
                }
                cmds[value].ChangeVector = emptyChangeVector;
            }
        }