public static Message CreateUpdateMessage(decimal balance, VectorClockImpl clock) { Message msg = new Message(); msg.type = MessageType.Communication; msg.communicationBlock.clock = clock; msg.communicationBlock.payload.balance = balance; return(msg); }
public ComparisonResult Compare(VectorClockImpl other) { bool a = other[this.id] < this[id]; bool b = this[other.id] < other[other.id]; if (a && b) { return(ComparisonResult.Concurrent); } else if (a) { return(ComparisonResult.After); } else { return(ComparisonResult.Before); // or Equal } }
public void update(VectorClockImpl other) { this.timestamps = other.timestamps; }
public VectorClockImpl(VectorClockImpl input) { this.timestamps = input.timestamps; this.id = input.id; }
public CommunicationBlock() { clock = new VectorClockImpl(-1); payload = new CommunicationPayload(); }
public CommunicationBlock(CommunicationBlock input) { clock = new VectorClockImpl(input.clock); payload = new CommunicationPayload(input.payload); }