예제 #1
0
        public void SerializedMessageReceived(SerializedMessage serializedMessage, ReturnAddress from)
        {
            System.Diagnostics.Debug.Assert(this.AvailableEntrancy >= -1);
            if (this.decoder == null)
            {
                this.decoder = new AutoSerializedMessageDecoder <S, T>(this.Vertex.SerializationFormat);
            }

            if (this.loggingEnabled)
            {
                this.LogMessage(serializedMessage);
            }

            Message <S, T> msg = new Message <S, T>();

            msg.Allocate(AllocationReason.Deserializer);
            // N.B. At present, AsTypedMessages reuses and yields the same given msg for each batch
            //      of deserialized messages. As a result, the message passed to OnReceive MUST NOT
            //      be queued, because its payload will be overwritten by the next batch of messages.
            foreach (Message <S, T> message in this.decoder.AsTypedMessages(serializedMessage, msg))
            {
                this.OnReceive(message, from);
            }
            msg.Release(AllocationReason.Deserializer);
        }
예제 #2
0
 public override void OnReceive(Message <S, T> message, ReturnAddress from)
 {
     if (this.LoggingEnabled)
     {
         this.LogMessage(message);
     }
     this.MessageCallback(message, from);
 }
예제 #3
0
        /// <summary>
        /// Buffers the content of the given <paramref name="serializedMessage"/>, and
        /// schedules a corresponding notification on the owning <see cref="Vertex"/>.
        /// </summary>
        /// <param name="serializedMessage">The serialized message.</param>
        /// <param name="sender">The sender of the message.</param>
        public void SerializedMessageReceived(SerializedMessage serializedMessage, ReturnAddress sender)
        {
            System.Diagnostics.Debug.Assert(this.AvailableEntrancy >= -1);
            if (this.decoder == null)
            {
                this.decoder = new AutoSerializedMessageDecoder <TRecord, TTime>(this.Vertex.SerializationFormat);
            }

            foreach (Message <TRecord, TTime> message in this.decoder.AsTypedMessages(serializedMessage))
            {
                this.OnReceive(message, sender);
                message.Release();
            }
        }
예제 #4
0
        /// <summary>
        /// Buffers the content of the given <paramref name="message"/>, and schedules
        /// a corresponding notification on the owning <see cref="Vertex"/>.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="sender">The sender of the message.</param>
        public void OnReceive(Message <TRecord, TTime> message, ReturnAddress sender)
        {
            if (!this.recordsToProcess.ContainsKey(message.time))
            {
                this.recordsToProcess.Add(message.time, new SpinedList <TRecord>());
                this.vertex.NotifyAt(message.time);
            }

            var list = this.recordsToProcess[message.time];

            for (int i = 0; i < message.length; ++i)
            {
                list.Add(message.payload[i]);
            }
        }
예제 #5
0
파일: Endpoints.cs 프로젝트: omidm/naiad
        public void SerializedMessageReceived(SerializedMessage serializedMessage, ReturnAddress from)
        {
            System.Diagnostics.Debug.Assert(this.AvailableEntrancy >= -1);
            if (this.decoder == null)
            {
                this.decoder = new AutoSerializedMessageDecoder <S, T>(this.Vertex.SerializationFormat);
            }

            if (this.loggingEnabled)
            {
                this.LogMessage(serializedMessage);
            }

            foreach (Message <S, T> message in this.decoder.AsTypedMessages(serializedMessage))
            {
                this.OnReceive(message, from);
                message.Release();
            }
        }
예제 #6
0
 public abstract void OnReceive(Message <S, T> message, ReturnAddress from);