public Counter Updated(Counter crdt, object operation, DurableEvent e) { if (operation is UpdateOp) { return(crdt.Update(((UpdateOp)operation).Delta)); } return(crdt); }
public ORSet <T> Effect(ORSet <T> crdt, object operation, DurableEvent e) { switch (operation) { case AddOp add: return(crdt.Add((T)add.Entry, e.VectorTimestamp)); case RemoveOp rem: return(crdt.Remove(rem.Timestamps)); default: throw new NotSupportedException($"ORSet doesn't support [{operation.GetType().FullName}] operation."); } }
public void Remember(DurableEvent <T> e) { while (true) { var old = events; var newEvents = old.Add(e.Offset, e); if (ReferenceEquals(Interlocked.CompareExchange(ref events, newEvents, old), old)) { return; } } }
internal override void ReceiveEvent(DurableEvent e) { base.ReceiveEvent(e); if (Equals(e.Payload, "boom")) { // after restart, there is // a PersistOnEventRequest // duplicate in the mailbox throw TestException.Instance; } else { deliverProbe.Tell(UnconfirmedRequests); } }
public OrSet <T> Updated(OrSet <T> crdt, object operation, DurableEvent e) { if (operation is RemoveOp <T> ) { var remove = (RemoveOp <T>)operation; return(crdt.Remove(remove.Entry, remove.Timestamps)); } if (operation is AddOp <T> ) { var add = (AddOp <T>)operation; return(crdt.Add(add.Entry, e.VectorTimestamp)); } return(crdt); }
protected override DurableEvent PostProcessDurableEvent(DurableEvent e) { var e2 = new DurableEvent( payload: e.Payload, emitterId: e.EmitterId, emitterAggregateId: e.EmitterAggregateId, customDestinationAggregateIds: customDestinationAggregateIds, systemTimestamp: e.SystemTimestamp, vectorTimestamp: e.VectorTimestamp, processId: e.ProcessId, localLogId: e.LocalLogId, localSequenceNr: e.LocalSequenceNr, deliveryId: e.DeliveryId, persistOnEventSequenceNr: e.PersistOnEventSequenceNr, persistOnEventId: e.PersistOnEventId); return(base.PostProcessDurableEvent(e)); }
public WriteFailure(DurableEvent @event, Exception cause, long instanceId) { Event = @event; Cause = cause; InstanceId = instanceId; }
public WriteSuccess(DurableEvent @event, long instanceId) : this() { Event = @event; InstanceId = instanceId; }
public Replaying(DurableEvent @event, long instanceId) { Event = @event; InstanceId = instanceId; }
public MultiValueRegister <T> Updated(MultiValueRegister <T> crdt, object operation, DurableEvent e) { if (operation is SetOp <T> ) { return(crdt.Set(((SetOp <T>)operation).Value, e.VectorTimestamp, e.SystemTimestamp, e.EmitterId)); } return(crdt); }
public override bool Invoke(DurableEvent durableEvent) => durableEvent.Payload is string s && s.StartsWith(prefix);
public override bool Invoke(DurableEvent durableEvent) => durableEvent.Payload.Equals(accept);
private static DurableEvent Event(object payload, long sequenceNr, DurableEvent persistOnEventEvent = null, string emitterId = null) =>
public Counter Effect(Counter crdt, object operation, DurableEvent e) { var op = (UpdateOp)operation; return(crdt.Update((long)op.Delta)); }
public EventLogClock Update(DurableEvent e) { return(new EventLogClock(e.LocalSequenceNr, VersionVector.Merge(e.VectorTimestamp))); }
public override bool Invoke(DurableEvent durableEvent) => true;
public LWWRegister <T> Effect(LWWRegister <T> crdt, object operation, DurableEvent e) { var op = (AssignOp)operation; return(crdt.Assign((T)op.Value, e.VectorTimestamp, e.SystemTimestamp, e.EmitterId)); }
public Written(DurableEvent @event) { Event = @event; }
public LastWriteWinsRegister <T> Updated(LastWriteWinsRegister <T> crdt, object operation, DurableEvent e) { if (operation is SetOp <T> ) { var value = ((SetOp <T>)operation).Value; return(crdt.SetValue(value, e.VectorTimestamp, e.SystemTimestamp, e.EmitterId)); } return(crdt); }