public void MessageReceived(Message <S, T> message, RemotePostbox sender) { for (int i = 0; i < message.length; ++i) { this.RecordReceived(message.payload[i].PairWith(message.time), sender); } }
public override void Send(Pair <S, T> record, RemotePostbox from) { if (this.serializer == null) { this.serializer = AutoSerialization.GetSerializer <Pair <S, T> >(); } SendBufferPage page = this.messagesFromLocalThreads[from.ThreadIndex]; if (page == null) { this.messagesFromLocalThreads[from.ThreadIndex] = new SendBufferPage(GlobalBufferPool <byte> .pool, this.pageSize); page = this.messagesFromLocalThreads[from.ThreadIndex]; page.WriteHeader(new MessageHeader(from.VertexID, /* TODO FIXME: this.sendSequenceNumbers[destProcessID, destVertexID]++ */ 0, this.Id, this.VertexId, SerializedMessageType.Data)); } if (!page.WriteRecord(this.serializer, record)) { this.Flush(from); this.messagesFromLocalThreads[from.ThreadIndex] = new SendBufferPage(GlobalBufferPool <byte> .pool, this.pageSize); page = this.messagesFromLocalThreads[from.ThreadIndex]; page.WriteHeader(new MessageHeader(from.VertexID, /* TODO FIXME: this.sendSequenceNumbers[destProcessID, destVertexID]++ */ 0, this.Id, this.VertexId, SerializedMessageType.Data)); bool success = page.WriteRecord(this.serializer, record); if (!success) { throw new Exception("Record too long to spill"); } } }
public override void DeliverSerializedMessage(SerializedMessage message, RemotePostbox from) { byte[] headerBuffer = new byte[MessageHeader.SizeOf]; MessageHeader.WriteHeaderToBuffer(headerBuffer, 0, message.Header); lock (this) { if (message.Header.Length == 0) { this.spillStream.Flush(true); this.pagesFlushed = this.pagesWritten; this.dirty = true; } else { Debug.Assert(this.spillStream.Position % this.pageSize == 0); this.spillStream.Write(headerBuffer, 0, headerBuffer.Length); int count = message.Body.End - message.Body.CurrentPos; this.spillStream.Write(message.Body.Buffer, message.Body.CurrentPos, count); int padEnd = this.pageSize - (count + MessageHeader.SizeOf); if (padEnd != 0) { this.spillStream.Seek(padEnd, SeekOrigin.Current); } ++this.pagesWritten; Debug.Assert(this.spillStream.Position % this.pageSize == 0); } } message.Dispose(); this.postOffice.Signal(); }
public virtual void MessageReceived(Message <Pair <S, T> > message, RemotePostbox from) { System.Diagnostics.Debug.Assert(this.AvailableEntrancy >= -1); for (int i = 0; i < message.length; i++) { RecordReceived(message.payload[i], from); } }
public override void MessageReceived(Message <Pair <S, T> > message, RemotePostbox from) { if (this.LoggingEnabled) { this.LogMessage(message); } this.MessageCallback(message, from); }
public void SerializedMessageReceived(SerializedMessage message, RemotePostbox sender) { if (this.decoder == null) { this.decoder = new AutoSerializedMessageDecoder <TRecord, TTime>(); } foreach (Pair <TRecord, TTime> record in this.decoder.Elements(message)) { this.RecordReceived(record, sender); } }
private void SpillLocalMessage(RemotePostbox from) { lock (this) { Debug.Assert(this.spillStream.Position % this.pageSize == 0); this.messagesFromLocalThreads[from.ThreadIndex].FinalizeLastMessage(); using (BufferSegment segment = this.messagesFromLocalThreads[from.ThreadIndex].Consume()) this.SpillBufferSegment(segment, 0); this.messagesFromLocalThreads[from.ThreadIndex].Release(); this.messagesFromLocalThreads[from.ThreadIndex] = null; Debug.Assert(this.spillStream.Position % this.pageSize == 0); } }
public void SerializedMessageReceived(SerializedMessage serializedMessage, RemotePostbox sender) { if (this.decoder == null) { this.decoder = new AutoSerializedMessageDecoder <S, T>(this.Vertex.CodeGenerator); } foreach (Message <S, T> message in this.decoder.AsTypedMessages(serializedMessage)) { this.MessageReceived(message, sender); message.Release(); } }
public void RecordReceived(Pair <TRecord, TTime> record, RemotePostbox sender) { SpinedList <TRecord> list; if (!recordsToProcess.TryGetValue(record.v2, out list)) { list = new SpinedList <TRecord>(); recordsToProcess.Add(record.v2, list); this.Shard.NotifyAt(record.v2); } list.Add(record.v1); }
public override void Flush(RemotePostbox from) { if (this.messagesFromLocalThreads[from.ThreadIndex] != null) { lock (this) { this.SpillLocalMessage(from); this.spillStream.Flush(true); Debug.Assert(this.spillStream.Position % this.pageSize == 0); this.pagesFlushed = this.pagesWritten; this.dirty = true; } this.postOffice.Signal(); } }
public void MessageReceived(Message <Pair <TRecord, TTime> > message, RemotePostbox sender) { for (int i = 0; i < message.length; ++i) { var record = message.payload[i]; SpinedList <TRecord> list; if (!recordsToProcess.TryGetValue(record.v2, out list)) { list = new SpinedList <TRecord>(); recordsToProcess.Add(record.v2, list); this.Shard.NotifyAt(record.v2); } list.Add(record.v1); } }
public abstract void RecordReceived(Pair <S, T> record, RemotePostbox from);
public void SerializedMessageReceived(SerializedMessage message, RemotePostbox from) { System.Diagnostics.Debug.Assert(this.AvailableEntrancy >= -1); if (this.decoder == null) { this.decoder = new AutoSerializedMessageDecoder <S, T>(); } if (this.loggingEnabled) { this.LogMessage(message); } foreach (Pair <S, T> record in this.decoder.Elements(message)) { this.Buffer.payload[this.Buffer.length++] = record; if (this.Buffer.length == this.Buffer.payload.Length) { var temp = Buffer; Buffer.Disable(); if (SpareBuffers.Count > 0) { Buffer = SpareBuffers.Dequeue(); } else { Buffer.Enable(); } this.MessageReceived(temp, from); temp.length = 0; SpareBuffers.Enqueue(temp); System.Diagnostics.Debug.Assert(this.Buffer.length == 0); //this.Buffer.length = 0; } } if (this.Buffer.length > 0) { var temp = Buffer; Buffer.Disable(); if (SpareBuffers.Count > 0) { Buffer = SpareBuffers.Dequeue(); } else { Buffer.Enable(); } this.MessageReceived(temp, from); temp.length = 0; SpareBuffers.Enqueue(temp); System.Diagnostics.Debug.Assert(this.Buffer.length == 0); //this.Buffer.length = 0; } }
public void RecordReceived(Pair <S, T> record, RemotePostbox sender) { this.spillFile.Write(record); this.vertex.NotifyAt(record.v2); }
public void SerializedMessageReceived(SerializedMessage message, RemotePostbox sender) { throw new NotImplementedException(); }
public void MessageReceived(Message <Pair <Int64, Pointstamp> > message, RemotePostbox sender) { throw new NotImplementedException(); }
public void RecordReceived(Pair <Int64, Pointstamp> record, RemotePostbox sender) { throw new NotImplementedException(); }
public override void RecordReceived(Pair <S, T> record, RemotePostbox from) { throw new NotImplementedException(); }
public void MessageReceived(Message <Pair <string, IterationIn <T> > > message, RemotePostbox sender) { var stripped = new Pair <string, T> [message.length]; for (int i = 0; i < message.length; i++) { stripped[i].v1 = message.payload[i].v1; stripped[i].v2 = message.payload[i].v2.s; } Context.Reporting.ForwardLog(stripped); }
public void ForwardDoubleAggregate(Message <Pair <Pair <string, ReportingRecord <double> >, IterationIn <T> > > message, RemotePostbox sender) { for (int i = 0; i < message.length; ++i) { ReportingRecord <double> r = message.payload[i].v1.v2; Context.Reporting.LogAggregate(message.payload[i].v1.v1, r.type, r.payload, r.count, message.payload[i].v2.s); } }