Exemplo n.º 1
0
        void IContextWithForks.ForkUpdate <TState, TReturn2>(IUpdate <TState, TReturn2> update)
        {
            if (!RecordOrReplayCall(MessageType.ForkLocal, out var opid, out var clock, out var instanceId))
            {
                if (!process.States.TryGetValue(typeof(TState), out var stateInfo))
                {
                    throw new BuilderException($"undefined state {typeof(TState).FullName}.");
                }
                var destination = stateInfo.AffinityInfo.LocateAffinity(update);
                (ForkedDestinations ?? (ForkedDestinations = new SortedSet <uint>())).Add(destination);
                var message = stateInfo.CreateLocalMessage(update, this.Opid, true);
                message.Opid           = opid;
                message.Clock          = clock;
                message.Parent         = this.Opid;
                message.LockedByCaller = false;
                process.Send(destination, message);

                process.Telemetry?.OnApplicationEvent(
                    processId: process.ProcessId,
                    id: opid.ToString(),
                    name: update.ToString(),
                    parent: Opid.ToString(),
                    opSide: OperationSide.Fork,
                    opType: OperationType.Local,
                    duration: 0
                    );
            }
        }
Exemplo n.º 2
0
        void IContextWithForks.ForkUpdate <TState1, TReturn>(IUpdate <TState1, TReturn> update)
        {
            if (!process.States.TryGetValue(typeof(TState1), out var stateInfo))
            {
                throw new BuilderException($"undefined state {typeof(TAffinity).FullName}.");
            }
            var destination = stateInfo.AffinityInfo.LocateAffinity(update);
            var opid        = process.NextOpid;
            var message     = stateInfo.CreateLocalMessage(update, CurrentOpid, true);

            message.Opid   = opid;
            message.Parent = CurrentOpid;
            process.Send(destination, message);

            process.Telemetry?.OnApplicationEvent(
                processId: process.ProcessId,
                id: opid.ToString(),
                name: update.ToString(),
                parent: CurrentOpid.ToString(),
                opSide: OperationSide.Fork,
                opType: OperationType.Local,
                duration: 0
                );
        }
Exemplo n.º 3
0
        public void To_String()
        {
            IUpdate update = sql.Update().Top(10);

            Assert.Equal("UPDATE TOP(10)", update.ToString());
        }